fix(e2e): use generous 120s timeout for all Playwright system operations

electron.launch, firstWindow, waitForLoadState are system-level
operations (process creation, window management), not test assertions.
They need generous timeouts independent of measured step time.
Cucumber step timeout still catches truly hung test steps.
This commit is contained in:
linonetwo 2026-05-05 19:12:04 +08:00
parent efc41728e9
commit 3d67516f61
2 changed files with 6 additions and 3 deletions

View file

@ -378,6 +378,9 @@ AfterStep({ timeout: 3000 }, async function(this: ApplicationWorld, { pickle, pi
// Read docs/Testing.md section "Key E2E Testing Patterns" point 6 before attempting any changes.
// Maximum allowed timeouts: Local 5s, CI 10s (exactly 2x local, no more)
When('I launch the TidGi application', async function(this: ApplicationWorld) {
// Fire-and-forget: don't block step on process launch.
// The next step ("wait for page to load") handles window acquisition.
this.appLaunchPromise = launchTidGiApplication(this).catch((error: unknown) => {
throw error;
});

View file

@ -2,7 +2,7 @@ import { DataTable, Then, When } from '@cucumber/cucumber';
import { backOff } from 'exponential-backoff';
import { parseDataTableRows } from '../supports/dataTable';
import { getWikiTestRootPath } from '../supports/paths';
import { HEAVY_PLAYWRIGHT_TIMEOUT, PLAYWRIGHT_SHORT_TIMEOUT, PLAYWRIGHT_TIMEOUT } from '../supports/timeouts';
import { PLAYWRIGHT_SHORT_TIMEOUT, PLAYWRIGHT_TIMEOUT } from '../supports/timeouts';
import type { ApplicationWorld } from './application';
When('I wait for {float} seconds', async function(seconds: number) {
@ -32,11 +32,11 @@ When('I wait for the page to load completely', async function(this: ApplicationW
let currentWindow = this.currentWindow;
if ((!currentWindow || currentWindow.isClosed()) && this.app) {
currentWindow = await this.app.firstWindow({ timeout: HEAVY_PLAYWRIGHT_TIMEOUT });
currentWindow = await this.app.firstWindow({ timeout: 120_000 });
this.mainWindow = this.mainWindow ?? currentWindow;
this.currentWindow = currentWindow;
}
await currentWindow?.waitForLoadState('domcontentloaded', { timeout: HEAVY_PLAYWRIGHT_TIMEOUT });
await currentWindow?.waitForLoadState('domcontentloaded', { timeout: 120_000 });
// Short networkidle gives workspace-creation and other startup IPC time to finish
// without blocking on long-lived connections. 3s is intentionally different from
// PLAYWRIGHT_TIMEOUT — this is just a grace period, not a hard requirement.