-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
176 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
namespace Maui.Controls.Sample; | ||
|
||
public class ScopedPage : ContentPage | ||
{ | ||
static int i = 0; | ||
public ScopedPage() | ||
{ | ||
Index = i; | ||
Content = new Label { Text = $"I'm a scoped page: {Index}" }; | ||
i++; | ||
} | ||
|
||
public int Index {get; private set;} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
namespace Maui.Controls.Sample; | ||
|
||
public class TransientPage : ContentPage | ||
{ | ||
static int i = 0; | ||
public TransientPage() | ||
{ | ||
Index = i; | ||
Content = new Label { Text = $"I'm a transient page: {Index}" }; | ||
i++; | ||
} | ||
|
||
public int Index {get; private set;} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Shell/ShellTransientTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using Microsoft.Maui.TestCases.Tests; | ||
using NUnit.Framework; | ||
using NUnit.Framework.Legacy; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
public partial class ShellTransientTests : _IssuesUITest | ||
{ | ||
public ShellTransientTests(TestDevice device) : base(device) { } | ||
|
||
public override string Issue => "Validate Basic Service Lifetime Behavior On Shell"; | ||
|
||
protected override bool ResetAfterEachTest => true; | ||
|
||
[Test] | ||
[Category(UITestCategories.Shell)] | ||
public void ValidateBasicServiceLifetimePageBehavior() | ||
{ | ||
// Navigate to Transient Page for the First time | ||
App.WaitForElement("NewPage"); | ||
|
||
// Navigate to Unregistered Page | ||
App.WaitForElement("NavigateToUnregisteredPage"); | ||
App.Tap("NavigateToUnregisteredPage"); | ||
App.WaitForElement("NewPage", "New Page Not Created For Initial Navigation to Unregistered Page"); | ||
|
||
// Navigate to Scoped Page for the First time | ||
App.WaitForElement("NavigateToScopedPage"); | ||
App.Tap("NavigateToScopedPage"); | ||
App.WaitForElement("NewPage", "New Page Not Created For Initial Navigation to Scoped Page"); | ||
|
||
// Navigate to Transient Page for the Second time | ||
App.WaitForElement("NavigateToTransientPage"); | ||
App.Tap("NavigateToTransientPage"); | ||
App.WaitForElement("NewPage", "New Page Not Created For Second Navigation To Transient Page"); | ||
|
||
// Navigate to Transient Page for the Second time | ||
App.WaitForElement("NavigateToScopedPage"); | ||
App.Tap("NavigateToScopedPage"); | ||
App.WaitForElement("OldPage", "New Page Incorrectly Created For Scoped Page"); | ||
|
||
// Navigate to Unregistered Page | ||
App.WaitForElement("NavigateToUnregisteredPage"); | ||
App.Tap("NavigateToUnregisteredPage"); | ||
App.WaitForElement("OldPage", "New Page Incorrectly Created For Unregistered Page"); | ||
} | ||
|
||
[Test] | ||
[Category(UITestCategories.Shell)] | ||
public void SwappingShellInstancesRecreatesPages() | ||
{ | ||
// Navigate to Scoped Page so we can test that it's resued in Swapped Shell | ||
App.WaitForElement("NavigateToScopedPage"); | ||
App.Tap("NavigateToScopedPage"); | ||
App.WaitForElement("NewPage", "New Page Not Created For Initial Navigation to Scoped Page"); | ||
|
||
// Verify New Page Created for Transient Page | ||
App.WaitForElement("NewPage"); | ||
App.Tap("NavigateToNewShell"); | ||
App.WaitForElement("NewPage"); | ||
|
||
// Navigate to Scoped Page on Second Shell | ||
App.WaitForElement("NavigateToScopedPage"); | ||
App.Tap("NavigateToScopedPage"); | ||
App.WaitForElement("OldPage", "New Page Incorrectly Created For Scoped Page"); | ||
} | ||
} | ||
} |