GeezerVison is showing github.com — Add smoke test for flight fixture (#28350) · react/react@81d2a51
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .circleci/config.yml +50Lines changed: 50 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -236,6 +236,53 @@ jobs: | 236 | 236 | RELEASE_CHANNEL: experimental | 237 | 237 | command: ./scripts/circleci/run_devtools_e2e_tests.js | 238 | 238 |
| | 239 | + run_fixtures_flight_tests: | | 240 | + docker: | | 241 | + - image: cimg/openjdk:20.0-node | | 242 | + environment: *environment | | 243 | + steps: | | 244 | + - checkout | | 245 | + - attach_workspace: | | 246 | + at: . | | 247 | + # Fixture copies some built packages from the workroot after install. | | 248 | + # That means dependencies of the built packages are not installed. | | 249 | + # We need to install dependencies of the workroot to fulfill all dependency constraints | | 250 | + - setup_node_modules | | 251 | + - restore_cache: | | 252 | + name: Restore yarn cache of fixture | | 253 | + keys: | | 254 | + - v2-yarn_cache_fixtures_flight-{{ arch }}-{{ checksum "yarn.lock" }} | | 255 | + - run: | | 256 | + name: Install fixture dependencies | | 257 | + working_directory: fixtures/flight | | 258 | + command: | | | 259 | + yarn install --frozen-lockfile --cache-folder ~/.cache/yarn | | 260 | + if [ $? -ne 0 ]; then | | 261 | + yarn install --frozen-lockfile --cache-folder ~/.cache/yarn | | 262 | + fi | | 263 | + - save_cache: | | 264 | + name: Save yarn cache of fixture | | 265 | + key: v2-yarn_cache_fixtures_flight-{{ arch }}-{{ checksum "yarn.lock" }} | | 266 | + paths: | | 267 | + - ~/.cache/yarn | | 268 | + - run: | | 269 | + working_directory: fixtures/flight | | 270 | + name: Playwright install deps | | 271 | + command: | | | 272 | + npx playwright install | | 273 | + sudo npx playwright install-deps | | 274 | + - run: | | 275 | + name: Run tests | | 276 | + working_directory: fixtures/flight | | 277 | + command: yarn test | | 278 | + environment: | | 279 | + # Otherwise the webserver is a blackbox | | 280 | + DEBUG: pw:webserver | | 281 | + - store_artifacts: | | 282 | + path: fixtures/flight/playwright-report | | 283 | + - store_artifacts: | | 284 | + path: fixtures/flight/test-results | | 285 | + | 239 | 286 | run_devtools_tests_for_versions: | 240 | 287 | docker: *docker | 241 | 288 | environment: *environment | @@ -516,6 +563,9 @@ workflows: | 516 | 563 | - run_devtools_e2e_tests: | 517 | 564 | requires: | 518 | 565 | - build_devtools_and_process_artifacts | | 566 | + - run_fixtures_flight_tests: | | 567 | + requires: | | 568 | + - yarn_build | 519 | 569 |
| 520 | 570 | devtools_regression_tests: | 521 | 571 | unless: << pipeline.parameters.prerelease_commit_sha >> | |
Collapse file Copy file name to clipboardExpand all lines: fixtures/flight/.gitignore +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 |
| 8 | 8 | # testing | 9 | 9 | /coverage | | 10 | +/playwright-report | | 11 | +/test-results | 10 | 12 |
| 11 | 13 | # production | 12 | 14 | /build | |
Collapse file Copy file name to clipboard +20Lines changed: 20 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import {test, expect} from '@playwright/test'; | | 2 | + | | 3 | +test('smoke test', async ({page}) => { | | 4 | + const consoleErrors = []; | | 5 | + page.on('console', msg => { | | 6 | + const type = msg.type(); | | 7 | + if (type === 'warn' || type === 'error') { | | 8 | + consoleErrors.push({type: type, text: msg.text()}); | | 9 | + } | | 10 | + }); | | 11 | + const pageErrors = []; | | 12 | + page.on('pageerror', error => { | | 13 | + pageErrors.push(error.stack); | | 14 | + }); | | 15 | + await page.goto('/'); | | 16 | + await expect(page.locator('h1')).toHaveText('Hello World'); | | 17 | + | | 18 | + await expect(consoleErrors).toEqual([]); | | 19 | + await expect(pageErrors).toEqual([]); | | 20 | +}); |
Collapse file Copy file name to clipboardExpand all lines: fixtures/flight/package.json +7-1Lines changed: 7 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | "type": "module", | 4 | 4 | "version": "0.1.0", | 5 | 5 | "private": true, | | 6 | + "devEngines": { | | 7 | + "node": "20.x || 21.x" | | 8 | + }, | 6 | 9 | "dependencies": { | 7 | 10 | "@babel/core": "^7.16.0", | 8 | 11 | "@babel/plugin-proposal-private-property-in-object": "^7.18.6", | | 60 | 63 | "webpack-hot-middleware": "^2.25.3", | 61 | 64 | "webpack-manifest-plugin": "^4.0.2" | 62 | 65 | }, | | 66 | + "devDependencies": { | | 67 | + "@playwright/test": "^1.41.2" | | 68 | + }, | 63 | 69 | "scripts": { | 64 | 70 | "predev": "cp -r ../../build/oss-experimental/* ./node_modules/", | 65 | 71 | "prebuild": "cp -r ../../build/oss-experimental/* ./node_modules/", | | 70 | 76 | "start:global": "NODE_ENV=production node --experimental-loader ./loader/global.js server/global", | 71 | 77 | "start:region": "NODE_ENV=production node --experimental-loader ./loader/region.js --conditions=react-server server/region", | 72 | 78 | "build": "node scripts/build.js", | 73 | | - "test": "node scripts/test.js --env=jsdom" | | 79 | + "test": "playwright test" | 74 | 80 | }, | 75 | 81 | "browserslist": { | 76 | 82 | "production": [ | |
Collapse file Copy file name to clipboard +31Lines changed: 31 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +import {defineConfig, devices} from '@playwright/test'; | | 2 | + | | 3 | +const isCI = Boolean(process.env.CI); | | 4 | + | | 5 | +export default defineConfig({ | | 6 | + // relative to this configuration file. | | 7 | + testDir: '__tests__/__e2e__', | | 8 | + fullyParallel: true, | | 9 | + // Fail the build on CI if you accidentally left test.only in the source code. | | 10 | + forbidOnly: !isCI, | | 11 | + retries: isCI ? 2 : 0, | | 12 | + // Opt out of parallel tests on CI. | | 13 | + workers: isCI ? 1 : undefined, | | 14 | + reporter: 'html', | | 15 | + use: { | | 16 | + baseURL: 'http://localhost:3000', | | 17 | + | | 18 | + trace: 'on-first-retry', | | 19 | + }, | | 20 | + projects: [ | | 21 | + { | | 22 | + name: 'chromium', | | 23 | + use: {...devices['Desktop Chrome']}, | | 24 | + }, | | 25 | + ], | | 26 | + webServer: { | | 27 | + command: 'FAST_REFRESH=false yarn dev', | | 28 | + url: 'http://localhost:3000', | | 29 | + reuseExistingServer: !isCI, | | 30 | + }, | | 31 | +}); |
Collapse file Copy file name to clipboardExpand all lines: fixtures/flight/yarn.lock +22-1Lines changed: 22 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 2689 | 2689 | "@nodelib/fs.scandir" "2.1.3" | 2690 | 2690 | fastq "^1.6.0" | 2691 | 2691 |
| | 2692 | +"@playwright/test@^1.41.2": | | 2693 | + version "1.41.2" | | 2694 | + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.41.2.tgz#bd9db40177f8fd442e16e14e0389d23751cdfc54" | | 2695 | + integrity sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg== | | 2696 | + dependencies: | | 2697 | + playwright "1.41.2" | | 2698 | + | 2692 | 2699 | | 2693 | 2700 | version "0.5.7" | 2694 | 2701 | resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.7.tgz#58f8217ba70069cc6a73f5d7e05e85b458c150e2" | @@ -4885,7 +4892,7 @@ fs.realpath@^1.0.0: | 4885 | 4892 | version "1.0.0" | 4886 | 4893 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" | 4887 | 4894 |
| 4888 | | -fsevents@^2.3.2, fsevents@~2.3.2: | | 4895 | +fsevents@2.3.2, fsevents@^2.3.2, fsevents@~2.3.2: | 4889 | 4896 | version "2.3.2" | 4890 | 4897 | resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" | 4891 | 4898 | integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== | @@ -6644,6 +6651,20 @@ pkg-up@^3.1.0: | 6644 | 6651 | dependencies: | 6645 | 6652 | find-up "^3.0.0" | 6646 | 6653 |
| | 6654 | + | | 6655 | + version "1.41.2" | | 6656 | + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.41.2.tgz#db22372c708926c697acc261f0ef8406606802d9" | | 6657 | + integrity sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA== | | 6658 | + | | 6659 | + | | 6660 | + version "1.41.2" | | 6661 | + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.41.2.tgz#4e760b1c79f33d9129a8c65cc27953be6dd35042" | | 6662 | + integrity sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A== | | 6663 | + dependencies: | | 6664 | + playwright-core "1.41.2" | | 6665 | + optionalDependencies: | | 6666 | + fsevents "2.3.2" | | 6667 | + | 6647 | 6668 | postcss-attribute-case-insensitive@^5.0.2: | 6648 | 6669 | version "5.0.2" | 6649 | 6670 | resolved "https://registry.yarnpkg.com/postcss-attribute-case-insensitive/-/postcss-attribute-case-insensitive-5.0.2.tgz#03d761b24afc04c09e757e92ff53716ae8ea2741" | |
|