From af87b09f7f8ed8e3704aa18ab76e78b9cf471b09 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Tue, 25 Jun 2024 02:52:51 +1200 Subject: [PATCH 1/2] added extra waiting for tests --- tests/e2e/samples.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/tests/e2e/samples.js b/tests/e2e/samples.js index 32d3b244e..e58ec7ce4 100644 --- a/tests/e2e/samples.js +++ b/tests/e2e/samples.js @@ -92,17 +92,26 @@ async function processSample(page, sample, command) { await page.goto(`file://${htmlPath}`) - //Wait for all network requests to finish - await page.waitForNetworkIdle() + let wait = true; + while (wait) { + //Wait for all intervals in the page to have been cleared + await page.waitForFunction(() => window.activeIntervalCount === 0) - //Wait for all intervals in the page to have been cleared - await page.waitForFunction(() => window.activeIntervalCount === 0) + //Wait for all timers in the page to have all executed + await page.waitForFunction(() => window.activeTimerCount === 0) - //Wait for all timers in the page to have all executed - await page.waitForFunction(() => window.activeTimerCount === 0) + //Wait for the chart animation to end + await page.waitForFunction(() => chart.w.globals.animationEnded) - //Wait for the chart animation to end - await page.waitForFunction(() => chart.w.globals.animationEnded) + //Wait for all network requests to finish + await page.waitForNetworkIdle() + + //After the network requests, timers, and intervals finish, if another request, timer, or interval is created then we need + //to wait for that to finish before continuing on. + wait = await page.evaluate(() => { + return !(window.activeIntervalCount === 0 && window.activeTimerCount === 0 && chart.w.globals.animationEnded) + }) + } // Check that there are no console errors if (consoleErrors.length > 0) { From ab72b9379ec0a78ad5c416cd742fd9835544d678 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Tue, 25 Jun 2024 03:29:40 +1200 Subject: [PATCH 2/2] changed while loop to do while --- tests/e2e/samples.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/samples.js b/tests/e2e/samples.js index e58ec7ce4..fa8c13aea 100644 --- a/tests/e2e/samples.js +++ b/tests/e2e/samples.js @@ -92,8 +92,8 @@ async function processSample(page, sample, command) { await page.goto(`file://${htmlPath}`) - let wait = true; - while (wait) { + let wait; + do { //Wait for all intervals in the page to have been cleared await page.waitForFunction(() => window.activeIntervalCount === 0) @@ -111,7 +111,7 @@ async function processSample(page, sample, command) { wait = await page.evaluate(() => { return !(window.activeIntervalCount === 0 && window.activeTimerCount === 0 && chart.w.globals.animationEnded) }) - } + } while (wait) // Check that there are no console errors if (consoleErrors.length > 0) {