Skip to content

Commit 254b49e

Browse files
authored
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.
1 parent 1cd90d2 commit 254b49e

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.circleci/config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ jobs:
291291
- run:
292292
name: Cleanup build regression folder
293293
command: rm -r ./build-regression
294+
- store_artifacts:
295+
path: ./tmp/screenshots
294296

295297
yarn_lint_build:
296298
docker: *docker

packages/react-devtools-inline/__tests__/__e2e__/components.test.js

-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ test.describe('Components', () => {
210210
let count = await getComponentSearchResultsCount();
211211
expect(count).toBe('1 | 4');
212212

213-
await focusComponentSearch();
214213
page.keyboard.insertText('Item');
215214
count = await getComponentSearchResultsCount();
216215
expect(count).toBe('1 | 3');

packages/react-devtools-inline/playwright.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ const config = {
1818
react_version: process.env.REACT_VERSION
1919
? semver.coerce(process.env.REACT_VERSION).version
2020
: reactVersion,
21+
trace: 'retain-on-failure',
2122
},
2223
// Some of our e2e tests can be flaky. Retry tests to make sure the error isn't transient
23-
retries: 2,
24+
retries: 3,
2425
};
2526

2627
module.exports = config;

scripts/circleci/run_devtools_e2e_tests.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const ROOT_PATH = join(__dirname, '..', '..');
99
const reactVersion = process.argv[2];
1010
const inlinePackagePath = join(ROOT_PATH, 'packages', 'react-devtools-inline');
1111
const shellPackagePath = join(ROOT_PATH, 'packages', 'react-devtools-shell');
12+
const screenshotPath = join(ROOT_PATH, 'tmp', 'screenshots');
1213

1314
let buildProcess = null;
1415
let serverProcess = null;
@@ -115,9 +116,11 @@ function runTestShell() {
115116
async function runEndToEndTests() {
116117
logBright('Running e2e tests');
117118
if (!reactVersion) {
118-
testProcess = spawn('yarn', ['test:e2e'], {cwd: inlinePackagePath});
119+
testProcess = spawn('yarn', ['test:e2e', `--output=${screenshotPath}`], {
120+
cwd: inlinePackagePath,
121+
});
119122
} else {
120-
testProcess = spawn('yarn', ['test:e2e'], {
123+
testProcess = spawn('yarn', ['test:e2e', `--output=${screenshotPath}`], {
121124
cwd: inlinePackagePath,
122125
env: {...process.env, REACT_VERSION: reactVersion},
123126
});

0 commit comments

Comments
 (0)