public void EditPatient(string lastName, string firstName) { var size = Accessor.getDriver().Manage().Window.Size; //Swipe from Bottom to Top and Top to bottom //Find swipe start and end point from screen's width and height. int starty = (int)(size.Height * 0.50); int endy = (int)(size.Height * 0.20); int startx = size.Width / 2; int count = 0; while (count != 3 && (!KeywordImplementation.waitForObjectExist(By.Id("txtLastName"), TimeSpan.FromSeconds(1)))) { ((IOSDriver <IOSElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 500); count++; } Logger.logInfo(string.Format("Edit the patient with info '{0}, {1}'", lastName, firstName)); KeywordImplementation.TypeText(By.Id("txtLastName"), lastName); KeywordImplementation.Click(By.XPath("//UIAWindow[2]//UIAButton[contains(@name,'Done')]")); KeywordImplementation.TypeText(By.Id("txtFirstName"), firstName); KeywordImplementation.Click(By.XPath("//UIAWindow[2]//UIAButton[contains(@name,'Done')]")); //TapOnLeftButton("Press the back key"); }
public void EditProgram(string programName, string editProgramName) { KeywordImplementation.SwipeVerticle(3, 0.50, 0.80, By.Name(programName)); Logger.logInfo(string.Format("Edit the patient with info '{0}'", programName)); KeywordImplementation.TypeText(By.Name(programName), editProgramName); ((AndroidDriver <OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).PressKeyCode(AndroidKeyCode.Back); }
public void EditNotes(string notes) { Logger.logInfo("Edit the notes field"); KeywordImplementation.Click(By.Id("Notes")); KeywordImplementation.TypeText(By.Id("Txtnotes"), notes); //s((IOSDriver<IOSElement>)Accessor.getDriver()).PressKeyCode(AndroidKeyCode.Back); if (TestSuite.Current.Parameters["Version"].Equals("10", StringComparison.CurrentCultureIgnoreCase)) { KeywordImplementation.Click(By.XPath("//XCUIElementTypeOther/XCUIElementTypeButton[contains(@name,'Done')]")); } else { KeywordImplementation.Click(By.XPath("//UIAScrollView//UIAButton[contains(@name,'Done')]")); } }
private void EnterCode() { for (int count = 0; count < 14; count++) { KeywordImplementation.Click(By.XPath("//*[contains(@content-desc,'imageConnectHCP')]")); } KeywordImplementation.Click(By.Name("Integration")); KeywordImplementation.TypeText(By.XPath("//*[contains(@content-desc,'entryFieldLeft')]"), AppVariables.entryLeftCode); KeywordImplementation.TypeText(By.XPath("//*[contains(@content-desc,'entryFieldRight')]"), AppVariables.entryRightCode); ((AndroidDriver <OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).PressKeyCode(AndroidKeyCode.Back); Logger.logSnapshot(); KeywordImplementation.Tap("Connect Now"); }
public void EditNotes(string notes) { Logger.logInfo("Edit the notes field"); KeywordImplementation.Click(By.Id("Notes")); KeywordImplementation.TypeText(By.Id("Txtnotes"), notes); if (TestSuite.Current.Parameters["Version"].Equals("10", StringComparison.CurrentCultureIgnoreCase)) { KeywordImplementation.Click(By.XPath("//XCUIElementTypeOther/XCUIElementTypeButton[contains(@name,'Done')]")); } else if (TestSuite.Current.Parameters["Version"].Equals("9", StringComparison.CurrentCultureIgnoreCase)) { KeywordImplementation.Click(By.XPath("//UIAWindow[2]//UIAButton[contains(@name,'Done')]")); } else { KeywordImplementation.Click(By.XPath("//UIAScrollView//UIAButton[contains(@name,'Done')]")); } }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { //initialising HI values globally based on the AppBrand. BrandBasedHINames(); Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; string applicationName = TestSuite.Current.Parameters["AppName"]; string appActivity = "md56f35e8d86ebdc1429f36073ae400eed3.SplashActivity"; try { KeywordImplementation.LaunchAndroidApp(TestSuite.Current.Parameters["Device"], applicationName, appActivity); // KeywordImplementation.LaunchAndroidApp(TestSuite.Current.Parameters["Device"], applicationName, appActivity); Report.Info("Platform Version " + ((AndroidDriver <OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Capabilities.GetCapability("platformVersion")); ////..getCapabilities().getCapability("platformVersion") Report.Info("Device Name " + ((AndroidDriver <OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Capabilities.GetCapability("deviceName")); if (KeywordImplementation.waitForObjectExist(By.Name("OK"), TimeSpan.FromSeconds(5))) { KeywordImplementation.Click(By.Name("OK")); } var size = Accessor.getDriver().Manage().Window.Size; //Swipe from Bottom to Top and Top to bottom //Find swipe start and end point from screen's width and height. int starty = 0, endy = 0, startx = 0; bool isTablet = size.Width >= 600; starty = (int)(size.Height * 0.50); endy = (int)(size.Height * 0.20); startx = size.Width / 2; int count = 0; while (count != 3 && (!KeywordImplementation.waitForObjectExist(By.Id("Btn_AppInfo_Accept"), TimeSpan.FromSeconds(1)))) { ((AndroidDriver <OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 500); count++; } Report.Success("Welcome Page screen is available"); Logger.logSnapshot(); KeywordImplementation.Click(By.Id("CheckBox_AcceptTAndC")); KeywordImplementation.Click(By.Id("Btn_AppInfo_Accept")); Delay.Seconds(15); // For SSO // ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 0); // ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 0); // // KeywordImplementation.SwipeVerticle(3,0.50,0.20,By.XPath("//*[contains(@content-desc,'Yes, Allow')]")); // KeywordImplementation.Click(By.XPath("//*[contains(@content-desc,'Yes, Allow')]")); // if (KeywordImplementation.waitForObjectExist(By.Name("Country"), TimeSpan.FromSeconds(3))) { KeywordImplementation.Click(By.Name("Done")); } KeywordImplementation.TypeText(By.Id("Txt_Legitimation_Code1"), "8981"); KeywordImplementation.TypeText(By.Id("Txt_Legitimation_Code2"), "9313"); KeywordImplementation.TypeText(By.Id("Txt_Legitimation_Code3"), "9666"); Report.Success("Access code screeen is available"); Logger.logSnapshot(); KeywordImplementation.Click(By.Name("Done")); Delay.Seconds(3); Ranorex.Report.Success(Accessor.getDriver().FindElement(By.Id("Txt_Legitimation_Msg")).Text); Logger.logSnapshot(); while (count != 3 && (!KeywordImplementation.waitForObjectExist(By.Id("Continue"), TimeSpan.FromSeconds(1)))) { ((AndroidDriver <OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 500); count++; } KeywordImplementation.Click(By.Name("Continue")); if (applicationName.Equals("com.connexx.fit2go", StringComparison.CurrentCultureIgnoreCase)) { KeywordImplementation.Click(By.Name("Done")); } Ranorex.Report.Success("Customer Ear Molds screen is available"); Logger.logSnapshot(); count = 0; while (count != 3 && (!KeywordImplementation.waitForObjectExist(By.Id("Btn_CustomMolds_Continue"), TimeSpan.FromSeconds(1)))) { ((AndroidDriver <OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 500); count++; } KeywordImplementation.Click(By.Id("Btn_CustomMolds_Continue")); //Selecting the HIs from the list available for recommendation //SwitchToChooseHI(); if (KeywordImplementation.waitForObjectExist(By.Id("Txt_CommonAlert_Title"), TimeSpan.FromSeconds(3))) { Ranorex.Report.Success("Security alert has popped up"); Logger.logSnapshot(); KeywordImplementation.Click(By.Name("OK")); } Logger.logSnapshot(); if (TestSuite.Current.Parameters["isTablet"].Equals("True", StringComparison.CurrentCultureIgnoreCase)) { KeywordImplementation.Click(By.Id("Tab_Cutomer_Settings")); } else { TearDown.CloseApplication(); TestModuleRunner.Run(new STSAndBasic.AndroidSetUp()); KeywordImplementation.Click(By.Id("Btn_ActionBar_Right"), "Click on Settings"); } Delay.Seconds(2); SwitchSettingOmniture(false); } finally { if (Accessor.getDriver() != null) { Accessor.getDriver().Quit(); } } }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { BrandBasedHINames(); try { Report.Info("Brand " + TestSuite.Current.Parameters["Brand"]); Report.Info("Device " + TestSuite.Current.Parameters["Device"]); Report.Info("App " + TestSuite.Current.Parameters["AppName"]); string applicationName = TestSuite.Current.Parameters["AppName"]; string appPath = TestSuite.Current.Parameters["AppPath"]; KeywordImplementation.LaunchiOSApp(new Uri("http://" + TestSuite.Current.Parameters["Uri"] + ":4723/wd/hub"), TestSuite.Current.Parameters["Device"], applicationName, appPath); if (KeywordImplementation.waitForObjectExist(By.Id("OK"), TimeSpan.FromSeconds(5))) { KeywordImplementation.Click(By.Id("OK")); } var size = Accessor.getDriver().Manage().Window.Size; /*****************************/ //Swipe from Bottom to Top //Find swipe start and end point from screen's width and height. int starty = (int)(size.Height * 0.70); int endy = (int)(size.Height * 0.20); int startx = size.Width / 2; int count = 0; while (count != 3 && (!KeywordImplementation.waitForObjectExist(By.Id("Accept & Continue"), TimeSpan.FromSeconds(1)))) { ((IOSDriver <IOSElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 1000); count++; } Report.Success("Welcome Page screen is available"); KeywordImplementation.Click(By.Id("AgreeCheckBox")); Logger.logSnapshot(); KeywordImplementation.Click(By.Id("Accept & Continue")); Delay.Seconds(15); if (KeywordImplementation.waitForObjectExist(By.Id("Country"), TimeSpan.FromSeconds(3))) { Logger.logSuccess("Country selection screen is shown"); Logger.logSnapshot(); while (count <= 25 && (!KeywordImplementation.waitForObjectExist(By.Id("Rest of World"), TimeSpan.FromSeconds(1)))) { ((IOSDriver <IOSElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 500); count++; } KeywordImplementation.Click(By.Id("Rest of World")); KeywordImplementation.Click(By.Id("Done")); } KeywordImplementation.TypeText(By.Id("Passcode1"), "8981"); KeywordImplementation.TypeText(By.Id("Passcode2"), "9313"); KeywordImplementation.TypeText(By.Id("Passcode3"), "9666"); Report.Success("Access code screeen is available"); Logger.logSnapshot(); KeywordImplementation.Click(By.Id("Done")); Delay.Seconds(10); Ranorex.Report.Success(Accessor.getDriver().FindElement(By.Id("Code entered successfully.")).Text); Logger.logSnapshot(); KeywordImplementation.Click(By.Id("Continue")); if (TestSuite.Current.Parameters["Brand"].Equals("Connexx", StringComparison.CurrentCultureIgnoreCase)) { KeywordImplementation.Click(By.Name("Done")); } Ranorex.Report.Success("Customer Ear Molds screen is available"); Logger.logSnapshot(); KeywordImplementation.Click(By.Id("Continue")); //KeywordImplementation.Click(By.Id("Continue")); if (KeywordImplementation.waitForObjectExist(By.XPath("//UIAAlert[@name='Sensitive Client Data']"), TimeSpan.FromSeconds(3))) { Ranorex.Report.Success("Security alert has popped up"); Logger.logSnapshot(); KeywordImplementation.Click(By.Id("OK")); } Logger.logSnapshot(); if (TestSuite.Current.Parameters["isTablet"].Equals("True", StringComparison.CurrentCultureIgnoreCase)) { KeywordImplementation.Click(By.Id("SettingsIcon")); } else { KeywordImplementation.Click(By.Id("NavBarRight")); } SwitchSettingOmniture(false); // } } finally { if (Accessor.getDriver() != null) { Accessor.getDriver().Quit(); } } }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; string applicationName = TestSuite.Current.Parameters["AppName"]; string appActivity = "md5887522972be76f398b6ce0dd53353466.MainActivity"; try { KeywordImplementation.LaunchWeb("chrome", "http:www.google.com"); KeywordImplementation.TypeText(By.Name("q"), "executeautomation"); // KeywordImplementation.LaunchAndroidApp(TestSuite.Current.Parameters["Device"],applicationName,appActivity); //// Report.Info("Platform Version "+((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Capabilities.GetCapability("platformVersion"));////..getCapabilities().getCapability("platformVersion") //// Report.Info("Device Name "+((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Capabilities.GetCapability("deviceName")); // if(KeywordImplementation.waitForObjectExist(By.Name("Start"),TimeSpan.FromSeconds(60))) // KeywordImplementation.Click(By.Name("Start")); // // for(int count=0;count<14;count++) // { // KeywordImplementation.Click(By.XPath("//*[contains(@content-desc,'imageConnectHCP')]")); // } // // KeywordImplementation.Click(By.Name("Integration")); // //imageConnectHCP // // KeywordImplementation.TypeText(By.XPath("//*[contains(@content-desc,'entryFieldLeft')]"),AppVariables.entryLeftCode); // KeywordImplementation.TypeText(By.XPath("//*[contains(@content-desc,'entryFieldRight')]"),AppVariables.entryRightCode); // // ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).PressKeyCode(AndroidKeyCode.Back); // Logger.logSnapshot(); // KeywordImplementation.Tap("Connect Now"); // if(KeywordImplementation.waitForObjectExist(By.Name("Consent Statement"),TimeSpan.FromSeconds(15))) // { // Logger.logSnapshot(); // KeywordImplementation.Tap("Accept"); // } // if(KeywordImplementation.waitForObjectExist(By.Name("Pair your hearing aids"),TimeSpan.FromSeconds(10))) // { // Logger.logSnapshot(); // KeywordImplementation.Tap("Start"); // } // if(KeywordImplementation.waitForObjectExist(By.Name("Confirmation Sound"),TimeSpan.FromSeconds(10))) // { // Logger.logSnapshot(); // KeywordImplementation.Tap("Yes"); // } // if(KeywordImplementation.waitForObjectExist(By.Name("Pairing Finished"),TimeSpan.FromSeconds(10))) // { // Logger.logSnapshot(); // KeywordImplementation.Tap("Close"); // } // if(KeywordImplementation.waitForObjectExist(By.Name("Ready to go"),TimeSpan.FromSeconds(10))) // { // Logger.logSnapshot(); // KeywordImplementation.Tap("Start using the app"); // } // /*IWebElement connectHCP= KeywordImplementation.UIObject(By.XPath("//*[contains(@content-desc,'imageConnectHCP')]")); * * IWebElement entryFieldLeft= KeywordImplementation.UIObject(By.XPath("//*[contains(@content-desc,'entryFieldLeft')]")); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,entryFieldLeft,0); * // Delay.Seconds(3); * for(int count=0;count<10;count++) * { * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * Delay.Milliseconds(500); * } * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * Delay.Seconds(1); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * Delay.Seconds(1); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * Delay.Seconds(1); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Tap(1,connectHCP,0); * * // KeywordImplementation.DoubleTap(By.Name("Advanced")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.DoubleTap(By.Name("Further Information")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * // KeywordImplementation.Click(By.ClassName("android.widget.ImageView")); * * * * // if(KeywordImplementation.waitForObjectExist(By.Name("OK"),TimeSpan.FromSeconds(5))) * // { * // KeywordImplementation.Click(By.Name("OK")); * // } * // var size=Accessor.getDriver().Manage().Window.Size; * // * // //Swipe from Bottom to Top and Top to bottom * // //Find swipe start and end point from screen's width and height. * // int starty=0,endy=0,startx=0; * // bool isTablet= size.Width>=600; * // starty = (int) (size.Height * 0.50); * // endy = (int) (size.Height*0.20); * // startx = size.Width / 2; * // int count=0; * // while (count != 3 && (!KeywordImplementation.waitForObjectExist(By.Name("Accept & Continue"), TimeSpan.FromSeconds(1)))) * // { * // ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 500); * // count++; * // } * // Report.Success("App Info screen is available"); * // Logger.logSnapshot(); * // KeywordImplementation.Click(By.Name("Accept & Continue")); * // * // if(KeywordImplementation.waitForObjectExist(By.Name("Setup"),TimeSpan.FromSeconds(3))) * // { * // KeywordImplementation.Click(By.Name("Manual Setup")); * // } * // * // if(KeywordImplementation.waitForObjectExist(By.Name("Allow"),TimeSpan.FromSeconds(3))) * // { * // KeywordImplementation.Click(By.Name("Allow")); * // } * // * // KeywordImplementation.Click(By.Name("Signia Products")); * // * // //A confirmation sound played from the hearing aids indicates a successful pairing.Did you hear the confirmation sound? * // if(KeywordImplementation.waitForObjectExist(By.Id("textViewSoundTest"),TimeSpan.FromSeconds(3))) * // { * // KeywordImplementation.Click(By.Name("Yes")); * // Logger.logSnapshot(); * // } * // KeywordImplementation.Click(By.Name("Yes")); * // KeywordImplementation.Click(By.Name("6")); * // if(KeywordImplementation.waitForObjectExist(By.Name("Do you use a tinnitus program?"),TimeSpan.FromSeconds(3))) * // { * // KeywordImplementation.Click(By.Name("Yes")); * // } * // KeywordImplementation.Click(By.Name("6")); * // * // ////Swipe from Bottom to Top and Top to bottom * // while (count != 3 && (!KeywordImplementation.waitForObjectExist(By.Name("Continue"), TimeSpan.FromSeconds(1)))) * // { * // ((AndroidDriver<OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 500); * // count++; * // } * // KeywordImplementation.Click(By.Name("Continue")); * // * // * // if(KeywordImplementation.waitForObjectExist(By.Name("Setup is Complete."),TimeSpan.FromSeconds(3))) * // { * // Ranorex.Report.Success("Setup is completed"); * // Logger.logSnapshot(); * // KeywordImplementation.Click(By.Name("Continue")); * // } * // * // Logger.logSnapshot();*/ } finally { if (Accessor.getDriver() != null) { Accessor.getDriver().Quit(); } } }