diff --git a/testing/TestHarness/TestHarness.UITest/Ext/Navigation/Apps/Chefs/Given_Apps_Chefs.cs b/testing/TestHarness/TestHarness.UITest/Ext/Navigation/Apps/Chefs/Given_Apps_Chefs.cs index f2f96e519f..b541d80ef0 100644 --- a/testing/TestHarness/TestHarness.UITest/Ext/Navigation/Apps/Chefs/Given_Apps_Chefs.cs +++ b/testing/TestHarness/TestHarness.UITest/Ext/Navigation/Apps/Chefs/Given_Apps_Chefs.cs @@ -13,4 +13,16 @@ public async Task When_Chefs_FavoriteRecipes_RecipeDetails() App.WaitThenTap("FavoriteRecipesButton"); App.WaitThenTap("RecipeDetailsButton"); } + + [Test] + public async Task When_Chefs_WelcomePage_Wont_Navigate_Twice() + { + InitTestSection(TestSections.Apps_Chefs); + + App.WaitElement("TbInstanceCountProperty"); + + var intanceCount = App.GetText("TbInstanceCountProperty"); + + Assert.AreEqual("1", intanceCount); + } } diff --git a/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsHostInit.cs b/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsHostInit.cs index 7f4a725781..c42f3956eb 100644 --- a/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsHostInit.cs +++ b/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsHostInit.cs @@ -4,6 +4,16 @@ namespace TestHarness.Ext.Navigation.Apps.Chefs; public partial class ChefsHostInit : BaseHostInitialization { + protected override string[] ConfigurationFiles => new string[] { "TestHarness.Ext.Navigation.Apps.Chefs.appsettings.chefs.json" }; + + public ChefsHostInit() + { + if (ApplicationData.Current.LocalSettings.Values.TryGetValue(Constants.ChefsWelcomeInstanceCountKey, out var value)) + { + ApplicationData.Current.LocalSettings.Values[Constants.ChefsWelcomeInstanceCountKey] = 0; + } + } + protected override IHostBuilder Navigation(IHostBuilder builder) { return builder.UseNavigation(ReactiveViewModelMappings.ViewModelMappings, RegisterRoutes).UseToolkitNavigation(); @@ -37,7 +47,7 @@ protected override void RegisterRoutes(IViewRegistry views, IRouteRegistry route new RouteMap("", View: views.FindByViewModel(), Nested: new RouteMap[] { - new RouteMap("ChefsWelcome", View: views.FindByViewModel()), + new RouteMap("ChefsWelcome", View: views.FindByViewModel(), IsDefault: true), new RouteMap("ChefsLogin", View: views.FindByViewModel()), new RouteMap("ChefsRoot", View: views.FindByViewModel(), Nested: new RouteMap[] { @@ -96,5 +106,3 @@ protected override void RegisterRoutes(IViewRegistry views, IRouteRegistry route ); } } - - diff --git a/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsShellModel.cs b/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsShellModel.cs index a4e124abfc..9e98e226ef 100644 --- a/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsShellModel.cs +++ b/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsShellModel.cs @@ -7,10 +7,5 @@ internal record ChefsShellModel public ChefsShellModel(INavigator navigator) { Navigator = navigator; - - _ = Start(); } - - - public async Task Start() => await Navigator.NavigateViewModelAsync(this); } diff --git a/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsWelcomeModel.cs b/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsWelcomeModel.cs index 029347e5ab..39072a2811 100644 --- a/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsWelcomeModel.cs +++ b/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsWelcomeModel.cs @@ -2,4 +2,18 @@ public partial class ChefsWelcomeModel { + public static int InstanceCount + { + get => ApplicationData.Current.LocalSettings.Values.TryGetValue(Constants.ChefsWelcomeInstanceCountKey, out var value) + ? (int)value + : 0; + private set => ApplicationData.Current.LocalSettings.Values[Constants.ChefsWelcomeInstanceCountKey] = value; + } + + public int InstanceCountProperty { get; private set; } + + public ChefsWelcomeModel() + { + InstanceCountProperty = ++InstanceCount; + } } diff --git a/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsWelcomePage.xaml b/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsWelcomePage.xaml index ff706c497c..e714fab99f 100644 --- a/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsWelcomePage.xaml +++ b/testing/TestHarness/TestHarness/Ext/Navigation/Apps/Chefs/ChefsWelcomePage.xaml @@ -10,6 +10,8 @@ +