public void Bugzilla31330Test() { var screenBounds = RunningApp.Query(q => q.Raw("* index:0"))[0].Rect; var cell = RunningApp.Query(c => c.Marked("Something 1")) [0]; var cell2 = RunningApp.Query(c => c.Marked("Something 2")) [0]; #if __IOS__ RunningApp.DragCoordinates(screenBounds.Width - 10, cell.Rect.CenterY, 0, cell.Rect.CenterY); RunningApp.WaitForElement(c => c.Marked("Delete")); RunningApp.Tap(c => c.Marked("Delete")); RunningApp.WaitForElement(c => c.Marked("Something 1")); RunningApp.Tap(c => c.Marked("Something 2")); RunningApp.DragCoordinates(screenBounds.Width - 10, cell2.Rect.CenterY, 0, cell2.Rect.CenterY); RunningApp.Tap(c => c.Marked("Delete")); RunningApp.WaitForNoElement(c => c.Marked("Something 2")); #else RunningApp.TouchAndHoldCoordinates(cell.Rect.CenterX, cell.Rect.CenterY); RunningApp.WaitForElement(c => c.Marked("Delete")); RunningApp.Tap(c => c.Marked("Delete")); RunningApp.Back(); RunningApp.WaitForElement(c => c.Marked("Something 1")); RunningApp.Tap(c => c.Marked("Something 2")); RunningApp.TouchAndHoldCoordinates(cell2.Rect.CenterX, cell2.Rect.CenterY); RunningApp.Tap(c => c.Marked("Delete")); RunningApp.WaitForNoElement(c => c.Marked("Something 2")); #endif }
public void VerifyTapBubbling(string menuItem, bool frameShouldRegisterTap) { var results = RunningApp.WaitForElement(q => q.Marked(menuItem)); if (results.Length > 1) { var rect = results.First(r => r.Class.Contains("Button")).Rect; RunningApp.TapCoordinates(rect.CenterX, rect.CenterY); } else { RunningApp.Tap(q => q.Marked(menuItem)); } // Find the start label RunningApp.WaitForElement(q => q.Marked(NoTaps)); // Find the control we're testing var result = RunningApp.WaitForElement(q => q.Marked(TargetAutomationId)); var target = result.First().Rect; // Tap the control var y = target.CenterY; var x = target.CenterX; // In theory we want to tap the center of the control. But Stepper lays out differently than the other controls, // so we need to adjust for it until someone fixes it if (menuItem == "Stepper") { y = target.Y + 5; x = target.X + 5; } RunningApp.TapCoordinates(x, y); if (menuItem == nameof(DatePicker) || menuItem == nameof(TimePicker)) { // These controls show a pop-up which we have to cancel/done out of before we can continue #if __ANDROID__ var cancelButtonText = "Cancel"; RunningApp.Back(); #elif __IOS__ var cancelButtonText = "Done"; RunningApp.WaitForElement(q => q.Marked(cancelButtonText)); RunningApp.Tap(q => q.Marked(cancelButtonText)); #else var cancelButtonText = "DismissButton"; #endif } if (frameShouldRegisterTap) { RunningApp.WaitForElement(q => q.Marked(Tapped)); } else { RunningApp.WaitForElement(q => q.Marked(NoTaps)); } }
void NavigateToEndAndBack() { RunningApp.WaitForElement(q => q.Button("Push next page")); // still required on iOS RunningApp.Tap(q => q.Marked("Push next page")); RunningApp.Screenshot("Pushed first page"); RunningApp.WaitForElement(q => q.Button("Push next next page")); // still required on iOS RunningApp.Tap(q => q.Marked("Push next next page")); RunningApp.Screenshot("Pushed second page"); RunningApp.WaitForElement(q => q.Marked("You are at the end of the line")); RunningApp.Screenshot("Pushed last page"); RunningApp.Tap(q => q.Marked("Check back one")); RunningApp.WaitForElement(q => q.Marked("Pop one")); RunningApp.Back(); RunningApp.Screenshot("Navigate Back"); RunningApp.Tap(q => q.Marked("Check back two")); RunningApp.WaitForElement(q => q.Marked("Pop two")); RunningApp.Back(); RunningApp.Screenshot("Navigate Back"); RunningApp.Tap(q => q.Marked("Check back three")); RunningApp.WaitForElement(q => q.Marked("At root")); RunningApp.Screenshot("At root"); }
public void Issue4187Test() { RunningApp.WaitForElement("Text 1"); Xamarin.UITest.Queries.AppResult[] fields = RunningApp.Query(q => q.TextField()); Assert.AreEqual(7, GetPickerEditText(RunningApp).Length, "picker count"); TapOnPicker(1); Assert.IsTrue(DialogIsOpened(), "#1"); RunningApp.Tap("Text 2"); Assert.IsFalse(DialogIsOpened(), "#2"); TapOnPicker(3); Assert.IsTrue(DialogIsOpened(), "#3"); RunningApp.Tap("Text 1"); Assert.IsFalse(DialogIsOpened(), "#5"); // Carousel - first page RunningApp.Back(); RunningApp.ScrollUp(); TapOnPicker(0); Assert.IsTrue(DialogIsOpened(), "Carousel - #1"); // Red page RunningApp.SwipeRightToLeft(); Assert.IsFalse(DialogIsOpened(), "Carousel - #2"); TapOnPicker(0); Assert.IsTrue(DialogIsOpened(), "Carousel - #3"); // Blue page RunningApp.SwipeRightToLeft(); Assert.IsFalse(DialogIsOpened(), "Carousel - #4"); TapOnPicker(0); Assert.IsTrue(DialogIsOpened(), "Carousel - #5"); }
public void Issue3318Test() { RunningApp.WaitForElement(q => q.Marked("End")); RunningApp.Tap(q => q.Marked("End")); RunningApp.WaitForElement(q => q.Marked("Item 19")); RunningApp.Back(); }
public void Bugzilla58833Test() { // Item #1 should not have a tap gesture, so it should be selectable RunningApp.WaitForElement(q => q.Marked("Item #1")); RunningApp.Tap(q => q.Marked("Item #1")); RunningApp.WaitForElement(q => q.Marked(ItemSelectedSuccess)); // Item #2 should have a tap gesture RunningApp.WaitForElement(q => q.Marked("Item #2")); RunningApp.Tap(q => q.Marked("Item #2")); RunningApp.WaitForElement(q => q.Marked(TapGestureSucess)); // Both items should allow access to the context menu RunningApp.ActivateContextMenu("Item #2"); RunningApp.WaitForElement("2 Action"); #if __ANDROID__ RunningApp.Back(); #else RunningApp.Tap(q => q.Marked("Item #3")); #endif RunningApp.ActivateContextMenu("Item #1"); RunningApp.WaitForElement("1 Action"); #if __ANDROID__ RunningApp.Back(); #else RunningApp.Tap(q => q.Marked("Item #3")); #endif }
public void Bugzilla40005Test() { RunningApp.WaitForElement(q => q.Marked(PageOneLabel)); RunningApp.Tap(q => q.Marked(GoToPage2)); RunningApp.WaitForElement(q => q.Marked(PageTwoLabel)); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked(PageOneLabel)); }
public void Bugzilla36729Test() { RunningApp.WaitForElement(q => q.Marked("Click!")); RunningApp.Tap(q => q.Marked("Click!")); RunningApp.WaitForElement(q => q.Marked("listview")); RunningApp.WaitForElement(q => q.Marked("some text 35")); RunningApp.Back(); }
public void Bugzilla56710Test() { RunningApp.WaitForElement(q => q.Marked("Go to Test Page")); RunningApp.Tap(q => q.Marked("Go to Test Page")); RunningApp.WaitForElement(q => q.Marked("Item 3")); RunningApp.Back(); }
void Back() { #if __IOS__ || __WINDOWS__ RunningApp.Tap(q => q.Marked("Toggle")); #else RunningApp.Back(); #endif }
public void Bugzilla38658Test() { RunningApp.WaitForElement(q => q.Marked("btn")); RunningApp.Tap(q => q.Marked("btn")); RunningApp.SetOrientationLandscape(); RunningApp.SetOrientationPortrait(); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked("btn")); }
public void Bugzilla47923Test() { foreach (var testString in new[] { "AspectFit", "AspectFill", "Fill", "Test cell views" }) { RunningApp.WaitForElement(q => q.Marked(testString)); RunningApp.Tap(q => q.Marked(testString)); RunningApp.Back(); } }
public void Issue3275Test() { RunningApp.WaitForElement(q => q.Marked(_btnLeakId)); RunningApp.Tap(q => q.Marked(_btnLeakId)); RunningApp.WaitForElement(q => q.Marked(_btnScrollToId)); RunningApp.Tap(q => q.Marked(_btnScrollToId)); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked(_btnLeakId)); }
public void TimePickerCancelShouldUnfocus() { RunningApp.Tap(q => q.Marked(TimePicker)); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked("Click to focus TimePicker")); RunningApp.Tap(q => q.Marked("Click to focus TimePicker")); RunningApp.Back(); }
public void Bugzilla60563Test() { RunningApp.WaitForElement(q => q.Marked(btnGoToList)); RunningApp.Tap(q => q.Marked(btnGoToList)); RunningApp.WaitForElement(q => q.Marked(spinner)); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked(btnGoToList)); RunningApp.Tap(q => q.Marked(btnGoToList)); RunningApp.WaitForElement(q => q.Marked(spinner)); }
public void Bugzilla30353Test() { var dontRun = RunningApp.Query(q => q.Marked("Don't run")); if (dontRun.Length > 0) { return; } RunningApp.SetOrientationPortrait(); RunningApp.Screenshot("Portrait"); RunningApp.Tap(q => q.Marked("Toggle")); RunningApp.Screenshot("Portrait Visible"); RunningApp.WaitForElement(q => q.Marked("The Master is now visible")); if (RunningApp is iOSApp) { RunningApp.Tap(q => q.Marked("Toggle")); } else { RunningApp.Back(); } RunningApp.Screenshot("Portrait Invisible"); RunningApp.WaitForElement(q => q.Marked("The Master is now invisible")); RunningApp.SetOrientationLandscape(); RunningApp.Screenshot("Landscape Invisible"); RunningApp.WaitForElement(q => q.Marked("The Master is now invisible")); RunningApp.Tap(q => q.Marked("Toggle")); RunningApp.Screenshot("Landscape Visible"); RunningApp.WaitForElement(q => q.Marked("The Master is now visible")); if (RunningApp is iOSApp) { RunningApp.Tap(q => q.Marked("Toggle")); } else { RunningApp.Back(); } RunningApp.Screenshot("Landscape InVisible"); RunningApp.WaitForElement(q => q.Marked("The Master is now invisible")); RunningApp.SetOrientationPortrait(); RunningApp.Tap(q => q.Marked("Toggle")); RunningApp.Screenshot("Portrait Visible"); RunningApp.WaitForElement(q => q.Marked("The Master is now visible")); if (RunningApp is iOSApp) { RunningApp.Tap(q => q.Marked("Toggle")); } else { RunningApp.Back(); } RunningApp.Screenshot("Portrait Invisible"); RunningApp.WaitForElement(q => q.Marked("The Master is now invisible")); RunningApp.SetOrientationLandscape(); }
public void Issue899TestsAppCrashWhenSwitchingTabs() { RunningApp.Tap(q => q.Marked("Push new page")); RunningApp.WaitForElement(q => q.Marked("I have been pushed")); RunningApp.Screenshot("Push page"); RunningApp.Back(); RunningApp.Screenshot("Navigate back"); RunningApp.Tap(q => q.Marked("Tab 2 Title")); RunningApp.Screenshot("Go to second tab"); }
public async Task Issue59172Test() { RunningApp.Tap(q => q.Marked("GoForward")); RunningApp.Tap(q => q.Marked("GoBackDelayed")); RunningApp.Back(); await Task.Delay(1000); // App should not have crashed RunningApp.WaitForElement(q => q.Marked("GoForward")); }
public void PagesAreCollected() { RunningApp.WaitForElement(q => q.Marked("Open")); RunningApp.Tap(q => q.Marked("Open")); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked("Open")); RunningApp.Tap(q => q.Marked("Open")); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked("Open")); RunningApp.Tap(q => q.Marked("Open")); RunningApp.WaitForElement(q => q.Marked("Success")); }
public void Issue1Test() { RunningApp.WaitForElement(q => q.Marked("Open")); RunningApp.Tap(q => q.Marked("Open")); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked("Open")); RunningApp.Tap(q => q.Marked("Open")); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked("Open")); RunningApp.Tap(q => q.Marked("Open")); RunningApp.WaitForElement(q => q.Marked("Success")); }
public void Issue45926Test() { RunningApp.WaitForElement(q => q.Marked("New Page")); RunningApp.Tap(q => q.Marked("New Page")); RunningApp.Back(); RunningApp.Tap(q => q.Marked("Do GC")); RunningApp.Tap(q => q.Marked("Send Message")); RunningApp.Tap(q => q.Marked("Do GC")); RunningApp.WaitForElement(q => q.Marked("Instances: 0")); RunningApp.WaitForElement(q => q.Marked("Messages: 0")); }
public async Task Issue59172RecoveryTest() { RunningApp.Tap(q => q.Marked("GoForward")); RunningApp.Tap(q => q.Marked("GoBackDelayedSafe")); RunningApp.Back(); await Task.Delay(1000); RunningApp.Tap(q => q.Marked("GoForward")); // App should navigate RunningApp.WaitForElement(q => q.Marked("GoBackDelayedSafe")); }
public void Issue51503Test() { for (int i = 0; i < 3; i++) { RunningApp.WaitForElement(q => q.Marked("Button")); RunningApp.Tap(q => q.Marked("Button")); RunningApp.WaitForElement(q => q.Marked("VisualElement")); RunningApp.Back(); } }
public void Issue4341Test() { RunningApp.WaitForElement(c => c.Marked("Email")); RunningApp.ActivateContextMenu("Subject Line 0"); RunningApp.WaitForElement("Delete"); RunningApp.Tap("Delete"); RunningApp.ActivateContextMenu("Subject Line 1"); RunningApp.Tap("Delete"); RunningApp.WaitForElement(c => c.Marked(Success)); RunningApp.Back(); RunningApp.WaitForElement(c => c.Marked("Email")); RunningApp.SwipeRightToLeft(); }
public void DatePickerCancelShouldUnfocus() { RunningApp.Tap(q => q.Marked(DatePicker)); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked("Click to view focus state")); RunningApp.Tap(q => q.Marked("Click to view focus state")); RunningApp.WaitForElement(q => q.Marked("unfocused")); RunningApp.Tap(q => q.Marked("Click to focus DatePicker")); RunningApp.Back(); RunningApp.WaitForElement(q => q.Marked("Click to view focus state")); RunningApp.Tap(q => q.Marked("Click to view focus state")); RunningApp.WaitForElement(q => q.Marked("unfocused")); }
public async Task Bugzilla39489Test() { // Original bug report (https://bugzilla.xamarin.com/show_bug.cgi?id=39489) had a crash (OOM) after 25-30 // page loads. Obviously it's going to depend heavily on the device and amount of available memory, but // if this starts failing before 50 we'll know we've sprung another serious leak int iterations = 50; for (int n = 0; n < iterations; n++) { RunningApp.WaitForElement(q => q.Marked("New Page")); RunningApp.Tap(q => q.Marked("New Page")); RunningApp.WaitForElement(q => q.Marked("New Page")); await Task.Delay(1000); RunningApp.Back(); } }
public void OpeningPickerPressingBackButtonTwiceShouldNotOpenPickerAgain() { RunningApp.WaitForElement(PickerId); RunningApp.Tap(PickerId); RunningApp.WaitForElement(FirstPickerItem); RunningApp.Back(); RunningApp.WaitForNoElement(FirstPickerItem); RunningApp.Back(); RunningApp.WaitForNoElement(FirstPickerItem, "Picker is again visible after second back button press", TimeSpan.FromSeconds(10)); RunningApp.Screenshot("Back at the previous page, not showing the picker again"); }
bool DialogIsOpened() { RunningApp.WaitForElement(q => q.Class("FrameLayout")); var frameLayouts = RunningApp.Query(q => q.Class("FrameLayout")); foreach (var layout in frameLayouts) { if (layout.Rect.X > 0 && layout.Rect.Y > 0 && layout.Description.Contains(@"id/content")) { // close dialog RunningApp.Back(); Thread.Sleep(1500); return(true); } } return(false); }
public void Bugzilla29257Test() { RunningApp.Tap(q => q.Marked("Page 1")); RunningApp.WaitForElement(q => q.Marked("This is page 1")); RunningApp.Back(); RunningApp.Tap(q => q.Marked("Page 2")); RunningApp.WaitForElement(q => q.Marked("This is page 2")); RunningApp.Back(); RunningApp.Tap(q => q.Marked("Page 3")); RunningApp.WaitForElement(q => q.Marked("This is page 3")); RunningApp.Back(); RunningApp.Tap(q => q.Marked("Page 4")); RunningApp.WaitForElement(q => q.Marked("This is page 4")); RunningApp.Back(); RunningApp.Tap(q => q.Marked("Page 5")); RunningApp.WaitForElement(q => q.Marked("This is page 5")); }
public void Bugzilla1023Test() { for (var n = 0; n < 10; n++) { RunningApp.WaitForElement(q => q.Marked("Push")); RunningApp.Tap(q => q.Marked("Push")); RunningApp.WaitForElement(q => q.Marked("ListView")); RunningApp.Back(); } // At this point, the counter can be any value, but it's most likely not zero. // Invoking GC once is enough to clean up all garbage data and set counter to zero RunningApp.WaitForElement(q => q.Marked("GC")); RunningApp.Tap(q => q.Marked("GC")); RunningApp.WaitForElement(q => q.Marked("Counter: 0")); }