Skip to content

Add regression test to attribute-behavior fixture #28349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,54 @@ jobs:
- store_artifacts:
path: fixtures/flight/test-results

run_fixtures_attribute-behavior_tests:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace:
at: .
- restore_cache:
name: Restore yarn cache
keys:
- v2-yarn_cache_fixtures_attribute-behavior-{{ arch }}-{{ checksum "yarn.lock" }}
- run:
name: Install dependencies
working_directory: fixtures/attribute-behavior
command: |
# --ignore-optional is required to work around https://github.com/yarnpkg/yarn/pull/7273 on Linux.
yarn install --ignore-optional --frozen-lockfile --cache-folder ~/.cache/yarn
if [ $? -ne 0 ]; then
yarn install --ignore-optional --frozen-lockfile --cache-folder ~/.cache/yarn
fi
- save_cache:
name: Save yarn cache
key: v2-yarn_cache_fixtures_attribute-behavior-{{ arch }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
working_directory: fixtures/attribute-behavior
name: Playwright install deps
command: |
npx playwright install
sudo npx playwright install-deps
- run:
name: Run tests
working_directory: fixtures/attribute-behavior
command: yarn test

- run:
name: Check if snapshot is unchanged
working_directory: fixtures/attribute-behavior
command: |
git diff --exit-code HEAD -- AttributeTableSnapshot.md
- store_artifacts:
path: fixtures/attribute-behavior/AttributeTableSnapshot.md
- store_artifacts:
path: fixtures/attribute-behavior/playwright-report
- store_artifacts:
path: fixtures/attribute-behavior/test-results

run_devtools_tests_for_versions:
docker: *docker
environment: *environment
Expand Down Expand Up @@ -579,6 +627,9 @@ workflows:
- run_fixtures_flight_tests:
requires:
- yarn_build
- run_fixtures_attribute-behavior_tests:
requires:
- yarn_build

devtools_regression_tests:
unless: << pipeline.parameters.prerelease_commit_sha >>
Expand Down
2 changes: 2 additions & 0 deletions fixtures/attribute-behavior/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

# testing
/coverage
/playwright-report
/test-results

# production
/build
Expand Down
8 changes: 8 additions & 0 deletions fixtures/attribute-behavior/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ Right now, we use a purple outline to call out cases where the assigned property
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

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).


## Tests

### end-to-end

End-to-end tests are written for [Playwright](https://playwright.dev/).
For local debugging, run `yarn test --ui`.
18 changes: 18 additions & 0 deletions fixtures/attribute-behavior/__tests__/__e2e__/regression.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {test, expect} from '@playwright/test';

test(
'AttributeTableSnapshot is unchanged',
async ({page}) => {
test.setTimeout(1 * 60_000);
await page.goto('/');

await expect(page).toHaveTitle('Ready', {timeout: 1 * 60_000});

const downloadPromise = page.waitForEvent('download');
await page.getByText('Save latest results to a file').click();
const download = await downloadPromise;

await download.saveAs('AttributeTableSnapshot.md');
},
{timeout: 6 * 60_000}
);
8 changes: 7 additions & 1 deletion fixtures/attribute-behavior/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
"react-scripts": "1.0.11",
"react-virtualized": "^9.9.0"
},
"devDependencies": {
"@playwright/test": "^1.41.2"
},
"optionalDependencies": {
"fsevents": "1.2.13"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required to work around yarnpkg/yarn#7273 on Linux.

Also requires running install with --ignore-optional

},
"resolutions": {
"fsevents": "1.2.13"
},
Expand All @@ -18,7 +24,7 @@
"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/",
"dev": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"test": "playwright test",
"eject": "react-scripts eject"
}
}
31 changes: 31 additions & 0 deletions fixtures/attribute-behavior/playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {defineConfig, devices} from '@playwright/test';

const isCI = process.env.CI === 'true';

export default defineConfig({
// relative to this configuration file.
testDir: '__tests__/__e2e__',
fullyParallel: true,
// Fail the build on CI if you accidentally left test.only in the source code.
forbidOnly: !isCI,
retries: isCI ? 2 : 0,
// Opt out of parallel tests on CI.
workers: isCI ? 1 : undefined,
reporter: 'html',
use: {
baseURL: 'http://localhost:3000',

trace: 'on-first-retry',
},
projects: [
{
name: 'chromium',
use: {...devices['Desktop Chrome']},
},
],
webServer: {
command: 'yarn dev',
url: 'http://localhost:3000',
reuseExistingServer: !isCI,
},
});
23 changes: 22 additions & 1 deletion fixtures/attribute-behavior/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
# yarn lockfile v1


"@playwright/test@^1.41.2":
version "1.41.2"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.41.2.tgz#bd9db40177f8fd442e16e14e0389d23751cdfc54"
integrity sha512-qQB9h7KbibJzrDpkXkYvsmiDJK14FULCCZgEcoe2AvFAS64oCirWTwzTlAYEbKaRxWs5TFesE1Na6izMv3HfGg==
dependencies:
playwright "1.41.2"

abab@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d"
Expand Down Expand Up @@ -2705,7 +2712,7 @@ fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"

[email protected], [email protected], fsevents@^1.0.0:
[email protected], [email protected], fsevents@2.3.2, fsevents@^1.0.0:
version "1.2.13"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.13.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38"
integrity sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==
Expand Down Expand Up @@ -4621,6 +4628,20 @@ pkg-dir@^2.0.0:
dependencies:
find-up "^2.1.0"

[email protected]:
version "1.41.2"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.41.2.tgz#db22372c708926c697acc261f0ef8406606802d9"
integrity sha512-VaTvwCA4Y8kxEe+kfm2+uUUw5Lubf38RxF7FpBxLPmGe5sdNkSg5e3ChEigaGrX7qdqT3pt2m/98LiyvU2x6CA==

[email protected]:
version "1.41.2"
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.41.2.tgz#4e760b1c79f33d9129a8c65cc27953be6dd35042"
integrity sha512-v0bOa6H2GJChDL8pAeLa/LZC4feoAMbSQm1/jF/ySsWWoaNItvrMP7GEkvEEFyCTUYKMxjQKaTSg5up7nR6/8A==
dependencies:
playwright-core "1.41.2"
optionalDependencies:
fsevents "2.3.2"

pluralize@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-4.0.0.tgz#59b708c1c0190a2f692f1c7618c446b052fd1762"
Expand Down