Skip to content

Commit bb9bbe1

Browse files
committed
Add regression test to attribute-behavior fixture
1 parent e7592df commit bb9bbe1

File tree

7 files changed

+144
-2
lines changed

7 files changed

+144
-2
lines changed

.circleci/config.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,62 @@ jobs:
236236
RELEASE_CHANNEL: experimental
237237
command: ./scripts/circleci/run_devtools_e2e_tests.js
238238

239+
run_fixtures_attribute-behavior_tests:
240+
docker: *docker
241+
environment: *environment
242+
steps:
243+
- checkout
244+
- attach_workspace:
245+
at: .
246+
- restore_cache:
247+
name: Restore yarn cache
248+
keys:
249+
- v2-yarn_cache_fixtures_attribute-behavior-{{ arch }}-{{ checksum "yarn.lock" }}
250+
- run:
251+
name: Install dependencies
252+
working_directory: fixtures/attribute-behavior
253+
command: |
254+
# --ignore-optional is required to work around https://github.com/yarnpkg/yarn/pull/7273 on Linux.
255+
yarn install --ignore-optional --frozen-lockfile --cache-folder ~/.cache/yarn
256+
if [ $? -ne 0 ]; then
257+
yarn install --ignore-optional --frozen-lockfile --cache-folder ~/.cache/yarn
258+
fi
259+
environment:
260+
# If we start needing the Electron binary, please ensure the binary is cached in CI following https://www.electronjs.org/docs/latest/tutorial/installation
261+
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
262+
- save_cache:
263+
name: Save yarn cache
264+
key: v2-yarn_cache_fixtures_attribute-behavior-{{ arch }}-{{ checksum "yarn.lock" }}
265+
paths:
266+
- ~/.cache/yarn
267+
- run:
268+
working_directory: fixtures/attribute-behavior
269+
name: Playwright install deps
270+
command: |
271+
npx playwright install
272+
sudo npx playwright install-deps
273+
- run:
274+
working_directory: fixtures/attribute-behavior
275+
command: cp ../../build/oss-experimental/react/umd/react.development.js public/ && cp ../../build/oss-experimental/react-dom/umd/react-dom.development.js public/ && cp ../../build/oss-experimental/react-dom/umd/react-dom-server.browser.development.js public/
276+
- run:
277+
name: Run tests
278+
working_directory: fixtures/attribute-behavior
279+
command: yarn test
280+
281+
- run:
282+
name: Check if snapshot is unchanged
283+
working_directory: fixtures/attribute-behavior
284+
command: |
285+
git diff --exit-code HEAD -- AttributeTableSnapshot.md
286+
287+
- store_artifacts:
288+
path: fixtures/attribute-behavior/AttributeTableSnapshot.md
289+
- store_artifacts:
290+
path: fixtures/attribute-behavior/playwright-report
291+
- store_artifacts:
292+
path: fixtures/attribute-behavior/test-results
293+
294+
239295
run_devtools_tests_for_versions:
240296
docker: *docker
241297
environment: *environment
@@ -516,6 +572,9 @@ workflows:
516572
- run_devtools_e2e_tests:
517573
requires:
518574
- build_devtools_and_process_artifacts
575+
- run_fixtures_attribute-behavior_tests:
576+
requires:
577+
- yarn_build
519578

520579
devtools_regression_tests:
521580
unless: << pipeline.parameters.prerelease_commit_sha >>

fixtures/attribute-behavior/.gitignore

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

66
# testing
77
/coverage
8+
/playwright-report
9+
/test-results
810

911
# production
1012
/build

fixtures/attribute-behavior/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@ Right now, we use a purple outline to call out cases where the assigned property
2828
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2929

3030
You can find the guide for how to do things in a CRA [here](https://github.com/facebook/create-react-app/blob/main/packages/cra-template/template/README.md).
31+
32+
33+
## Tests
34+
35+
### end-to-end
36+
37+
End-to-end tests are written for [Playwright](https://playwright.dev/).
38+
For local debugging, run `yarn test --ui`.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import {test, expect} from '@playwright/test';
2+
3+
test(
4+
'AttributeTableSnapshot is unchanged',
5+
async ({page}) => {
6+
test.setTimeout(1 * 60_000);
7+
await page.goto('/');
8+
9+
await expect(page).toHaveTitle('Ready', {timeout: 1 * 60_000});
10+
11+
const downloadPromise = page.waitForEvent('download');
12+
await page.getByText('Save latest results to a file').click();
13+
const download = await downloadPromise;
14+
15+
await download.saveAs('AttributeTableSnapshot.md');
16+
},
17+
{timeout: 6 * 60_000}
18+
);

fixtures/attribute-behavior/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"react-scripts": "1.0.11",
1111
"react-virtualized": "^9.9.0"
1212
},
13+
"devDependencies": {
14+
"@playwright/test": "^1.41.2"
15+
},
1316
"optionalDependencies": {
1417
"fsevents": "1.2.13"
1518
},
@@ -21,7 +24,7 @@
2124
"cp ../../build/oss-experimental/react/umd/react.development.js public/ && cp ../../build/oss-experimental/react-dom/umd/react-dom.development.js public/ && cp ../../build/oss-experimental/react-dom/umd/react-dom-server.browser.development.js public/",
2225
"dev": "react-scripts start",
2326
"build": "react-scripts build",
24-
"test": "react-scripts test --env=jsdom",
27+
"test": "playwright test",
2528
"eject": "react-scripts eject"
2629
}
2730
}
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 === 'true';
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/attribute-behavior/yarn.lock

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
# yarn lockfile v1
33

44

5+
"@playwright/test@^1.41.2":
6+
version "1.41.2"
7+
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.41.2.tgz#bd9db40177f8fd442e16e14e0389d23751cdfc54"
8+
integrity sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg==
9+
dependencies:
10+
playwright "1.41.2"
11+
512
abab@^1.0.3:
613
version "1.0.3"
714
resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d"
@@ -2705,7 +2712,7 @@ fs.realpath@^1.0.0:
27052712
version "1.0.0"
27062713
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
27072714

2708-
fsevents@1.1.2, fsevents@1.2.13, fsevents@^1.0.0:
2715+
fsevents@1.1.2, fsevents@1.2.13, fsevents@2.3.2, fsevents@^1.0.0:
27092716
version "1.2.13"
27102717
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.13.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38"
27112718
integrity sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==
@@ -4621,6 +4628,20 @@ pkg-dir@^2.0.0:
46214628
dependencies:
46224629
find-up "^2.1.0"
46234630

4631+
playwright-core@1.41.2:
4632+
version "1.41.2"
4633+
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.41.2.tgz#db22372c708926c697acc261f0ef8406606802d9"
4634+
integrity sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA==
4635+
4636+
playwright@1.41.2:
4637+
version "1.41.2"
4638+
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.41.2.tgz#4e760b1c79f33d9129a8c65cc27953be6dd35042"
4639+
integrity sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A==
4640+
dependencies:
4641+
playwright-core "1.41.2"
4642+
optionalDependencies:
4643+
fsevents "2.3.2"
4644+
46244645
pluralize@^4.0.0:
46254646
version "4.0.0"
46264647
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-4.0.0.tgz#59b708c1c0190a2f692f1c7618c446b052fd1762"

0 commit comments

Comments
 (0)