Skip to content

Commit 5a11e19

Browse files
TamilarasanSF4853PureWeen
authored andcommitted
[Testing] Re-Enabled UI Test - Issue10222Test (#29226)
* enabled the test case for android * added comment
1 parent 5c15622 commit 5a11e19

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public MainPage()
2727
class CarouselViewTestPage : ContentPage
2828
{
2929
CollectionView cv;
30+
List<string> items;
3031
public CarouselViewTestPage()
3132
{
3233
cv = new CollectionView
@@ -42,25 +43,25 @@ public CarouselViewTestPage()
4243
};
4344
label.SetBinding(Label.TextProperty, new Binding("."));
4445
label.SetBinding(Label.AutomationIdProperty, new Binding("."));
46+
var tapGestureRecognizer = new TapGestureRecognizer();
47+
tapGestureRecognizer.Tapped += (sender, e) => LabelTapped();
48+
label.GestureRecognizers.Add(tapGestureRecognizer);
4549
return label;
4650
})
4751
};
48-
Content = cv;
49-
InitCV();
50-
}
5152

52-
async void InitCV()
53-
{
54-
var items = new List<string>();
53+
items = new List<string>();
5554
for (int i = 0; i < 10; i++)
5655
{
5756
items.Add($"items{i}");
5857
}
59-
6058
cv.ItemsSource = items;
61-
62-
//give the cv time to draw the items
63-
await Task.Delay(1000);
59+
Content = cv;
60+
}
61+
62+
// Scrolls to last item then pops the page
63+
async void LabelTapped()
64+
{
6465

6566
cv.ScrollTo(items.Count - 1);
6667

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if TEST_FAILS_ON_ANDROID // More information: https://github.com/dotnet/maui/issues/28640
21
using NUnit.Framework;
32
using UITest.Appium;
43
using UITest.Core;
@@ -18,8 +17,8 @@ public void Issue10222Test()
1817
{
1918
App.WaitForElement("goTo");
2019
App.Tap("goTo");
21-
App.WaitForElement("items1", timeout: TimeSpan.FromSeconds(1));
20+
App.WaitForElement("items1");
21+
App.Tap("items1");
2222
App.WaitForElement("goTo", timeout: TimeSpan.FromSeconds(2));
2323
}
24-
}
25-
#endif
24+
}

0 commit comments

Comments
 (0)