Skip to content

Commit

Permalink
[Testing] Fix for flaky tests and Improve stability of screenshot com…
Browse files Browse the repository at this point in the history
…parisons tests on Catalyst (#26783)
  • Loading branch information
anandhan-rajagopal authored Dec 24, 2024
1 parent 4597776 commit 9797865
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ public void Command()
}

[Test]
[FailsOnMacWhenRunningOnXamarinUITest("This test is not working on Mac Catalyst")]
public void Padding()
{
var remote = GoToStateRemote();
Expand All @@ -171,7 +170,6 @@ public void Padding()
}

[Test]
[FailsOnMacWhenRunningOnXamarinUITest("This test is not working on Mac Catalyst")]
public void Padding_Add()
{
var remote = GoToStateRemote();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public void Source_FontImageSource()
#endif

[Test]
[FailsOnMacWhenRunningOnXamarinUITest("This test is not working on Mac Catalyst")]
public async Task IsAnimationPlaying()
{
var remote = GoToStateRemote();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public Issue3276(TestDevice testDevice) : base(testDevice)
[Category(UITestCategories.ContextActions)]
public void Issue3276Test()
{
App.WaitForElement(Second);
App.Tap(Second);
App.WaitForElement(First);
App.Tap(First);
App.WaitForElement("second 1");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ public void Issue7167Test()
// App.Print.Tree();

App.ScrollDown(ListViewId, ScrollStrategy.Auto, 0.65, 200);
App.WaitForAnyElement(["20", "40", "60", "80"]);
App.WaitForAnyElement(["15", "20", "30", "40", "60", "80"]);

// when adding additional items via a addrange and a CollectionChangedEventArgs.Action.Reset is sent
// then the listview shouldnt reset or it should not scroll to the top
App.Tap(AddRangeCommandId);

App.WaitForAnyElement(["20", "40", "60", "80"]);
App.WaitForAnyElement(["15", "20", "30", "40", "60", "80"]);
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public void PaddingWithoutSafeArea()
App.EnterText(PaddingEntry, "100");
App.WaitForElement(PaddingTest);
App.Tap(PaddingTest);
App.WaitForElement(PaddingLabel);
var somePadding = App.FindElements(PaddingLabel).Count();
var somePaddingValue = App.WaitForElement(PaddingLabel).GetRect().Y;
Assert.That(somePadding, Is.EqualTo(1));
Expand Down
3 changes: 3 additions & 0 deletions src/Controls/tests/TestCases.Shared.Tests/UITest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ byte[] TakeScreenshot()
// TODO: After take the screenshot, restore the App Window to the previous state.
App.ExitFullScreen();

// Wait a little bit to complete the system animation moving the App Window to previous state.
Thread.Sleep(500);

return screenshotPngBytes;
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public StateViewContainerRemote(IUIClientContext? testContext, string formsType)
public void TapStateButton()
{
App.Screenshot("Before state change");
App.WaitForElementTillPageNavigationSettled(StateButtonQuery);
App.Tap(StateButtonQuery);
App.Screenshot("After state change");
}
Expand Down

0 comments on commit 9797865

Please sign in to comment.