Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NoQA] fix: e2e long loading #42991

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion tests/e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
TESTS_CONFIG: {
[TEST_NAMES.AppStartTime]: {
name: TEST_NAMES.AppStartTime,

warmupRuns: 1,
// ... any additional config you might need
},
[TEST_NAMES.OpenChatFinderPage]: {
Expand Down
18 changes: 14 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,17 @@ 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}`);
// by default we do 2 warmups:
// - first warmup to pass a login flow
// - second warmup to pass an actual flow and cache network requests
const iterations = test.warmupRuns ?? 2;
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
Loading