Skip to content

Commit 5b68e31

Browse files
committed
Add regression test to attribute-behavior fixture
1 parent f273034 commit 5b68e31

File tree

7 files changed

+136
-2
lines changed

7 files changed

+136
-2
lines changed

.circleci/config.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,54 @@ jobs:
291291
- store_artifacts:
292292
path: fixtures/flight/test-results
293293

294+
run_fixtures_attribute-behavior_tests:
295+
docker: *docker
296+
environment: *environment
297+
steps:
298+
- checkout
299+
- attach_workspace:
300+
at: .
301+
- restore_cache:
302+
name: Restore yarn cache
303+
keys:
304+
- v2-yarn_cache_fixtures_attribute-behavior-{{ arch }}-{{ checksum "yarn.lock" }}
305+
- run:
306+
name: Install dependencies
307+
working_directory: fixtures/attribute-behavior
308+
command: |
309+
# --ignore-optional is required to work around https://github.com/yarnpkg/yarn/pull/7273 on Linux.
310+
yarn install --ignore-optional --frozen-lockfile --cache-folder ~/.cache/yarn
311+
if [ $? -ne 0 ]; then
312+
yarn install --ignore-optional --frozen-lockfile --cache-folder ~/.cache/yarn
313+
fi
314+
- save_cache:
315+
name: Save yarn cache
316+
key: v2-yarn_cache_fixtures_attribute-behavior-{{ arch }}-{{ checksum "yarn.lock" }}
317+
paths:
318+
- ~/.cache/yarn
319+
- run:
320+
working_directory: fixtures/attribute-behavior
321+
name: Playwright install deps
322+
command: |
323+
npx playwright install
324+
sudo npx playwright install-deps
325+
- run:
326+
name: Run tests
327+
working_directory: fixtures/attribute-behavior
328+
command: yarn test
329+
330+
- run:
331+
name: Check if snapshot is unchanged
332+
working_directory: fixtures/attribute-behavior
333+
command: |
334+
git diff --exit-code HEAD -- AttributeTableSnapshot.md
335+
- store_artifacts:
336+
path: fixtures/attribute-behavior/AttributeTableSnapshot.md
337+
- store_artifacts:
338+
path: fixtures/attribute-behavior/playwright-report
339+
- store_artifacts:
340+
path: fixtures/attribute-behavior/test-results
341+
294342
run_devtools_tests_for_versions:
295343
docker: *docker
296344
environment: *environment
@@ -579,6 +627,9 @@ workflows:
579627
- run_fixtures_flight_tests:
580628
requires:
581629
- yarn_build
630+
- run_fixtures_attribute-behavior_tests:
631+
requires:
632+
- yarn_build
582633

583634
devtools_regression_tests:
584635
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)