Skip to content

Commit fe32d94

Browse files
authored
Merge pull request #42991 from margelo/fix/e2e-tests-loading-screen-v2
[NoQA] fix: e2e long loading
2 parents d7fd40a + 50ad7b8 commit fe32d94

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

tests/e2e/compare/compare.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function buildCompareEntry(name: string, compare: Stats, baseline: Stats): Entry
5050
/**
5151
* Compare results between baseline and current entries and categorize.
5252
*/
53-
function compareResults(compareEntries: Metric | string, baselineEntries: Metric | string) {
53+
function compareResults(baselineEntries: Metric | string, compareEntries: Metric | string = baselineEntries) {
5454
// Unique test scenario names
5555
const baselineKeys = Object.keys(baselineEntries ?? {});
5656
const names = Array.from(new Set([...baselineKeys]));
@@ -81,8 +81,8 @@ function compareResults(compareEntries: Metric | string, baselineEntries: Metric
8181
}
8282

8383
export default (main: Metric | string, delta: Metric | string, outputFile: string, outputFormat = 'all') => {
84-
// IMPORTANT NOTE: make sure you are passing the delta/compare results first, then the main/baseline results:
85-
const outputData = compareResults(delta, main);
84+
// IMPORTANT NOTE: make sure you are passing the main/baseline results first, then the delta/compare results:
85+
const outputData = compareResults(main, delta);
8686

8787
if (outputFormat === 'console' || outputFormat === 'all') {
8888
printToConsole(outputData);

tests/e2e/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default {
6868
TESTS_CONFIG: {
6969
[TEST_NAMES.AppStartTime]: {
7070
name: TEST_NAMES.AppStartTime,
71-
71+
warmupRuns: 1,
7272
// ... any additional config you might need
7373
},
7474
[TEST_NAMES.OpenChatFinderPage]: {

tests/e2e/testRunner.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ const runTests = async (): Promise<void> => {
156156
for (let testIndex = 0; testIndex < tests.length; testIndex++) {
157157
const test = Object.values(config.TESTS_CONFIG)[testIndex];
158158

159+
// re-instal app for each new test suite
160+
await installApp(config.MAIN_APP_PACKAGE, mainAppPath);
161+
await installApp(config.DELTA_APP_PACKAGE, deltaAppPath);
162+
159163
// check if we want to skip the test
160164
if (args.includes('--includes')) {
161165
const includes = args[args.indexOf('--includes') + 1];
@@ -177,11 +181,17 @@ const runTests = async (): Promise<void> => {
177181

178182
const warmupText = `Warmup for test '${test.name}' [${testIndex + 1}/${tests.length}]`;
179183

180-
// Warmup the main app:
181-
await runTestIteration(config.MAIN_APP_PACKAGE, `[MAIN] ${warmupText}`);
184+
// by default we do 2 warmups:
185+
// - first warmup to pass a login flow
186+
// - second warmup to pass an actual flow and cache network requests
187+
const iterations = test.warmupRuns ?? 2;
188+
for (let i = 0; i < iterations; i++) {
189+
// Warmup the main app:
190+
await runTestIteration(config.MAIN_APP_PACKAGE, `[MAIN] ${warmupText}. Iteration ${i + 1}/${iterations}`);
182191

183-
// Warmup the delta app:
184-
await runTestIteration(config.DELTA_APP_PACKAGE, `[DELTA] ${warmupText}`);
192+
// Warmup the delta app:
193+
await runTestIteration(config.DELTA_APP_PACKAGE, `[DELTA] ${warmupText}. Iteration ${i + 1}/${iterations}`);
194+
}
185195

186196
// For each test case we allow the test to fail three times before we stop the test run:
187197
const errorCountRef = {

0 commit comments

Comments
 (0)