fix(e2e): replace flaky networkidle waits with web-first assertions#121
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tscallawait page.waitForLoadState('networkidle')aftergoto('/').index.htmlloads Google Fonts from external CDNs (fonts.googleapis.com,fonts.gstatic.com).networkidlewaits 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 withretries: 2the job burns ~90s and fails. Playwright officially discouragesnetworkidlefor this reason.Fix
Drop
networkidleand rely on Playwright's auto-waiting web-first assertions:should load the application:toHaveTitle/app-roottoBeVisiblealready auto-wait.should not have console errors: wait forapp-rootto be visible (Angular bootstrapped) instead ofnetworkidle.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