Skip to content

Commit 220c0f7

Browse files
committed
Add smoke test to flight fixture
1 parent 7ae6e02 commit 220c0f7

File tree

7 files changed

+121
-22
lines changed

7 files changed

+121
-22
lines changed

.circleci/config.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,47 @@ jobs:
284284
command: |
285285
git diff --exit-code HEAD -- AttributeTableSnapshot.md
286286
287+
run_fixtures_flight_tests:
288+
docker: *docker
289+
environment: *environment
290+
steps:
291+
- checkout
292+
- attach_workspace:
293+
at: .
294+
- restore_cache:
295+
name: Restore yarn cache
296+
keys:
297+
- v2-yarn_cache_fixtures_flight-{{ arch }}-{{ checksum "yarn.lock" }}
298+
- run:
299+
name: Install dependencies
300+
working_directory: fixtures/flight
301+
command: |
302+
yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
303+
if [ $? -ne 0 ]; then
304+
yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
305+
fi
306+
- save_cache:
307+
name: Save yarn cache
308+
key: v2-yarn_cache_fixtures_flight-{{ arch }}-{{ checksum "yarn.lock" }}
309+
paths:
310+
- ~/.cache/yarn
311+
- run:
312+
working_directory: fixtures/flight
313+
name: Playwright install deps
314+
command: |
315+
npx playwright install
316+
sudo npx playwright install-deps
317+
- run:
318+
working_directory: fixtures/flight
319+
command: cp -r ../../build/oss-experimental/* ./node_modules/
320+
- run:
321+
name: Run tests
322+
working_directory: fixtures/flight
323+
command: yarn test
287324
- store_artifacts:
288-
path: fixtures/attribute-behavior/AttributeTableSnapshot.md
289-
- store_artifacts:
290-
path: fixtures/attribute-behavior/playwright-report
325+
path: fixtures/flight/playwright-report
291326
- store_artifacts:
292-
path: fixtures/attribute-behavior/test-results
327+
path: fixtures/flight/test-results
293328

294329

295330
run_devtools_tests_for_versions:
@@ -575,6 +610,9 @@ workflows:
575610
- run_fixtures_attribute-behavior_tests:
576611
requires:
577612
- yarn_build
613+
- run_fixtures_flight_tests:
614+
requires:
615+
- yarn_build
578616

579617
devtools_regression_tests:
580618
unless: << pipeline.parameters.prerelease_commit_sha >>

fixtures/flight/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
# testing
99
/coverage
10+
/playwright-report
11+
/test-results
1012

1113
# production
1214
/build
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
17+
await expect(consoleErrors).toEqual([]);
18+
await expect(pageErrors).toEqual([]);
19+
});

fixtures/flight/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
"webpack-hot-middleware": "^2.25.3",
6161
"webpack-manifest-plugin": "^4.0.2"
6262
},
63+
"devDependencies": {
64+
"@playwright/test": "^1.41.2"
65+
},
6366
"scripts": {
6467
"predev": "cp -r ../../build/oss-experimental/* ./node_modules/",
6568
"prebuild": "cp -r ../../build/oss-experimental/* ./node_modules/",
@@ -70,7 +73,7 @@
7073
"start:global": "NODE_ENV=production node --experimental-loader ./loader/global.js server/global",
7174
"start:region": "NODE_ENV=production node --experimental-loader ./loader/region.js --conditions=react-server server/region",
7275
"build": "node scripts/build.js",
73-
"test": "node scripts/test.js --env=jsdom"
76+
"test": "playwright test"
7477
},
7578
"browserslist": {
7679
"production": [

fixtures/flight/playwright.config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import {defineConfig, devices} from '@playwright/test';
2+
3+
const isCI = process.env.CI === '1';
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: 'yarn dev',
28+
url: 'http://localhost:3000',
29+
reuseExistingServer: !isCI,
30+
},
31+
});

fixtures/flight/yarn.lock

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2689,6 +2689,13 @@
26892689
"@nodelib/fs.scandir" "2.1.3"
26902690
fastq "^1.6.0"
26912691

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+
26922699
"@pmmmwh/react-refresh-webpack-plugin@^0.5.3":
26932700
version "0.5.11"
26942701
resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.11.tgz#7c2268cedaa0644d677e8c4f377bc8fb304f714a"
@@ -4885,7 +4892,7 @@ fs.realpath@^1.0.0:
48854892
version "1.0.0"
48864893
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
48874894

4888-
fsevents@^2.3.2, fsevents@~2.3.2:
4895+
fsevents@2.3.2, fsevents@^2.3.2, fsevents@~2.3.2:
48894896
version "2.3.2"
48904897
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
48914898
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
@@ -6644,6 +6651,20 @@ pkg-up@^3.1.0:
66446651
dependencies:
66456652
find-up "^3.0.0"
66466653

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+
66476668
postcss-attribute-case-insensitive@^5.0.2:
66486669
version "5.0.2"
66496670
resolved "https://registry.yarnpkg.com/postcss-attribute-case-insensitive/-/postcss-attribute-case-insensitive-5.0.2.tgz#03d761b24afc04c09e757e92ff53716ae8ea2741"

packages/shared/ReactVersion.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1 @@
1-
/**
2-
* Copyright (c) Meta Platforms, Inc. and affiliates.
3-
*
4-
* This source code is licensed under the MIT license found in the
5-
* LICENSE file in the root directory of this source tree.
6-
*/
7-
8-
// TODO: this is special because it gets imported during build.
9-
//
10-
// TODO: 18.0.0 has not been released to NPM;
11-
// It exists as a placeholder so that DevTools can support work tag changes between releases.
12-
// When we next publish a release, update the matching TODO in backend/renderer.js
13-
// TODO: This module is used both by the release scripts and to expose a version
14-
// at runtime. We should instead inject the version number as part of the build
15-
// process, and use the ReactVersions.js module as the single source of truth.
16-
export default '18.2.0';
1+
export default '18.3.0-PLACEHOLDER';

0 commit comments

Comments
 (0)