Skip to content
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

Fix Disabling some image tests after updating net9.0 with main #25770

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

devanathan-vaithiyanathan
Copy link
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Nov 11, 2024

Description of Change

After merging the net9 branch into main, two UI tests were failing:
1. Android Test: ImageDoesntDisappearWhenNavigatingBack

  • After merging the net9 branch into main, this test began passing successfully without additional modifications.

2. Windows Test: Issue31366PushingWithModalStackCausesIncorrectStackOrder

  • To resolve this test, I made adjustments in the HostApp sample, which contains two buttons. Initially, after clicking the first button, the sample displayed an empty white screen, blocking access to the second button. This issue caused the test to fail with a WaitForElement exception, as the second button was not visible.
  • I added a delay, ensuring the second button becomes visible and clickable, which resolved the issue and allowed the test to pass as expected.

Issues Fixed

Fixes #24243

Output Screenshot

Android:
Android-Test-pass-Status

Windows
Windows-pass-status

Copy link
Contributor

Hey there @devanathan-vaithiyanathan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 11, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@mattleibow mattleibow added the area-testing Unit tests, device tests label Nov 11, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@devanathan-vaithiyanathan devanathan-vaithiyanathan marked this pull request as ready for review November 15, 2024 15:14
@devanathan-vaithiyanathan devanathan-vaithiyanathan requested a review from a team as a code owner November 15, 2024 15:14
@rmarinho
Copy link
Member

/rebase

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

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

I added a delay, ensuring the second button becomes visible and clickable, which resolved the issue and allowed the test to pass as expected.

Can we add a WaitForElement on the second button opposed to just adding delays?

@@ -32,7 +32,7 @@ public MainPage()

popOnAppearing.Appearing += async (sender, args) =>
{
await Task.Yield();
await Task.Delay(50);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could just include a View, like a Label, and wait for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the test case host app, a new page is being pushed and then immediately popped on the page's Appearing event. As a result, the page's UI does not load, making it impossible to validate views like labels. Here, added a slight delay before popping the page in the Appearing event to avoid exception.

Copy link
Member

Choose a reason for hiding this comment

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

What was the exception? Adding a delay to fix the issue may mean something else went wrong.

@PureWeen PureWeen dismissed their stale review November 27, 2024 04:01

Comments addressed

@sheiksyedm sheiksyedm added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 6, 2024
@PureWeen PureWeen added this to the .NET 9 SR4 milestone Jan 5, 2025
@PureWeen
Copy link
Member

PureWeen commented Jan 6, 2025

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@@ -32,7 +32,7 @@ public MainPage()

popOnAppearing.Appearing += async (sender, args) =>
{
await Task.Yield();
await Task.Delay(50);
Copy link
Member

Choose a reason for hiding this comment

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

Could we wire into an event on the page we're popping back to and add a label?

like

  • push
  • pop from appearing
  • and then incremented a counter or inside "OnNavigatedTo" we could add a label indicating it was popped back to?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cause of the issue is performing the pop in the Page.Appearing event. As an alternative, I tried this approach:
image
This checks the Modal stack before popping, similar to a push-then-pop pattern. Can we proceed with this approach?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be a different test case? If there is a problem popping from Appearing, do we want to fix that of just say "don't do that"?

We can still use your idea of a label update because the NavigatedTo will fire again on the first/initial page? When you pop the new page, we can increment the counter.

Copy link
Member

Choose a reason for hiding this comment

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

Also, if this is because of animations, then we will have to document that you can't pop in Appearing while pushing.

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

Adding a delay might be changing the test here. It seems that the test may have been testing the logic of popping in the Appearing? So, we may have to see if that is the main issue and maui has a bug.

Or, maybe this is not a supported operation? We can only pop in some Appeared and/or NavigatedTo. Either way, this is either a bug in maui or just a case of the Windows limitations and we need to document that it is not supported.

I assume it was working until @PureWeen fixed some navigation issue and events. Since we like those changes, we should see if there needs to be some fine tuning or indicate that removing a page while it is still coming in is not really supported.

Or we can rather queue the navigation operation until the page is settled?

@@ -32,7 +32,7 @@ public MainPage()

popOnAppearing.Appearing += async (sender, args) =>
{
await Task.Yield();
await Task.Delay(50);
Copy link
Member

Choose a reason for hiding this comment

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

What was the exception? Adding a delay to fix the issue may mean something else went wrong.

@@ -32,7 +32,7 @@ public MainPage()

popOnAppearing.Appearing += async (sender, args) =>
{
await Task.Yield();
await Task.Delay(50);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be a different test case? If there is a problem popping from Appearing, do we want to fix that of just say "don't do that"?

We can still use your idea of a label update because the NavigatedTo will fire again on the first/initial page? When you pop the new page, we can increment the counter.

@@ -32,7 +32,7 @@ public MainPage()

popOnAppearing.Appearing += async (sender, args) =>
{
await Task.Yield();
await Task.Delay(50);
Copy link
Member

Choose a reason for hiding this comment

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

Also, if this is because of animations, then we will have to document that you can't pop in Appearing while pushing.

@mattleibow
Copy link
Member

@devanathan-vaithiyanathan if the Windows test is going to take some time, maybe just move the Android fix into a new PR and we can approve faster and then this PR can become a long discussion on the Appearings.

@devanathan-vaithiyanathan
Copy link
Contributor Author

@devanathan-vaithiyanathan if the Windows test is going to take some time, maybe just move the Android fix into a new PR and we can approve faster and then this PR can become a long discussion on the Appearings.

The android fix has been added in the PR and it has been merged.

@PureWeen PureWeen modified the milestones: .NET 9 SR4, .NET 9 SR5 Jan 23, 2025
@PureWeen
Copy link
Member

Adding a delay might be changing the test here. It seems that the test may have been testing the logic of popping in the Appearing? So, we may have to see if that is the main issue and maui has a bug.

Or, maybe this is not a supported operation? We can only pop in some Appeared and/or NavigatedTo. Either way, this is either a bug in maui or just a case of the Windows limitations and we need to document that it is not supported.

I assume it was working until @PureWeen fixed some navigation issue and events. Since we like those changes, we should see if there needs to be some fine tuning or indicate that removing a page while it is still coming in is not really supported.

Or we can rather queue the navigation operation until the page is settled?

Agreed, the original test is a little interesting because it always had the yield it seems
https://github.com/xamarin/Xamarin.Forms/blob/2f8f4864a4d289dc89a6228e2ca9d6a49993e365/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31366.cs#L42

so it was never really testing doing the operation from "Appearing" correctly

But we really shouldn't modify the hostapp to make a test pass in this way

@devanathan-vaithiyanathan
Copy link
Contributor Author

Adding a delay might be changing the test here. It seems that the test may have been testing the logic of popping in the Appearing? So, we may have to see if that is the main issue and maui has a bug.
Or, maybe this is not a supported operation? We can only pop in some Appeared and/or NavigatedTo. Either way, this is either a bug in maui or just a case of the Windows limitations and we need to document that it is not supported.
I assume it was working until @PureWeen fixed some navigation issue and events. Since we like those changes, we should see if there needs to be some fine tuning or indicate that removing a page while it is still coming in is not really supported.
Or we can rather queue the navigation operation until the page is settled?

Agreed, the original test is a little interesting because it always had the yield it seems https://github.com/xamarin/Xamarin.Forms/blob/2f8f4864a4d289dc89a6228e2ca9d6a49993e365/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31366.cs#L42

so it was never really testing doing the operation from "Appearing" correctly

But we really shouldn't modify the hostapp to make a test pass in this way

@PureWeen When using Task.Yield, the page does not pop properly during the appearing event, and a blank screen appears. We have logged a separate issue report for this. Shall we proceed by moving this test case with Task.Delay as a temporary fix, or should we close this PR and move the test case once the reported issue is resolved?

@PureWeen
Copy link
Member

PureWeen commented Feb 3, 2025

@PureWeen When using Task.Yield, the page does not pop properly during the appearing event, and a blank screen appears. We have logged a separate issue report for this. Shall we proceed by moving this test case with Task.Delay as a temporary fix, or should we close this PR and move the test case once the reported issue is resolved?

Yea, I don't think adding Bugzilla31366 with the awaits provides any value.
So let's just wait to add that one

@PureWeen PureWeen modified the milestones: .NET 9 SR5, .NET 9 SR4 Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-testing Unit tests, device tests community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration
Projects
Status: Changes Requested
Development

Successfully merging this pull request may close these issues.

Disabling some image tests after updating net9.0 with main
6 participants