From 75ef9388648d9c872df6c1d5798d1ef9fdc571f9 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Tue, 4 Aug 2026 11:30:42 -0400 Subject: [PATCH] test(e2e): harden browser runs --- tests/specs/layers-and-rendering.e2e.ts | 35 ++++++++++++++++++------- wdio.shared.conf.ts | 6 +++-- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/tests/specs/layers-and-rendering.e2e.ts b/tests/specs/layers-and-rendering.e2e.ts index 02d5d7bdc..66ecd9d04 100644 --- a/tests/specs/layers-and-rendering.e2e.ts +++ b/tests/specs/layers-and-rendering.e2e.ts @@ -46,14 +46,28 @@ describe('Layers and Rendering', () => { } ); - const menus = await volViewPage.datasetMenuButtons; - const menuCount = await menus.length; - if (menuCount < 2) { - throw new Error( - `Expected at least 2 dataset menu buttons, but found ${menuCount}` - ); - } - await menus[1].click(); + const inactiveMenuSelector = + '.volume-card:not(.volume-card-active) button[data-testid="dataset-menu-button"]'; + + await browser.waitUntil( + async () => { + const activeMenus = await $$( + '.volume-card-active button[data-testid="dataset-menu-button"]' + ); + const inactiveMenus = await $$(inactiveMenuSelector); + return ( + (await activeMenus.length) >= 1 && (await inactiveMenus.length) >= 1 + ); + }, + { + timeout: DOWNLOAD_TIMEOUT, + timeoutMsg: + 'Expected active and inactive datasets to be available for layering', + } + ); + + const inactiveMenus = await $$(inactiveMenuSelector); + await inactiveMenus[0].click(); await browser.waitUntil( async () => { @@ -62,7 +76,10 @@ describe('Layers and Rendering', () => { ); return addLayerButton.isClickable(); }, - { timeoutMsg: 'Expected clickable Add Layer button' } + { + timeout: DOWNLOAD_TIMEOUT, + timeoutMsg: 'Expected clickable Add Layer button', + } ); const addLayerButton = await $( diff --git a/wdio.shared.conf.ts b/wdio.shared.conf.ts index 08f31c7a7..e2d131e4b 100644 --- a/wdio.shared.conf.ts +++ b/wdio.shared.conf.ts @@ -41,7 +41,7 @@ export const applyTestViewport = (browser: any) => export const TEST_PORT = 4567; // for slow connections try: // DOWNLOAD_TIMEOUT=60000 && npm run test:e2e:dev -export const DOWNLOAD_TIMEOUT = Number(process.env.DOWNLOAD_TIMEOUT ?? 20000); +export const DOWNLOAD_TIMEOUT = Number(process.env.DOWNLOAD_TIMEOUT ?? 30000); const IS_CI = !!(process.env.CI || process.env.GITHUB_ACTIONS); @@ -68,7 +68,9 @@ export const config: Options.Testrunner = { // ============ // Capabilities // ============ - maxInstances: IS_CI ? 1 : 6, + // WebGL rendering is resource-intensive enough that six local Chrome + // instances can starve one another and exceed view-rendering timeouts. + maxInstances: IS_CI ? 1 : 3, // // =================== // Test Configurations