From 85ff8e026763c8a8184400701677cb1a86a20336 Mon Sep 17 00:00:00 2001 From: Kayla Washburn-Love Date: Wed, 30 Oct 2024 10:07:19 -0600 Subject: [PATCH] chore: tweak e2e test timeouts (#15275) --- site/e2e/helpers.ts | 6 ++++-- site/e2e/playwright.config.ts | 8 ++------ site/e2e/tests/app.spec.ts | 4 +++- site/e2e/tests/outdatedAgent.spec.ts | 2 +- site/e2e/tests/outdatedCLI.spec.ts | 2 ++ site/e2e/tests/webTerminal.spec.ts | 2 ++ 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/site/e2e/helpers.ts b/site/e2e/helpers.ts index fd436fa5da..c5ac7f1abd 100644 --- a/site/e2e/helpers.ts +++ b/site/e2e/helpers.ts @@ -425,7 +425,9 @@ export const startAgentWithCommand = async ( ); }); - await page.getByTestId("agent-status-ready").waitFor({ state: "visible" }); + await page + .getByTestId("agent-status-ready") + .waitFor({ state: "visible", timeout: 45_000 }); return cp; }; @@ -928,7 +930,7 @@ export async function openTerminalWindow( ): Promise { // Wait for the web terminal to open in a new tab const pagePromise = context.waitForEvent("page"); - await page.getByTestId("terminal").click(); + await page.getByTestId("terminal").click({ timeout: 60_000 }); const terminal = await pagePromise; await terminal.waitForLoadState("domcontentloaded"); diff --git a/site/e2e/playwright.config.ts b/site/e2e/playwright.config.ts index 7042ebfcf5..ea55bf398e 100644 --- a/site/e2e/playwright.config.ts +++ b/site/e2e/playwright.config.ts @@ -65,16 +65,12 @@ export default defineConfig({ testMatch: /.*\.spec\.ts/, dependencies: ["testsSetup"], use: { storageState }, - timeout: 50_000, + timeout: 30_000, }, ], reporter: [["./reporter.ts"]], use: { - // It'd be very nice to add this, but there are some tests that need - // tweaking to make it work consistently (notably, ones that wait for agent - // stats on the workspace page. The default is like 50 seconds, which is - // way too long and makes it painful to wait for test runs in CI. - // actionTimeout: 5000, // 5 seconds + actionTimeout: 5000, baseURL: `http://localhost:${coderPort}`, video: "retain-on-failure", ...(wsEndpoint diff --git a/site/e2e/tests/app.spec.ts b/site/e2e/tests/app.spec.ts index bf127ce9f2..9682fcb575 100644 --- a/site/e2e/tests/app.spec.ts +++ b/site/e2e/tests/app.spec.ts @@ -13,6 +13,8 @@ import { beforeCoderTest } from "../hooks"; test.beforeEach(({ page }) => beforeCoderTest(page)); test("app", async ({ context, page }) => { + test.setTimeout(75_000); + const appContent = "Hello World"; const token = randomUUID(); const srv = http @@ -56,7 +58,7 @@ test("app", async ({ context, page }) => { // Wait for the web terminal to open in a new tab const pagePromise = context.waitForEvent("page"); - await page.getByText(appName).click(); + await page.getByText(appName).click({ timeout: 60_000 }); const app = await pagePromise; await app.waitForLoadState("domcontentloaded"); await app.getByText(appContent).isVisible(); diff --git a/site/e2e/tests/outdatedAgent.spec.ts b/site/e2e/tests/outdatedAgent.spec.ts index a4e42e62ec..422074d92e 100644 --- a/site/e2e/tests/outdatedAgent.spec.ts +++ b/site/e2e/tests/outdatedAgent.spec.ts @@ -17,7 +17,7 @@ const agentVersion = "v2.12.1"; test.beforeEach(({ page }) => beforeCoderTest(page)); test(`ssh with agent ${agentVersion}`, async ({ page }) => { - test.setTimeout(40_000); // This is a slow test, 20s may not be enough on Mac. + test.setTimeout(60_000); const token = randomUUID(); const template = await createTemplate(page, { diff --git a/site/e2e/tests/outdatedCLI.spec.ts b/site/e2e/tests/outdatedCLI.spec.ts index 22301483e0..3470367c63 100644 --- a/site/e2e/tests/outdatedCLI.spec.ts +++ b/site/e2e/tests/outdatedCLI.spec.ts @@ -17,6 +17,8 @@ const clientVersion = "v2.8.0"; test.beforeEach(({ page }) => beforeCoderTest(page)); test(`ssh with client ${clientVersion}`, async ({ page }) => { + test.setTimeout(60_000); + const token = randomUUID(); const template = await createTemplate(page, { apply: [ diff --git a/site/e2e/tests/webTerminal.spec.ts b/site/e2e/tests/webTerminal.spec.ts index 6db4363a4e..fc6baec7da 100644 --- a/site/e2e/tests/webTerminal.spec.ts +++ b/site/e2e/tests/webTerminal.spec.ts @@ -12,6 +12,8 @@ import { beforeCoderTest } from "../hooks"; test.beforeEach(({ page }) => beforeCoderTest(page)); test("web terminal", async ({ context, page }) => { + test.setTimeout(75_000); + const token = randomUUID(); const template = await createTemplate(page, { apply: [