Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,20 @@ jobs:
- e2e-test:
test_path: e2e-tests/development-runtime

e2e_tests_development_runtime_with_react_19:
parameters:
node_version:
type: string
e2e_executor_suffix:
type: string
executor: e2e<< parameters.e2e_executor_suffix >>
steps:
# We use curl in this test suite but it isn't available in all images we use
- run: apt-get update && apt-get install -y curl
- e2e-test:
test_path: e2e-tests/development-runtime
react_version: "19.1.1"

e2e_tests_production_runtime_with_react_18:
parameters:
node_version:
Expand All @@ -580,6 +594,30 @@ jobs:
test_path: e2e-tests/production-runtime
test_command: yarn test && yarn test:offline

e2e_tests_production_runtime_with_react_19:
parameters:
node_version:
type: string
e2e_executor_suffix:
type: string
executor: e2e<< parameters.e2e_executor_suffix >>
steps:
- e2e-test:
test_path: e2e-tests/production-runtime
test_command: yarn test && yarn test:offline
react_version: "19.1.1"

e2e_tests_react_19:
parameters:
node_version:
type: string
e2e_executor_suffix:
type: string
executor: e2e<< parameters.e2e_executor_suffix >>
steps:
- e2e-test:
test_path: e2e-tests/react-19

themes_e2e_tests_development_runtime:
parameters:
node_version:
Expand Down Expand Up @@ -902,6 +940,12 @@ workflows:
<<: *e2e-test-workflow
- e2e_tests_production_runtime_with_react_18:
<<: *e2e-test-workflow
- e2e_tests_development_runtime_with_react_19:
<<: *e2e-test-workflow
- e2e_tests_production_runtime_with_react_19:
<<: *e2e-test-workflow
- e2e_tests_react_19:
<<: *e2e-test-workflow
- themes_e2e_tests_production_runtime:
<<: *e2e-test-workflow
- themes_e2e_tests_development_runtime:
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

18 changes: 18 additions & 0 deletions docs/contributing/code-contributions.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ If you're adding e2e tests and want to run them against local changes:
- Run `gatsby-dev` inside your specific e2e test directory, for example `e2e-tests/themes/development-runtime`.
- While the previous step is running, open a new terminal window and run `yarn test` in that same e2e test directory.

### Testing with different React versions

To test compatibility with different React versions, you can use the `upgrade-react.js` script to update the React version in a test directory, then run the tests:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This already existed. I just added some docs and started (re!)using it in CI.


```shell
REACT_VERSION=19.0.0 TEST_PATH=e2e-tests/production-runtime node ./scripts/upgrade-react.js
cd e2e-tests/production-runtime
yarn test
```

This will update the `package.json` file in the test directory to use the specified React version. This is useful for:

- Testing React 19 compatibility
- Verifying backwards compatibility with older React versions
- Ensuring features work across React version boundaries

The same approach works for any e2e test directory. The CI system automatically runs e2e tests against both React 18 and React 19 to catch compatibility issues.

### Troubleshooting

At any point during the contributing process the Gatsby team would love to help! For help with a specific problem you can [open an Discussion on GitHub](https://github.com/gatsbyjs/gatsby/discussions/categories/help).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ describe(`queries in packages`, () => {
})

it(`Should extract and run query from gatsby component`, () => {
cy.title().should(
`eq`,
// Note: in dev this may take a few ms to be populated due to the way the Gatsby Head API is
// implemented
cy.get("head > title").should(
`have.text`,
`Testing queries in packages | Gatsby Default Starter`
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const page = {
deduplication: `${path}/deduplication/`,
htmlAndBodyAttributes: `${path}/html-and-body-attributes/`,
headWithWrapRooElement: `${path}/head-with-wrap-root-element/`,
withoutHead: `${path}/without-head/`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this test happened to work because the 404 page happened to meet the right conditions (no Head()!

}

const data = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function HeadFunctionExportBasic() {
</Link>
<Link
data-testid="navigate-to-page-without-head-export"
to="/without-head"
to="/head-function-export/without-head"
>
Navigate to without head export
</Link>
Expand Down
6 changes: 5 additions & 1 deletion e2e-tests/development-runtime/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ const IndexPage = ({ data }) => (
<ul>
{data.posts.edges.map(({ node }) => (
<li key={node.id}>
<Link to={node.fields.slug}>{node.frontmatter.title}</Link>
{node.fields?.slug ? (
<Link to={node.fields.slug}>{node.frontmatter.title}</Link>
) : (
<span>{node.frontmatter.title} (no slug)</span>
)}
</li>
))}
</ul>
Expand Down
Loading
Loading