Skip to content

[Testing] Fixed Test case failure in PR 30115 - [2025/06/23] Candidate #30136

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Contributor

Choose a reason for hiding this comment

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

This snapshot is pending in some platforms. Example, Mac:
image
But based on the snapshot, seems the test is failing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Differences on Android:
Snapshot different than baseline: ScrollViewGradientBackground.png (7.19% difference)
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Failing on Windows:

   at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2460
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2477
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 681
   at Microsoft.Maui.TestCases.Tests.Issues.Issue24061.ScrollViewGradientBackgroundShouldWorkWithScrollView() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue24061.cs:line 19
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Copy link
Contributor

Choose a reason for hiding this comment

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

@kubaflo , The newly added test cases from the candidate branch (456e29c) were causing increased flakiness and failures on Windows. I have redefined these test cases to use programmatic scrolling, significantly improving their reliability. The updated tests are passing consistently across all platforms.

For your reference, here is the commit link. a8b1031

@rmarinho , @jsuarezruiz , I have modified the above failure test cases. Can you retrigger the CI to get the Mac and Windows images for the respective tests?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 30 additions & 22 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue24061.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<VerticalStackLayout>
<ScrollView Orientation="Horizontal"
x:Name="scrollView"
HeightRequest="120">

HeightRequest="120"
HorizontalScrollBarVisibility="Never">
<ScrollView.Background>
<LinearGradientBrush StartPoint="0,0.5"
EndPoint="1,0.5">
Expand All @@ -19,29 +19,37 @@
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</ScrollView.Background>
<StackLayout Orientation="Horizontal">
<BindableLayout.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Item1</x:String>
<x:String>Item2</x:String>
<x:String>Item3</x:String>
<x:String>Item4</x:String>
<x:String>Item5</x:String>
</x:Array>
</BindableLayout.ItemsSource>
<BindableLayout.ItemTemplate>
<DataTemplate>
<BoxView WidthRequest="100"
HeightRequest="100"
AutomationId="{Binding .}"
BackgroundColor="Black"
Margin="10"/>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
<StackLayout Orientation="Horizontal">
<BindableLayout.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Item1</x:String>
<x:String>Item2</x:String>
<x:String>Item3</x:String>
<x:String>Item4</x:String>
<x:String>Item5</x:String>
<x:String>Item6</x:String>
<x:String>Item7</x:String>
<x:String>Item8</x:String>
<x:String>Item9</x:String>
<x:String>Item10</x:String>
</x:Array>
</BindableLayout.ItemsSource>
<BindableLayout.ItemTemplate>
<DataTemplate>
<BoxView WidthRequest="100"
HeightRequest="100"
AutomationId="{Binding .}"
BackgroundColor="Black"
Margin="10"/>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
</ScrollView>
<Button AutomationId="button"
Clicked="Button_Clicked"
Text="Remove/Add scroll view background"/>
<Button AutomationId="scrollButton"
Clicked="ScrollButton_Clicked"
Text="Scroll to End"/>
</VerticalStackLayout>
</ContentPage>
15 changes: 13 additions & 2 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue24061.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,21 @@ public Issue24061()

private void Button_Clicked(object sender, EventArgs e)
{
if (scrollView.Background != null)
scrollView.Background = null;
if (scrollView.Background is LinearGradientBrush)
{
// Setting background to null will not reset to color on Android, Refer: https://github.com/dotnet/maui/issues/22914
//scrollView.Background = null;
scrollView.Background = new SolidColorBrush(Colors.White);
}

else
scrollView.Background = _linearGradientBrush;
}

private async void ScrollButton_Clicked(object sender, EventArgs e)
{
// Scroll to the end of the horizontal ScrollView
await scrollView.ScrollToAsync(scrollView.ContentSize.Width, 0, false);
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public Issue10025(TestDevice device) : base(device)
[Category(UITestCategories.CollectionView)]
public void VerifySelectedItemClearsOnNullAssignment()
{
App.WaitForElement("Item1");
App.Tap("Item1");
App.WaitForElement("DescriptionLabel");
App.Tap("DescriptionLabel");
VerifyScreenshot();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,22 @@ public Issue24061(TestDevice testDevice) : base(testDevice)
[Category(UITestCategories.ScrollView)]
public void ScrollViewGradientBackgroundShouldWorkWithScrollView()
{
App.WaitForElement("Item2");
App.SwipeRightToLeft("Item2", 0.99);
Exception? exception = null;

VerifyScreenshot("ScrollViewGradientBackground");
App.WaitForElement("scrollButton");

App.Click("scrollButton");
VerifyScreenshotOrSetException(ref exception, "ScrollViewGradientBackground");
App.Click("button");
VerifyScreenshot("ScrollViewWithoutGradientBackground");
App.WaitForElement("scrollButton");
VerifyScreenshotOrSetException(ref exception, "ScrollViewWithoutGradientBackground");
App.Click("button");
VerifyScreenshot("ScrollViewGradientBackground");
App.WaitForElement("scrollButton");
VerifyScreenshotOrSetException(ref exception, "ScrollViewGradientBackground");
if (exception != null)
{
throw exception;
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading