Skip to content
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

[Housekeeping] Added UI Test to validate project template #18567

Merged
merged 22 commits into from
Jun 21, 2024
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.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ public Issue19509(TestDevice device) : base(device)

[Test]
[FailsOnMac("VerifyScreenshot method not implemented on macOS")]
public async Task EntryTextColorStopsWorkingAfterPropertyIsUpdatedFromBinding()
public void EntryTextColorStopsWorkingAfterPropertyIsUpdatedFromBinding()
{
App.WaitForElement("WaitForStubControl");

// 1. Click a button to update the text
App.Tap("button");

await Task.Yield();

// 2. Verify that the Entry TextColor is correct (Green).
VerifyScreenshot();
Expand Down
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.
31 changes: 31 additions & 0 deletions src/Controls/tests/TestCases/Issues/Issues17801.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue17801">
<ScrollView>
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">
<Image
Source="dotnet_bot.png"
HeightRequest="200"
HorizontalOptions="Center" />
<Label
AutomationId="WaitForStubControl"
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
<Label
Text="Welcome to .NET Multi-platform App UI"
FontSize="18"
HorizontalOptions="Center" />
<Button
x:Name="CounterBtn"
Text="Click me"
Clicked="OnCounterClicked"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ScrollView>
</ContentPage>
28 changes: 28 additions & 0 deletions src/Controls/tests/TestCases/Issues/Issues17801.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 17801, "ScrollView always has a scroll bar on iOS", PlatformAffected.iOS)]
public partial class Issue17801 : ContentPage
{
int _count = 0;

public Issue17801()
{
InitializeComponent();
}

void OnCounterClicked(object sender, EventArgs e)
{
_count++;

if (_count == 1)
CounterBtn.Text = $"Clicked {_count} time";
else
CounterBtn.Text = $"Clicked {_count} times";
}
}
}
23 changes: 23 additions & 0 deletions src/Controls/tests/UITests/Tests/Issues/Issue17801.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.AppiumTests.Issues
{
public class Issue17801 : _IssuesUITest
{
public Issue17801(TestDevice device) : base(device) { }

public override string Issue => "ScrollView always has a scroll bar on iOS";

[Test]
public void NoScrollbarsTest()
{
App.WaitForElement("WaitForStubControl");

// We verify the reference snapshot where the ScrollView should
// NOT display scrollbars as are not necessary.
VerifyScreenshot();
}
}
}
Loading