Skip to content

[Testing] Fix for flaky device test BlazorWebViewUsesStartPath on Windows #29966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ public static partial class WebViewHelpers
public static async Task WaitForWebViewReady(WebView2 wv2)
{
CoreWebView2 coreWebView2 = null;

// Ensure that the WebView2 runtime is installed and initialized and has a CoreWebView2 instance.
if (wv2?.CoreWebView2 == null)
{
string version = CoreWebView2Environment.GetAvailableBrowserVersionString(null);
if (string.IsNullOrEmpty(version))
{
throw new InvalidOperationException("WebView2 runtime is not installed.");
}
await wv2.EnsureCoreWebView2Async();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this called by the handler already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattleibow Yes, it was invoked in the handler already. However, the test failed in CI with the error 'Waited 30000ms but couldn't get CoreWebView2 to be available'. To address this, the call was added again to explicitly ensure proper initialization before the test begins, along with appropriate exception handling.

}

await Retry(() =>
{
Expand Down
Loading