Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Drawing;
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
using OpenQA.Selenium.Interactions;
using NUnit.Framework.Legacy;

namespace Microsoft.Maui.TestCases.Tests.Issues;
public class Issue19955: _IssuesUITest
{
public Issue19955(TestDevice device) : base(device) { }

public override string Issue => "Navigating Back to FlyoutPage Renders Blank Page";

[Test]
[Category(UITestCategories.FlyoutPage)]
public void NavigatingBackToFlyoutPageRendersBlankPage()
{
App.WaitForElement("NavigateToSecondPageButton");
App.Tap("NavigateToSecondPageButton");
App.WaitForElement("NavigateBackToFirstPageButton");
App.Tap("NavigateBackToFirstPageButton");
App.WaitForElement("NavigateToSecondPageButton");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does WaitForElement test for visibility?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It looks like if the opacity is zero then appium can't find it.

I was curious about this as well :-)
If I remove my fix, the test fails, if I put the fix back, the test passes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the element is not visible on the screen, appium can't find it. So, it's valid. Just could be nice to include a comment here.

}
}
91 changes: 91 additions & 0 deletions src/Controls/tests/TestCases/Issues/Issue19955.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.Diagnostics;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample.Issues
{
[Issue(IssueTracker.Github, 19955, "Navigating Back to FlyoutPage Renders Blank Page")]
public class Issue19955 : NavigationPage
{
public Issue19955() : base(new MainFlyout())
{

}

public partial class MainFlyout : FlyoutPage
{
public MainFlyout()
{
Flyout = new MainFlyoutMenu();
Detail = new MarkerNavigationPage();
}

class MarkerNavigationPage : NavigationPage
{
public MarkerNavigationPage() : base(new FirstPage())
{
}
}

class MarkerNavigationPage2 : NavigationPage
{
public MarkerNavigationPage2() : base(new FirstPage())
{
}
}
}

public partial class MainFlyoutMenu : ContentPage
{
public MainFlyoutMenu()
{
Title = "MainFlyoutMenu";
Content = new VerticalStackLayout(){
new Label()
{
Text = "I'm the Flyout Page"
}
};
}
}

public partial class FirstPage : ContentPage
{
public FirstPage()
{
Content = new VerticalStackLayout(){
new Button(){
Text = "Navigate to Second page",
Command = new Command(Button_Clicked),
AutomationId = "NavigateToSecondPageButton"
},
};
}

async void Button_Clicked()
{
await Application.Current.MainPage.Navigation.PushAsync(new SecondPage());
}
}

public partial class SecondPage : ContentPage
{
public SecondPage()
{
Content = new VerticalStackLayout()
{
new Button(){
Text = "Navigate back to first page",
Command = new Command(Button_Clicked),
AutomationId = "NavigateBackToFirstPageButton"
}
};
}

async void Button_Clicked()
{
await Application.Current.MainPage.Navigation.PopAsync();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public override AView OnCreateView(LayoutInflater inflater, ViewGroup? container
.CurrentPage
.ToPlatform(NavigationManager.MauiContext, RequireContext(), inflater, ChildFragmentManager);

// This shouldn't typically happen, but if a previous animation hasn't finished from a navigation that was interrupted
// the opacity of the view will be set to 0. This will reset it to 1.
NavigationManager.CurrentPage?.Handler?.UpdateValue(nameof(IView.Opacity));
Comment thread
PureWeen marked this conversation as resolved.

_currentView.RemoveFromParent();

return _currentView;
Expand Down