Skip to content

fix(e2e): replace flaky networkidle waits with web-first assertions#121

Merged
Helias merged 3 commits into
masterfrom
fix/e2e-flaky-networkidle
Jun 6, 2026
Merged

fix(e2e): replace flaky networkidle waits with web-first assertions#121
Helias merged 3 commits into
masterfrom
fix/e2e-flaky-networkidle

Conversation

@Helias

@Helias Helias commented Jun 6, 2026

Copy link
Copy Markdown
Member

Problem

The E2E (Playwright) CI job fails intermittently (e.g. run #27070665725 on PR #120, exit code 1, ~2m18s). It is not caused by the code under test — reproducing that PR's branch locally passes all unit + E2E tests.

Both tests in e2e/app.spec.ts call await page.waitForLoadState('networkidle') after goto('/'). index.html loads Google Fonts from external CDNs (fonts.googleapis.com, fonts.gstatic.com). networkidle waits for 500ms with zero in-flight requests; when a font request stalls on the CI runner, networkidle never settles, the test hits its 30s timeout, and with retries: 2 the job burns ~90s and fails. Playwright officially discourages networkidle for this reason.

Fix

Drop networkidle and rely on Playwright's auto-waiting web-first assertions:

  • should load the application: toHaveTitle / app-root toBeVisible already auto-wait.
  • should not have console errors: wait for app-root to be visible (Angular bootstrapped) instead of networkidle.

No app or workflow changes; behavior of the assertions is unchanged, only the flaky wait is removed.

Verification

Reproduced the CI sequence locally (Node 22, same fixtures, CI=true): unit tests (14 passed) and E2E (2 passed) green before and after the change

Helias added 3 commits June 6, 2026 23:34
waitForLoadState('networkidle') never settles when the external Google
Fonts CDN stalls on CI, causing intermittent 30s timeouts in the E2E job.
Wait on auto-retrying assertions (toHaveTitle / app-root visible) instead.
The E2E job failed with 'Executable doesn't exist at
chromium_headless_shell-1187'. 'npx playwright install' ran before
'npm ci', so with no node_modules npx fetched the latest Playwright
(1.60.0) and installed browser revision 1223, while the pinned
@playwright/test 1.55.0 looks for revision 1187 at test time.

Run the browser install after 'npm ci' so npx resolves the project's
pinned Playwright and downloads the matching browser build.
@Helias Helias merged commit 676b6f2 into master Jun 6, 2026
1 check passed
@Helias Helias deleted the fix/e2e-flaky-networkidle branch June 6, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant