Skip to content

Commit f2b4d31

Browse files
committed
[testing] Fix UITest by actually scrolling the colelctionview
1 parent 81d8b8d commit f2b4d31

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

src/Controls/samples/Controls.Sample.UITests/Issues/Issue20294.xaml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
Title="Issue 20294"
55
x:Class="Maui.Controls.Sample.Issues.Issue20294">
6-
<CollectionView
7-
SelectionMode="Single"
8-
Margin="10.0">
9-
6+
<CollectionView SelectionMode="Single" Margin="10.0" AutomationId="theCollectionView">
107
<CollectionView.ItemsSource>
118
<x:Array Type="{x:Type x:String}">
129
<x:String>ONE</x:String>
@@ -37,30 +34,23 @@
3734
<x:String>asdf</x:String>
3835
<x:String>asdf</x:String>
3936
<x:String>asdf</x:String>
40-
<x:String>asdf</x:String>
37+
<x:String>LAST</x:String>
4138
</x:Array>
4239
</CollectionView.ItemsSource>
43-
4440
<CollectionView.ItemsLayout>
4541
<LinearItemsLayout
4642
Orientation="Vertical"
4743
ItemSpacing="15"/>
4844
</CollectionView.ItemsLayout>
49-
5045
<CollectionView.Footer>
51-
<Label HeightRequest="45" Text="FOOTER" AutomationId="FOOTER"></Label>
52-
</CollectionView.Footer>
53-
46+
<Label HeightRequest="45" Text="FOOTER" AutomationId="FOOTER"/>
47+
</CollectionView.Footer>
5448
<CollectionView.ItemTemplate>
5549
<DataTemplate x:DataType="x:String">
56-
<Border AutomationId="{Binding}"
57-
StrokeThickness="0.2">
58-
<Label
59-
Text="{Binding}"
60-
FontSize="20"/>
50+
<Border AutomationId="{Binding}" StrokeThickness="0.2">
51+
<Label Text="{Binding}" FontSize="20"/>
6152
</Border>
6253
</DataTemplate>
6354
</CollectionView.ItemTemplate>
64-
6555
</CollectionView>
6656
</ContentPage>

src/Controls/tests/UITests/Tests/Issues/Issue20294.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ public Issue20294(TestDevice device) : base(device) { }
1414
[Test]
1515
public void ScrollToEndDoesntCrash()
1616
{
17-
App.ScrollDown("FOOTER");
18-
App.ScrollUp("ONE");
17+
App.ScrollTo("FOOTER");
18+
App.ScrollUp("theCollectionView", ScrollStrategy.Gesture, 0.5);
19+
App.ScrollDown("theCollectionView", ScrollStrategy.Gesture, 0.5);
20+
App.ScrollDown("theCollectionView", ScrollStrategy.Gesture, 0.5);
21+
App.ScrollUp("theCollectionView", ScrollStrategy.Gesture, 0.5);
22+
App.ScrollDown("theCollectionView", ScrollStrategy.Gesture, 0.5);
1923
}
2024
}

0 commit comments

Comments
 (0)