/// <summary> /// Wait for a page of the given type to appear on top of the navigation stack in the app /// </summary> /// <param name="app">The application</param> /// <param name="createStepWhenPageShown">[Optionnal] An explicit way to indicate if a step is automatically created if and when the awaited page is shown</param> /// <param name="timeout">[Optionnal]An explicit timeout for the wait operation.</param> public static T WaitForPage <T>(this IApp app, bool?createStepWhenPageShown = null, TimeSpan?timeout = null) where T : AppPage, new() { var page = app.GetPage <T>(); app.WaitFor(() => app.IsActivity(page.PageName), timeout: timeout); app.AfterPageShown(page, createStepWhenPageShown); return(page); }
/// <summary> /// Wait for a page with the given name to appear on top of the navigation stack in the app /// </summary> /// <param name="app">The application</param> /// <param name="activityName">The name of the activity that is awaited</param> /// <param name="comparisonType">Indicates how the provided name will be compared to the name of the top activity</param> /// <param name="createStepWhenPageShown">[Optionnal] An explicit way to indicate if a step is automatically created if and when the awaited page is shown</param> /// <param name="timeout">[Optionnal]An explicit timeout for the wait operation.</param> /// <param name="waitHandle">[Optionnal] Alows the current test to await a given element once the page is shown</param> public static void WaitForPage( this IApp app, string activityName, StringComparison comparisonType, bool?createStepWhenPageShown = null, TimeSpan?timeout = null, Action waitHandle = null) { app.WaitFor(() => app.IsActivity(activityName), timeout: timeout); app.AfterPageShown(createStepWhenPageShown, activityName, waitHandle); }
/// <summary> /// Wait for a page with a name that matches he given predicate to appear on top of the navigation stack in the app /// </summary> /// <param name="app">The application</param> /// <param name="activityPredicate">The predicate used to check if an activity corresponds to the one that is awaited, based on the activity's name</param> /// <param name="createStepWhenPageShown">[Optionnal] An explicit way to indicate if a step is automatically created if and when the awaited page is shown</param> /// <param name="timeout">[Optionnal] An explicit timeout for the wait operation.</param> /// <param name="waitHandle">[Optionnal] Alows the current test to await a given element once the page is shown</param> public static void WaitForPage(this IApp app, Func <string, bool> activityPredicate, bool?createStepWhenPageShown = null, TimeSpan?timeout = null, Action waitHandle = null) { string activityName = null; app.WaitFor( () => app.IsActivity(name => { activityName = name; return(activityPredicate(name)); }), timeout: timeout ); app.AfterPageShown(createStepWhenPageShown, activityName, waitHandle); }
internal static void AfterPageShown <T>(this IApp app, T page, bool?createStepWhenPageShown) where T : AppPage { app.AfterPageShown(createStepWhenPageShown, page.PageName, () => page.PageQueryWaitHandle()); }