Skip to content

Commit

Permalink
Page.IsBusy activity idicator
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaflo committed Jul 21, 2024
1 parent 8bac7ec commit 26212c7
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void ResetBusyCount()
void OnPageBusy(IView sender, bool enabled)
{
// Verify that the page making the request is part of this activity
if (!PageIsInThisContext(sender))
if (!PageIsInThisContext(sender) && enabled)
{
return;
}
Expand Down
47 changes: 47 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue23674.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
namespace Maui.Controls.Sample.Issues
{
[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 23674, "Page.IsBusy activity indicators gets stuck/causes multiple to be displayed", PlatformAffected.Android)]
public class Issue23674 : NavigationPage
{
public Issue23674() : base(new Issue23674Page1()){ }

class Issue23674Page1 : ContentPage
{
public Issue23674Page1()
{
Content = new Button()
{
AutomationId = "button1",
VerticalOptions = LayoutOptions.Start,
Text = "Navigate to page 1",
HeightRequest = 100,
Command = new Command(async ()=>
{
await Navigation.PushAsync(new Issue23674Page2());
})
};
}
}

class Issue23674Page2 : ContentPage
{
public Issue23674Page2()
{
IsBusy = true;
Content = new Button()
{
AutomationId = "button2",
VerticalOptions = LayoutOptions.Start,
Text = "Navigate to page 2",
HeightRequest = 100,
Command = new Command(() =>
{
Navigation.PopAsync();
})
};
IsBusy = true;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue23674 : _IssuesUITest
{
public override string Issue => "Page.IsBusy activity indicators gets stuck/causes multiple to be displayed";

public Issue23674(TestDevice device) : base(device) { }

[Test]
[Category(UITestCategories.Page)]
public void Issue23674Test()
{
App.WaitForElement("button1");
App.Click("button1");
App.WaitForElement("button2");
App.Click("button2");
App.WaitForElement("button1");

// The test passes if activity indicator is not visible
VerifyScreenshot();
}
}
}

0 comments on commit 26212c7

Please sign in to comment.