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

[Testing] moved FlyoutHeaderAdaptsToMinimumHeight to appium #24294

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,7 @@ await RunShellTest(shell =>
Assert.Contains(shellSectionGrid, (shellSection as IVisualTreeElement).GetVisualChildren());
Assert.Contains(shellContentGrid, (shellContent as IVisualTreeElement).GetVisualChildren());
});
}

[Fact]
public async Task FlyoutHeaderAdaptsToMinimumHeight()
{
await RunShellTest(shell =>
{
var layout = new VerticalStackLayout()
{
new Label() { Text = "Flyout Header" }
};

layout.MinimumHeightRequest = 30;

shell.FlyoutHeader = layout;
shell.FlyoutHeaderBehavior = FlyoutHeaderBehavior.CollapseOnScroll;
},
async (shell, handler) =>
{
await OpenFlyout(handler);
var flyoutFrame = GetFrameRelativeToFlyout(handler, shell.FlyoutHeader as IView);

await AssertionExtensions.AssertEventually(() =>
{
return Math.Abs(30 - flyoutFrame.Height) < 0.2;
}, message: $"Expected: {30}. Actual: {flyoutFrame.Height}. Diff: {Math.Abs(30 - flyoutFrame.Height)}");
});
}
}

#if !WINDOWS
[Theory]
Expand Down
14 changes: 14 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue24284.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue24284"
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues">
<ShellContent Title="Page 1">
<ContentPage>
<Border AutomationId="Border" HeightRequest="30"/>
</ContentPage>
</ShellContent>
<ShellContent Title="Page 2">
<ContentPage/>
</ShellContent>
</Shell>
23 changes: 23 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue24284.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Maui.Controls.Sample.Issues;

[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 24284, "FlyoutHeaderAdaptsToMinimumHeight", PlatformAffected.All)]
public partial class Issue24284 : Shell
{
public Issue24284()
{
InitializeComponent();
var layout = new VerticalStackLayout()
{
AutomationId = "FlyoutHeader",
BackgroundColor = Colors.Red,
Children = {
new Label() { Text = "Flyout Header" }
},
MinimumHeightRequest = 30
};
FlyoutHeader = layout;
FlyoutHeaderBehavior = FlyoutHeaderBehavior.CollapseOnScroll;
FlyoutIsPresented = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using NUnit.Framework;
using NUnit.Framework.Legacy;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue24284 : _IssuesUITest
{
public Issue24284(TestDevice testDevice) : base(testDevice){ }

public override string Issue => "FlyoutHeaderAdaptsToMinimumHeight";

[Test]
[Category(UITestCategories.Shell)]
public void FlyoutHeaderAdaptsToMinimumHeight()
{
var layout = App.WaitForElement("FlyoutHeader").GetRect();
var border = App.WaitForElement("Border").GetRect();

ClassicAssert.True(Math.Abs(border.Height - layout.Height) < 0.2);
}
}
}
Loading