From 2b03e85b611debff51ba06eafd13af6b6fd30135 Mon Sep 17 00:00:00 2001 From: Grace Date: Wed, 13 Mar 2024 11:53:36 +0000 Subject: [PATCH] Add wait for sidebar to load before E2E tests run --- src/e2e/app.ts | 9 +++++++-- src/e2e/edits.test.ts | 4 +--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/e2e/app.ts b/src/e2e/app.ts index b492e45ee..bb59817c2 100644 --- a/src/e2e/app.ts +++ b/src/e2e/app.ts @@ -34,7 +34,7 @@ export interface BrowserDownload { data: Buffer; } -const defaultWaitForOptions = { timeout: 5_000 }; +const defaultWaitForOptions = { timeout: 10_000 }; const baseUrl = "http://localhost:3000"; const reportsPath = "reports/e2e/"; @@ -942,6 +942,8 @@ export class App { this.page = this.createPage(); page = await this.page; await page.goto(this.url); + // Wait for side bar to load + await page.waitForSelector('[data-testid="scrollable-panel"]'); } /** @@ -1032,7 +1034,10 @@ export class App { const button = await document.findByRole("link", { name: linkName, }); - return button.click(); + await button.click(); + + // Wait for side bar to load + await document.waitForSelector('[data-testid="scrollable-panel"]'); } /** diff --git a/src/e2e/edits.test.ts b/src/e2e/edits.test.ts index ede3894ec..834a1dc2c 100644 --- a/src/e2e/edits.test.ts +++ b/src/e2e/edits.test.ts @@ -37,8 +37,6 @@ describe("edits", () => { await app.reloadPage(); - await app.findVisibleEditorContents(/A change/, { - timeout: 2_000, - }); + await app.findVisibleEditorContents(/A change/); }); });