Skip to content

Test fixes #54825

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 4 commits into from
Mar 28, 2024
Merged

Test fixes #54825

merged 4 commits into from
Mar 28, 2024

Conversation

SteveSandersonMS
Copy link
Member

@SteveSandersonMS SteveSandersonMS commented Mar 28, 2024

These changes should fix the tests quarantined in #54757 and #54754

About our WebView E2E tests and Photino

We still have no clear understanding of why the Photino tests sometimes fail in CI. The change I've made here, updating the Photino dependency to 2.5.2, might help but I have no evidence that it will.

Overall my opinion about the Photino tests is that we don't know at all that our tests' way of integrating with Photino is really valid. We've built on Photino.NET and not Photino.Blazor because our goal is to prove that WebViewManager etc actually works, so we don't want to build on the 3rd-party logic in Photino.Blazor that itself uses WebViewManager. However, our repo's PhotinoWebViewManager differs subtly from the on in Photino.Blazor, in that their SendMessage works using a simple message pump to serialize the calls, whereas ours does not. I don't know if this is the root cause of our instability, but I don't really think it is, because whatever the problem is I can't repro it locally with or without that change. So it seems more likely that there's a different issue when running in CI. From the captured logs, it seems that in CI, sometimes the Photino window just closes immediately without reporting any errors.

I also notice that our Microsoft.AspNetCore.Components.WebView.Photino BlazorWebView class is not even disposable, which means the PhotinoWebViewManager can never get disposed, and hence the underlying WebViewManager can never get disposed. That can't be right (not that it should affect the test). I tried changing all this so disposal was threaded through all these references, but this leads to deadlock since our test app's Program.Main can't be async (it breaks Photino completely - it just opens a blank window and is unable to put a WebView2 inside it for some reason), and we can't block on the DisposeAsync call either - that deadlocks.

So altogether I'm unconvinced that our test-only Photino integration is really valid. It's possible that if someone was to dig into the real end-to-end going right through Photino's unmanaged code, they would find that we are doing something wrong, but that's not something we're likely to do in reality. If we can't make the E2E test reliable, I'd be more inclined to either:

  • Replace our Microsoft.AspNetCore.Components.WebView.Photino with Photino.Blazor
  • Or if that still isn't reliable, come up with a completely different kind of E2E test for WebView that doesn't involve Photino

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Mar 28, 2024
@SteveSandersonMS SteveSandersonMS marked this pull request as ready for review March 28, 2024 14:27
@SteveSandersonMS SteveSandersonMS requested review from a team and wtgodbe as code owners March 28, 2024 14:27
@@ -1492,7 +1492,7 @@ public void EnhancedFormThatCallsNavigationManagerRefreshDoesNotPushHistoryEntry
[QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/54757")]
public void EnhancedFormThatCallsNavigationManagerRefreshDoesNotPushHistoryEntry_Streaming()
{
GoTo("about:blank");
Navigate("about:blank");
Copy link
Member Author

Choose a reason for hiding this comment

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

GoTo was producing wrong results because only accepts relative URLs. Navigate works with about:blank.

{
// Make the tests run faster by navigating back to the home page when we are done
// If we don't, then the next test will reload the whole page before it starts
Browser.Exists(By.LinkText("Home")).Click();
Copy link
Member

Choose a reason for hiding this comment

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

Does this no longer help?

Copy link
Member Author

Choose a reason for hiding this comment

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

In the multithreading case, this happens too late and was trying to reach the DOM after the page is gone. Fortunately we just don't even need this optimization - it's fine to reload the page between tests, and makes them more isolated/robust anyway.

{
// Make the tests run faster by navigating back to the home page when we are done
// If we don't, then the next test will reload the whole page before it starts
Browser.Exists(By.LinkText("Home")).Click();
Copy link
Member Author

Choose a reason for hiding this comment

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

In the multithreading case, this happens too late and was trying to reach the DOM after the page is gone. Fortunately we just don't even need this optimization.

@SteveSandersonMS SteveSandersonMS merged commit 0cc2cf0 into main Mar 28, 2024
26 checks passed
@SteveSandersonMS SteveSandersonMS deleted the stevesa/test-fixes branch March 28, 2024 16:29
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-preview4 milestone Mar 28, 2024
@wtgodbe
Copy link
Member

wtgodbe commented Apr 2, 2024

/backport to release/8.0

Copy link
Contributor

github-actions bot commented Apr 2, 2024

Started backporting to release/8.0: https://github.com/dotnet/aspnetcore/actions/runs/8529478420

Copy link
Contributor

github-actions bot commented Apr 2, 2024

@wtgodbe backporting to release/8.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Don't try to interact with DOM after threaded app shutdown
Using index info to reconstruct a base tree...
A	src/Components/test/E2ETest/Tests/ThreadingAppHostedTest.cs
A	src/Components/test/E2ETest/Tests/ThreadingAppTest.cs
Falling back to patching base and 3-way merge...
CONFLICT (modify/delete): src/Components/test/E2ETest/Tests/ThreadingAppHostedTest.cs deleted in HEAD and modified in Don't try to interact with DOM after threaded app shutdown. Version Don't try to interact with DOM after threaded app shutdown of src/Components/test/E2ETest/Tests/ThreadingAppHostedTest.cs left in tree.
Auto-merging src/Components/test/E2ETest/Tests/StandaloneAppTest.cs
CONFLICT (content): Merge conflict in src/Components/test/E2ETest/Tests/StandaloneAppTest.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Don't try to interact with DOM after threaded app shutdown
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

github-actions bot commented Apr 2, 2024

@wtgodbe an error occurred while backporting to release/8.0, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

MackinnonBuck pushed a commit that referenced this pull request Apr 2, 2024
wtgodbe pushed a commit that referenced this pull request Apr 3, 2024
* Test fixes (#54825)

* Add license header

---------

Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com>
amcasey added a commit to amcasey/aspnetcore that referenced this pull request Aug 16, 2024
MackinnonBuck pushed a commit that referenced this pull request Aug 28, 2024
…HistoryEntry (#57376)

It's been passing for 30 days since #54825.

Fixes #54757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants