From 6773dbe7ff4dd0f1a9ab4dec255c8af9aadc1d45 Mon Sep 17 00:00:00 2001 From: ryanrosello-og <50574915+ryanrosello-og@users.noreply.github.com> Date: Thu, 8 Aug 2024 09:19:07 +1000 Subject: [PATCH] set Playwright actionTimeout to 15 seconds (#3115) * set playwright actionTimeout to 15 seconds * enabled screenshot on failure and html reporter to easily see individual test duration * extend timeout when waiting for console * removed duplicated html reporter --------- Co-authored-by: Kurt Hutten Co-authored-by: ryanrosello-og --- e2e/playwright/test-utils.ts | 19 +++++++++++-------- playwright.config.ts | 2 ++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/e2e/playwright/test-utils.ts b/e2e/playwright/test-utils.ts index 92f673691..6583fc026 100644 --- a/e2e/playwright/test-utils.ts +++ b/e2e/playwright/test-utils.ts @@ -246,14 +246,17 @@ export const getMovementUtils = (opts: any) => { } async function waitForAuthAndLsp(page: Page) { - const waitForLspPromise = page.waitForEvent('console', async (message) => { - // it would be better to wait for a message that the kcl lsp has started by looking for the message message.text().includes('[lsp] [window/logMessage]') - // but that doesn't seem to make it to the console for macos/safari :( - if (message.text().includes('start kcl lsp')) { - await new Promise((resolve) => setTimeout(resolve, 200)) - return true - } - return false + const waitForLspPromise = page.waitForEvent('console', { + predicate: async (message) => { + // it would be better to wait for a message that the kcl lsp has started by looking for the message message.text().includes('[lsp] [window/logMessage]') + // but that doesn't seem to make it to the console for macos/safari :( + if (message.text().includes('start kcl lsp')) { + await new Promise((resolve) => setTimeout(resolve, 200)) + return true + } + return false + }, + timeout: 45_000, }) if (process.env.CI) { await waitForPageLoadWithRetry(page) diff --git a/playwright.config.ts b/playwright.config.ts index 1a4d01290..27e49efbe 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -32,6 +32,8 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'retain-on-failure', + actionTimeout: 15000, + screenshot: 'only-on-failure', }, /* Configure projects for major browsers */