Skip to content

Commit ffca324

Browse files
authored
[Testing] Fix flaky UITests failing sometimes 2 (#27154)
* Fixed Issue2354 UITest * Avoiding locale-dependent query issues * Disabled test * Ignore HeaderFooterStringWorks * Wait back button before tap it * Revert change
1 parent 4a36584 commit ffca324

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

src/Controls/tests/TestCases.HostApp/Issues/Issue2354.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ protected override void Init()
88
{
99
var presidents = new List<President>();
1010

11-
presidents.Add(new President($"Presidente 44", 1, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/Fruits.jpg?raw=true"));
12-
presidents.Add(new President($"Presidente 43", 2, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/person.png?raw=true"));
13-
presidents.Add(new President($"Presidente 42", 3, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/photo.jpg?raw=true"));
14-
presidents.Add(new President($"Presidente 41", 4, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/FlowerBuds.jpg?raw=true"));
15-
presidents.Add(new President($"Presidente 40", 5, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/games.png?raw=true"));
16-
presidents.Add(new President($"Presidente 39", 6, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/gear.png?raw=true"));
17-
presidents.Add(new President($"Presidente 38", 7, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/coffee.png?raw=true"));
18-
presidents.Add(new President($"Presidente 37", 8, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/xamarinstore.jpg?raw=true"));
19-
presidents.Add(new President($"Presidente 36", 9, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/oasis.jpg?raw=true"));
20-
presidents.Add(new President($"Presidente 35", 10, $"https://github.com/dotnet/maui/blob/main/src/Compatibility/ControlGallery/src/Android/Resources/drawable/Vegetables.jpg?raw=true"));
11+
presidents.Add(new President($"Presidente 44", 1, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/avatar.png?raw=true"));
12+
presidents.Add(new President($"Presidente 43", 2, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/oasis.jpg?raw=true"));
13+
presidents.Add(new President($"Presidente 42", 3, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/photo21314.jpg?raw=true"));
14+
presidents.Add(new President($"Presidente 41", 4, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/groceries.png?raw=true"));
15+
presidents.Add(new President($"Presidente 40", 5, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/avatar.png?raw=true"));
16+
presidents.Add(new President($"Presidente 39", 6, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/oasis.jpg?raw=true"));
17+
presidents.Add(new President($"Presidente 38", 7, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/photo21314.jpg?raw=true"));
18+
presidents.Add(new President($"Presidente 37", 8, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/groceries.png?raw=true"));
19+
presidents.Add(new President($"Presidente 36", 9, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/avatar.png?raw=true"));
20+
presidents.Add(new President($"Presidente 35", 10, $"https://github.com/dotnet/maui/blob/main/src/Controls/tests/TestCases.HostApp/Resources/Images/oasis.jpg?raw=true"));
2121

2222
var header = new Label
2323
{

src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.HeaderAndFooter.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public CollectionViewHeaderAndFooterTests(TestDevice device)
1515
{
1616
}
1717

18-
[Test]
18+
#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST // Header not rendering issue: https://github.com/dotnet/maui/issues/27177
19+
[Test]
1920
[Category(UITestCategories.CollectionView)]
2021
public void HeaderFooterStringWorks()
2122
{
@@ -28,8 +29,9 @@ public void HeaderFooterStringWorks()
2829
App.WaitForElement("Just a string as a header");
2930
App.WaitForElement("This footer is also a string");
3031
}
32+
#endif
3133

32-
[Test]
34+
[Test]
3335
[Category(UITestCategories.CollectionView)]
3436
public void HeaderFooterViewWorks()
3537
{
@@ -72,7 +74,7 @@ public void HeaderFooterGridWorks()
7274
VerifyScreenshot();
7375
}
7476

75-
#if TEST_FAILS_ON_IOS
77+
#if TEST_FAILS_ON_IOS
7678
// The screenshot that's currently generated for this test is wrong
7779
// So, we're ignoring this test due to it causing confusion when other changes
7880
// cause this test to fail.
@@ -93,7 +95,7 @@ public void HeaderFooterGridHorizontalWorks()
9395

9496
VerifyScreenshot();
9597
}
96-
#endif
98+
#endif
9799
}
98100
#endif
99-
}
101+
}

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8761.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using NUnit.Framework;
1+
#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST // Header not rendering issue: https://github.com/dotnet/maui/issues/27177
2+
using NUnit.Framework;
23
using UITest.Appium;
34
using UITest.Core;
45

@@ -23,4 +24,5 @@ public void CollectionViewHeaderTemplateAndFooterTemplateDontWork()
2324
App.WaitForElement("FooterLabel");
2425
}
2526
}
26-
}
27+
}
28+
#endif

src/TestUtils/src/UITest.Appium/HelperExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1859,7 +1859,7 @@ public static void TapBackArrow(this IApp app, string customBackButtonIdentifier
18591859
/// <param name="query">The custom IQuery for the back button.</param>
18601860
public static void TapBackArrow(this IApp app, IQuery query)
18611861
{
1862-
app.Tap(query);
1862+
app.WaitForElement(query).Tap();
18631863
}
18641864

18651865
/// <summary>

0 commit comments

Comments
 (0)