Skip to content

test: cover waitforhelper network multiplier and navigation paths - #2515

Open
ZayanKhan-12 wants to merge 1 commit into
ChromeDevTools:mainfrom
ZayanKhan-12:chore/tests-waitforhelper
Open

test: cover waitforhelper network multiplier and navigation paths#2515
ZayanKhan-12 wants to merge 1 commit into
ChromeDevTools:mainfrom
ZayanKhan-12:chore/tests-waitforhelper

Conversation

@ZayanKhan-12

Copy link
Copy Markdown

Why

tests/WaitForHelper.test.ts currently only covers dialog handling. The exported pure function getNetworkMultiplierFromString (src/WaitForHelper.ts) had no coverage at all, and the navigation/timeout paths of waitForEventsAfterAction were untested. This PR expands the test file to lock in the current behavior of those paths. No src/ changes.

Coverage added

  • getNetworkMultiplierFromString: exact multipliers for each predefined condition (Fast 4G → 1, Slow 4G → 2.5, Fast 3G → 5, Slow 3G → 10), fallback to 1 for unknown strings and for null.
  • Cross-document navigation: an action that navigates resolves with navigatedToUrl set to the destination.
  • No navigation: resolves quickly (bounded well below #stableDomTimeout) with no navigatedToUrl.
  • Navigation timeout: a navigation that starts but never completes has its timeout error swallowed (logged, not thrown) and still resolves with a result; the URL stays unchanged so no navigatedToUrl is reported.
  • Same-document hash navigation: skips the full navigation wait but is still surfaced via the before/after URL comparison.
  • Action errors are rethrown to the caller.

Observation (current behavior, asserted as-is)

When a started navigation times out and remains pending, the subsequent stable-DOM wait cannot settle (in-page evaluations do not complete while the navigation is pending), so it consumes the full #stableDomTimeout. With {timeout: 500} the call still takes ~3.5s total (500ms navigation timeout + 3s stable-DOM timeout). The test documents this rather than changing it.

Note: this is independent of the open PR #2504 (popup tracking in WaitForHelper); it only touches network-multiplier and navigation/timeout behavior, so the two do not conflict.

Testing

  • node scripts/test.js tests/WaitForHelper.test.ts — 11/11 pass (run 3x to check for flakes)
  • npm run test:no-build — full suite green
  • npm run check-format — clean

🤖 Generated with Claude Code

@google-cla

google-cla Bot commented Aug 8, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ZayanKhan-12
ZayanKhan-12 force-pushed the chore/tests-waitforhelper branch from c80548a to f4b792c Compare August 8, 2026 21:46
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.

2 participants