@samitouri / QOS-React-2 / commits / 0b545551e6

[DevTools] Modify DevTools e2e test script for regression tests (#24642)

Modified the `run_devtools_e2e_tests` script so that you can pass in a React version. If you pass in a version, it will build the DevTools shell and run the e2e tests with that version.

Luna Ruan committed May 31, 2022 at 14:39 UTC 0b545551e6dea328797e64eed6a9677bf4051eae
1 file changed +18 -3
scripts/circleci/run_devtools_e2e_tests.js
+18 -3
@@ -6,7 +6,7 @@ const {spawn} = require('child_process');
6 const {join} = require('path');
7
8 const ROOT_PATH = join(__dirname, '..', '..');
9 -
9 +const reactVersion = process.argv[2];
10 const inlinePackagePath = join(ROOT_PATH, 'packages', 'react-devtools-inline');
11 const shellPackagePath = join(ROOT_PATH, 'packages', 'react-devtools-shell');
12
@@ -74,7 +74,15 @@ function runTestShell() {
74
75 logBright('Starting testing shell server');
76
77 - serverProcess = spawn('yarn', ['start'], {cwd: shellPackagePath});
77 + if (!reactVersion) {
78 + serverProcess = spawn('yarn', ['start'], {cwd: shellPackagePath});
79 + } else {
80 + serverProcess = spawn('yarn', ['start'], {
81 + cwd: shellPackagePath,
82 + env: {...process.env, REACT_VERSION: reactVersion},
83 + });
84 + }
85 +
86 serverProcess.stdout.on('data', data => {
87 if (`${data}`.includes('Compiled successfully.')) {
88 logBright('Testing shell server running');
@@ -106,8 +114,15 @@ function runTestShell() {
114
115 async function runEndToEndTests() {
116 logBright('Running e2e tests');
117 + if (!reactVersion) {
118 + testProcess = spawn('yarn', ['test:e2e'], {cwd: inlinePackagePath});
119 + } else {
120 + testProcess = spawn('yarn', ['test:e2e'], {
121 + cwd: inlinePackagePath,
122 + env: {...process.env, REACT_VERSION: reactVersion},
123 + });
124 + }
125
110 - testProcess = spawn('yarn', ['test:e2e'], {cwd: inlinePackagePath});
126 testProcess.stdout.on('data', data => {
127 // Log without formatting because Playwright applies its own formatting.
128 const formatted = format(data);