chore: watch mode improvements (#7326)
This commit is contained in:
@@ -574,6 +574,15 @@ A single e2e test in Open MCT is extended to run:
|
|||||||
- How is Open MCT extending default Playwright functionality?
|
- How is Open MCT extending default Playwright functionality?
|
||||||
- What about Component Testing?
|
- What about Component Testing?
|
||||||
|
|
||||||
|
### Writing Tests
|
||||||
|
|
||||||
|
Playwright provides 3 supported methods of debugging and authoring tests:
|
||||||
|
- A 'watch mode' for running tests locally and debugging on the fly
|
||||||
|
- A 'debug mode' for debugging tests and writing assertions against tests
|
||||||
|
- A 'VSCode plugin' for debugging tests within the VSCode IDE.
|
||||||
|
|
||||||
|
Generally, we encourage folks to use the watch mode and provide a script `npm run test:e2e:watch` which launches the launch mode ui and enables hot reloading on the dev server.
|
||||||
|
|
||||||
### e2e Troubleshooting
|
### e2e Troubleshooting
|
||||||
|
|
||||||
Please follow the general guide troubleshooting in [the general troubleshooting doc](../TESTING.md#troubleshooting-ci)
|
Please follow the general guide troubleshooting in [the general troubleshooting doc](../TESTING.md#troubleshooting-ci)
|
||||||
|
|||||||
54
e2e/playwright-watch.config.js
Normal file
54
e2e/playwright-watch.config.js
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
const { devices } = require('@playwright/test');
|
||||||
|
const MAX_FAILURES = 5;
|
||||||
|
const NUM_WORKERS = 2;
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
retries: 0, //Retries 2 times for a total of 3 runs. When running sharded and with max-failures=5, this should ensure that flake is managed without failing the full suite
|
||||||
|
testDir: 'tests',
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start', //Start in dev mode for hot reloading
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: true //This was originally disabled to prevent differences in local debugging vs. CI. However, it significantly speeds up local debugging.
|
||||||
|
},
|
||||||
|
maxFailures: MAX_FAILURES, //Limits failures to 5 to reduce CI Waste
|
||||||
|
workers: NUM_WORKERS, //Limit to 2 for CircleCI Agent
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testMatch: '**/*.spec.js', // run all tests
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
|
open: 'never',
|
||||||
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
|
}
|
||||||
|
],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
|
['@deploysentinel/playwright']
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
"test:e2e:visual:ci": "percy exec --config ./e2e/.percy.ci.yml --partial -- npx playwright test --config=e2e/playwright-visual-a11y.config.js --project=chrome --grep-invert @unstable",
|
"test:e2e:visual:ci": "percy exec --config ./e2e/.percy.ci.yml --partial -- npx playwright test --config=e2e/playwright-visual-a11y.config.js --project=chrome --grep-invert @unstable",
|
||||||
"test:e2e:visual:full": "percy exec --config ./e2e/.percy.nightly.yml -- npx playwright test --config=e2e/playwright-visual-a11y.config.js --grep-invert @unstable",
|
"test:e2e:visual:full": "percy exec --config ./e2e/.percy.nightly.yml -- npx playwright test --config=e2e/playwright-visual-a11y.config.js --grep-invert @unstable",
|
||||||
"test:e2e:full": "npx playwright test --config=e2e/playwright-ci.config.js --grep-invert @couchdb",
|
"test:e2e:full": "npx playwright test --config=e2e/playwright-ci.config.js --grep-invert @couchdb",
|
||||||
"test:e2e:watch": "npx playwright test --ui --config=e2e/playwright-ci.config.js",
|
"test:e2e:watch": "npx playwright test --ui --config=e2e/playwright-watch.config.js",
|
||||||
"test:perf:contract": "npx playwright test --config=e2e/playwright-performance-dev.config.js",
|
"test:perf:contract": "npx playwright test --config=e2e/playwright-performance-dev.config.js",
|
||||||
"test:perf:localhost": "npx playwright test --config=e2e/playwright-performance-prod.config.js --project=chrome",
|
"test:perf:localhost": "npx playwright test --config=e2e/playwright-performance-prod.config.js --project=chrome",
|
||||||
"test:perf:memory": "npx playwright test --config=e2e/playwright-performance-prod.config.js --project=chrome-memory",
|
"test:perf:memory": "npx playwright test --config=e2e/playwright-performance-prod.config.js --project=chrome-memory",
|
||||||
|
|||||||
Reference in New Issue
Block a user