public static void ClickRefill(RemoteWebDriver driver) { do { Console.WriteLine("Wait for 5 seconds medications page to open " + PerfectoHooks.CurrentDevice.DeviceDetails.Name); Thread.Sleep(5000); } while (PerfectoUtils.OCRTextCheckPoint(driver, "Retrieving", 6)); if (PerfectoUtils.IsTablet()) { PerfectoUtils.OCRTextClick(driver, "Refill a prescription", 90, 20, 1, false, 1, false); } else { driver.FindElementByXPath(RefillMedicationButton).Click(); } PerfectoUtils.RotateDevice(driver, Constants.Rotation.LANDSCAPE); Thread.Sleep(1000); PerfectoUtils.RotateDevice(driver, Constants.Rotation.PORTRAIT); Thread.Sleep(1000); PerfectoUtils.RotateDevice(driver, Constants.Rotation.LANDSCAPE); Thread.Sleep(1000); PerfectoUtils.RotateDevice(driver, Constants.Rotation.PORTRAIT); Thread.Sleep(1000); }
public void GivenIAmALoggedInUser() { if (PerfectoUtils.OCRTextCheckPoint(driver, "Patient", 6)) { return; } SignInPage.ClickStartSignIn(driver); if (PerfectoUtils.OCRTextCheckPoint(driver, "Patient", 6)) { return; } SignInPage.SignIn(driver); }
public static void ClickStartSignIn(AppiumDriver <IWebElement> driver) { //PerfectoUtils.OCRTextClick(driver, "Sign In", 90, 20, 1, false, 0, true); driver.Context = Constants.NATIVEAPP; driver.FindElementByXPath(StartSignInButton).Click(); Thread.Sleep(2000); //sometimes an authenticating modal appears - if so, give it some time to breath Console.WriteLine("Looking for Authenticating modal " + PerfectoHooks.CurrentDevice.DeviceDetails.Name); if (PerfectoUtils.OCRTextCheckPoint(driver, "Authenticating", 6, true)) { Console.WriteLine("Found Authenticating modal, sleep for few seconds" + PerfectoHooks.CurrentDevice.DeviceDetails.Name); Thread.Sleep(4000); } }
public static void SignIn(AppiumDriver <IWebElement> driver) { driver.Context = Constants.NATIVEAPP; driver.FindElementByXPath(UsernameField).Clear(); driver.FindElementByXPath(UsernameField).SendKeys(Constants.MAYO_USERNAME); driver.FindElementByXPath(PasswordField).SendKeys(Constants.MAYO_PASSWORD); Thread.Sleep(1000); if (PerfectoUtils.IsiPad()) { if (PerfectoUtils.OCRTextCheckPoint(driver, "Privacy policy", 6, false)) { driver.FindElementByXPath(PrivacyPolicySwitch).Click(); Thread.Sleep(2000); } } driver.FindElementByXPath(SignInButton).Click(); }
/// <summary> /// A text checkpoint using perfecto's extended mobile:checkpoint:text command. /// </summary> /// <param name="textToFind">The needle text you are looking for in your haystack.</param> /// <param name="timeoutInSeconds">Timeout in seconds.</param> /// <returns>Bool indicating if the text was found.</returns> protected static bool Checkpoint(string textToFind, AppiumDriver <IWebElement> driver, int?timeoutInSeconds = 25) { Console.WriteLine(string.Format("Checking text {0}", textToFind)); return(PerfectoUtils.OCRTextCheckPoint(driver, textToFind, timeoutInSeconds ?? 25)); }