Skip to content

Commit

Permalink
fix: e2e long loading
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Jun 3, 2024
1 parent a3d1dd1 commit a4d89b0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tests/e2e/compare/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function buildCompareEntry(name: string, compare: Stats, baseline: Stats): Entry
/**
* Compare results between baseline and current entries and categorize.
*/
function compareResults(compareEntries: Metric | string, baselineEntries: Metric | string) {
function compareResults(baselineEntries: Metric | string, compareEntries: Metric | string = baselineEntries) {
// Unique test scenario names
const baselineKeys = Object.keys(baselineEntries ?? {});
const names = Array.from(new Set([...baselineKeys]));
Expand Down Expand Up @@ -81,8 +81,8 @@ function compareResults(compareEntries: Metric | string, baselineEntries: Metric
}

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

if (outputFormat === 'console' || outputFormat === 'all') {
printToConsole(outputData);
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default {
},
[TEST_NAMES.OpenChatFinderPage]: {
name: TEST_NAMES.OpenChatFinderPage,
requiresDoubleWarmup: true,
},
// TODO: Fix text and enable again
// [TEST_NAMES.ReportTyping]: {
Expand All @@ -82,11 +83,13 @@ export default {
// },
// // Crowded Policy (Do Not Delete) Report, has a input bar available:
// reportID: '8268282951170052',
// requiresDoubleWarmup: true,
// },
[TEST_NAMES.ChatOpening]: {
name: TEST_NAMES.ChatOpening,
// #announce Chat with many messages
reportID: '5421294415618529',
requiresDoubleWarmup: true,
},
// TODO: fix and enable again
// [TEST_NAMES.Linking]: {
Expand All @@ -98,6 +101,7 @@ export default {
// reportID: '8268282951170052',
// linkedReportID: '5421294415618529',
// linkedReportActionID: '2845024374735019929',
// requiresDoubleWarmup: true,
// },
},
};
Expand Down
16 changes: 12 additions & 4 deletions tests/e2e/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ const runTests = async (): Promise<void> => {
for (let testIndex = 0; testIndex < tests.length; testIndex++) {
const test = Object.values(config.TESTS_CONFIG)[testIndex];

// re-instal app for each new test suite
await installApp(config.MAIN_APP_PACKAGE, mainAppPath);
await installApp(config.DELTA_APP_PACKAGE, deltaAppPath);

// check if we want to skip the test
if (args.includes('--includes')) {
const includes = args[args.indexOf('--includes') + 1];
Expand All @@ -177,11 +181,15 @@ const runTests = async (): Promise<void> => {

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

// Warmup the main app:
await runTestIteration(config.MAIN_APP_PACKAGE, `[MAIN] ${warmupText}`);
const requiresDoubleWarmup = test.requiresDoubleWarmup ?? false;
const iterations = requiresDoubleWarmup ? 2 : 1;
for (let i = 0; i < iterations; i++) {
// Warmup the main app:
await runTestIteration(config.MAIN_APP_PACKAGE, `[MAIN] ${warmupText}. Iteration ${i + 1}/${iterations}`);

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

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

0 comments on commit a4d89b0

Please sign in to comment.