Skip to content

Fix flaky headless navigation tests - #94

Merged
maxkatz6 merged 1 commit into
mainfrom
fixes/flaky-headless-navigation-tests
Oct 12, 2026
Merged

maxkatz6 merged 1 commit into
mainfrom
fixes/flaky-headless-navigation-tests

Conversation

@maxkatz6

Copy link
Copy Markdown
Member

Tests that assert on NavigationCompleted waited a fixed 20 ms (DoDelay). The headless adapter completes navigation on the thread pool (Task.Delay(10)) and then reports it through the dispatcher, so on a busy machine it sometimes missed the window. For example, HeadlessAdapterTests.NativeWebView_NavigateToString_And_Refresh and NativeWebViewTests.Should_NavigateToString_If_Called_Before_Window_Show both failed this way.

  • Added HeadlessTestsBase.WaitFor(condition, timeout), which pumps the dispatcher until the condition holds, or up to 5 s.
  • The navigation-completion tests use it instead of DoDelay.
  • Re-enabled NativeWebView_NavigateToString_With_BaseUri, which was skipped as flaky for the same reason.

🤖 Generated with Claude Code

…delay

The headless adapter completes navigation on the thread pool and reports it
back through the dispatcher, so the fixed 20 ms DoDelay was not always enough.
Tests that assert on NavigationCompleted now pump the dispatcher until it
fires, with a timeout. This also re-enables
NativeWebView_NavigateToString_With_BaseUri, which was skipped as flaky for
the same reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@maxkatz6
maxkatz6 merged commit c401087 into main Oct 12, 2026
3 checks passed
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