From bc2e9cb934ffdd09f5229e3bb7e1d520d3f6c4f4 Mon Sep 17 00:00:00 2001 From: Afolabi Olaoluwa Date: Thu, 7 Sep 2023 18:31:17 +0100 Subject: [PATCH] fix: Resolve issues with timeouts and target closures in test framework Increase Playwright browser context timeouts, adjust Web Test Runner configuration for graceful timeout handling, and review test scripts for proper error handling and interactions. This commit addresses issues related to timeouts and target closures in our test framework. It includes improvements to handle timeouts more effectively and prevent unexpected target closures during test execution. - Playwright browser contexts now have increased timeout settings. - Web Test Runner configuration has been adjusted to handle timeouts gracefully. - Test scripts have been reviewed for proper error handling and interactions. This commit ensures the reliability and stability of our automated tests. --- playwright.config.js | 17 ++++++++++++++--- web-test-runner.config.mjs | 30 +++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/playwright.config.js b/playwright.config.js index a4ee43023..df8e3cff6 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -4,13 +4,24 @@ const config = { projects: [ { name: "chrome", - use: { ...devices["Desktop Chrome"] } + use: { + ...devices["Desktop Chrome"], + contextOptions: { + timeout: 60000 + } + } }, { name: "firefox", - use: { ...devices["Desktop Firefox"] } + use: { + ...devices["Desktop Firefox"], + contextOptions: { + timeout: 60000 + } + } } ], + browserStartTimeout: 60000, retries: 2, testDir: "./src/tests/", testMatch: /(functional|integration)\/.*_tests\.js/, @@ -26,4 +37,4 @@ const config = { } } -export default config +export default config \ No newline at end of file diff --git a/web-test-runner.config.mjs b/web-test-runner.config.mjs index 039e6cbec..bcf944f86 100644 --- a/web-test-runner.config.mjs +++ b/web-test-runner.config.mjs @@ -1,13 +1,29 @@ -import { esbuildPlugin } from '@web/dev-server-esbuild'; -import { playwrightLauncher } from '@web/test-runner-playwright'; +import { esbuildPlugin } from '@web/dev-server-esbuild' +import { playwrightLauncher } from '@web/test-runner-playwright' /** @type {import("@web/test-runner").TestRunnerConfig} */ export default { browsers: [ - playwrightLauncher({ product: 'chromium' }), - playwrightLauncher({ product: 'firefox' }), - playwrightLauncher({ product: 'webkit' }), + playwrightLauncher({ + product: 'chromium', + launchOptions: { + timeout: 60000 + } + }), + playwrightLauncher({ + product: 'firefox', + launchOptions: { + timeout: 60000 + } + }), + playwrightLauncher({ + product: 'webkit', + launchOptions: { + timeout: 60000 + } + }) ], + browserStartTimeout: 600000, nodeResolve: true, files: "./src/tests/unit/**/*_tests.js", testFramework: { @@ -17,5 +33,5 @@ export default { }, plugins: [ esbuildPlugin({ ts: true, target: "es2020" }) - ], -}; + ] +} \ No newline at end of file