Add snapshot testing on e2e test failure (#24672)

We have a currently unreproducible flaky e2e test. This PR captures snapshots on e2e test failures so we can better debug flaky e2e tests that don't fail locally.
This commit is contained in:
Luna Ruan 2022-06-06 10:36:58 -07:00 committed by GitHub
parent 1cd90d2ccc
commit 254b49e589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 4 deletions

View File

@ -291,6 +291,8 @@ jobs:
- run:
name: Cleanup build regression folder
command: rm -r ./build-regression
- store_artifacts:
path: ./tmp/screenshots
yarn_lint_build:
docker: *docker

View File

@ -210,7 +210,6 @@ test.describe('Components', () => {
let count = await getComponentSearchResultsCount();
expect(count).toBe('1 | 4');
await focusComponentSearch();
page.keyboard.insertText('Item');
count = await getComponentSearchResultsCount();
expect(count).toBe('1 | 3');

View File

@ -18,9 +18,10 @@ const config = {
react_version: process.env.REACT_VERSION
? semver.coerce(process.env.REACT_VERSION).version
: reactVersion,
trace: 'retain-on-failure',
},
// Some of our e2e tests can be flaky. Retry tests to make sure the error isn't transient
retries: 2,
retries: 3,
};
module.exports = config;

View File

@ -9,6 +9,7 @@ const ROOT_PATH = join(__dirname, '..', '..');
const reactVersion = process.argv[2];
const inlinePackagePath = join(ROOT_PATH, 'packages', 'react-devtools-inline');
const shellPackagePath = join(ROOT_PATH, 'packages', 'react-devtools-shell');
const screenshotPath = join(ROOT_PATH, 'tmp', 'screenshots');
let buildProcess = null;
let serverProcess = null;
@ -115,9 +116,11 @@ function runTestShell() {
async function runEndToEndTests() {
logBright('Running e2e tests');
if (!reactVersion) {
testProcess = spawn('yarn', ['test:e2e'], {cwd: inlinePackagePath});
testProcess = spawn('yarn', ['test:e2e', `--output=${screenshotPath}`], {
cwd: inlinePackagePath,
});
} else {
testProcess = spawn('yarn', ['test:e2e'], {
testProcess = spawn('yarn', ['test:e2e', `--output=${screenshotPath}`], {
cwd: inlinePackagePath,
env: {...process.env, REACT_VERSION: reactVersion},
});