public static void NavigateToGallery(this IApp app, string page, string visual) { const string goToTestButtonQuery = "* marked:'GoToTestButton'"; app.WaitForElement(q => q.Raw(goToTestButtonQuery), "Timed out waiting for Go To Test button to appear", TimeSpan.FromMinutes(2)); var text = Regex.Match(page, "'(?<text>[^']*)'").Groups["text"].Value; app.WaitForElement("SearchBar"); app.EnterText(q => q.Raw("* marked:'SearchBar'"), text); app.DismissKeyboard(); if (!String.IsNullOrWhiteSpace(visual)) { app.ActivateContextMenu($"{text}AutomationId"); app.Tap("Select Visual"); app.Tap("Material"); } else { app.Tap(q => q.Raw(goToTestButtonQuery)); } app.WaitForNoElement(o => o.Raw(goToTestButtonQuery), "Timed out waiting for Go To Test button to disappear", TimeSpan.FromMinutes(2)); }
public static void NavigateTo(this IApp app, string text, string visual) { app.WaitForElement("SearchBar"); app.ClearText(q => q.Raw("* marked:'SearchBar'")); app.EnterText(q => q.Raw("* marked:'SearchBar'"), text); app.DismissKeyboard(); if (!String.IsNullOrWhiteSpace(visual)) { app.ActivateContextMenu($"{text}AutomationId"); app.Tap("Select Visual"); app.Tap("Material"); } else { app.Tap(q => q.Raw(goToTestButtonQuery)); } app.WaitForNoElement(o => o.Raw(goToTestButtonQuery), "Timed out waiting for Go To Test button to disappear", TimeSpan.FromMinutes(1)); }