public void ValidatePrePopulatedEmail() { if (KeywordImplementation.UIObject(By.Id("toField")).GetAttribute("value").Contains("@sivantos.com")) //&& KeywordImplementation.UIObject(By.Id("toField")).Text.Contains(".")) { Logger.logSuccess(string.Format("Pre-populated mail id is'{0}'", KeywordImplementation.UIObject(By.Id("toField")).GetAttribute("value"))); } else { Logger.logFailure(string.Format("Pre-populated e-mail id '{0}' is not correct", KeywordImplementation.UIObject(By.Id("toField")).GetAttribute("value"))); } if (KeywordImplementation.UIObject(By.Id("subjectField")).GetAttribute("value").Length != 0) { Logger.logSuccess(string.Format("Pre-populated mail subject is '{0}'", KeywordImplementation.UIObject(By.Id("subjectField")).Text)); } else { Logger.logFailure("Pre-populated subject is empty"); } if (KeywordImplementation.UIObject(By.Id("Message body")).GetAttribute("value").Length != 0) { Logger.logSuccess(string.Format("Pre-populated mail contents is'{0}'", KeywordImplementation.UIObject(By.Id("Message body")).GetAttribute("value"))); } else { Logger.logFailure("Pre-populated mail content is empty"); } Logger.logSnapshot(); }
public void SwitchAudiogramAvailableinEditScreen(bool on, bool alert) { string message = null; var switchAudiogram = KeywordImplementation.UIObject(By.Id("switchAudiogramEnable"), TimeSpan.FromSeconds(1)); if ((on.Equals(true) && (switchAudiogram.GetAttribute("value").Equals("0") || switchAudiogram.GetAttribute("value").Equals("false"))) || (on.Equals(false) && (switchAudiogram.GetAttribute("value").Equals("1") || switchAudiogram.GetAttribute("value").Equals("true")))) { switchAudiogram.Click(); message = on?"Switch on the audiogram":"Switch off the audiogram"; Logger.logInfo(message); } Logger.logSnapshot(); if (KeywordImplementation.waitForObjectExist(By.ClassName("UIAAlert"), TimeSpan.FromSeconds(2))) { if (alert.Equals(true)) { KeywordImplementation.Click(By.Id("OK")); Logger.logInfo("OK the alert"); } else { KeywordImplementation.Click(By.Id("Cancel")); Logger.logInfo("Cancel the alert"); } } }
private void TapOnCoupling(string objName) { if (KeywordImplementation.UIObject(By.Id("Txt_ActionBar_Title"), TimeSpan.FromSeconds(5)).Text.Equals("Select Coupling")) { KeywordImplementation.Click(By.Name(objName)); } }
public void SwitchAudiogramAvailable(bool on) { var switchAudiogram = KeywordImplementation.UIObject(By.Id("switchAudiogramEnable"), TimeSpan.FromSeconds(1)); if ((on.Equals(true) && (switchAudiogram.GetAttribute("value").Equals("0") || switchAudiogram.GetAttribute("value").Equals("false"))) || (on.Equals(false) && (switchAudiogram.GetAttribute("value").Equals("1") || switchAudiogram.GetAttribute("value").Equals("true")))) { switchAudiogram.Click(); Logger.logInfo("Switch Audiogram button is tapped", true); } }
public void SwitchSettingOmniture(bool on) { var switchOmniture = KeywordImplementation.UIObject(By.Id("switchSettingUsage"), TimeSpan.FromSeconds(1)); if ((on.Equals(true) && (switchOmniture.GetAttribute("value").Equals("0") || switchOmniture.GetAttribute("value").Equals("false"))) || (on.Equals(false) && (switchOmniture.GetAttribute("value").Equals("1") || switchOmniture.GetAttribute("value").Equals("true")))) { switchOmniture.Click(); Report.Success("Switch Omniture is " + switchOmniture.GetAttribute("value")); } Logger.logSnapshot(); }
public void SwitchUsageStatistics(bool on) { var switchUsageStatistics = KeywordImplementation.UIObject(By.Id("toggleButton"), TimeSpan.FromSeconds(5)); if ((on.Equals(true) && switchUsageStatistics.Text.Equals("Off")) || (on.Equals(false) && switchUsageStatistics.Text.Equals("On"))) { switchUsageStatistics.Click(); Logger.logSuccess("Usage statistics is " + switchUsageStatistics.Text); } Logger.logSnapshot(); }
public void SwitchSettingOmniture(bool on) { var switchOmniture = KeywordImplementation.UIObject(By.Id("Switch_Settings_Omniture"), TimeSpan.FromSeconds(1)); if ((on.Equals(true) && switchOmniture.Text.Equals("Off")) || (on.Equals(false) && switchOmniture.Text.Equals("On"))) { switchOmniture.Click(); Report.Success("Switch Omniture is " + switchOmniture.Text); } Logger.logSnapshot(); }
public void SwitchAudiogramAvailable(bool on) { var switchAudiogram = KeywordImplementation.UIObject(By.Id("Switch_Cust_ExisitingAudiogram"), TimeSpan.FromSeconds(1)); if ((on.Equals(true) && switchAudiogram.Text.Equals("No")) || (on.Equals(false) && switchAudiogram.Text.Equals("Yes"))) { switchAudiogram.Click(); Logger.logInfo("Switch Audiogram is " + switchAudiogram.Text); } Logger.logSnapshot(); }
public void SwitchUsageStatistics(bool on) { var switchUsageStatistics = KeywordImplementation.UIObject(By.Id("switchSettingUsage"), TimeSpan.FromSeconds(5)); if ((on.Equals(true) && (switchUsageStatistics.GetAttribute("value").Equals("0") || switchUsageStatistics.GetAttribute("value").Equals("false"))) || (on.Equals(false) && (switchUsageStatistics.GetAttribute("value").Equals("1") || switchUsageStatistics.GetAttribute("value").Equals("true")))) { switchUsageStatistics.Click(); Logger.logSuccess("Usage statistics is " + switchUsageStatistics.GetAttribute("value")); } Logger.logSnapshot(); }
public void ValidateActionBarTitle(string title) { if (KeywordImplementation.UIObject(By.Id("action_bar_title"), TimeSpan.FromSeconds(5)).Text.Equals(title)) { Logger.logSuccess(title + " has found"); } else { Logger.logFailure(title + " has not found"); } }
private void SwitchMold(bool on) { var switchMold = KeywordImplementation.UIObject(By.Id("Switch_CustomMolds_UseMolds"), TimeSpan.FromSeconds(5)); if ((on.Equals(true) && switchMold.Text.Equals("No")) || (on.Equals(false) && switchMold.Text.Equals("Yes"))) { switchMold.Click(); Logger.logSuccess("Use custom ear molds state is " + switchMold.Text); } Logger.logSnapshot(); }
public void ValidateTextSelected(string objectName) { if (KeywordImplementation.UIObject(By.Name(objectName)).GetAttribute("selected").Equals("true", StringComparison.CurrentCultureIgnoreCase)) { Logger.logSuccess(string.Format("'{0}' is selected", objectName)); } else { Logger.logFailure(string.Format("'{0}'is not selected", objectName)); } }
public void ValidatePatientExist(string lastName, string firstName) { Logger.logSnapshot(); if (KeywordImplementation.UIObject(By.Id("txtLastName")).Text.Contains(lastName) && KeywordImplementation.UIObject(By.Id("txtFirstName")).Text.Contains(firstName)) { Logger.logSuccess(string.Format("Patient details '{0}, {1}' has found", lastName, firstName)); } else { Logger.logFailure(string.Format("Patient details '{0}, {1}' has not found", lastName, firstName)); } }
public void ValidateNotes(string notes) { KeywordImplementation.Click(By.Id("Notes")); if (KeywordImplementation.UIObject(By.Id("Txtnotes"), TimeSpan.FromSeconds(3)).GetAttribute("value").Contains(notes)) { Logger.logSuccess(string.Format("Notes '{0}' has found", notes)); } else { Logger.logFailure(string.Format("Notes '{0}' has not found", notes)); } KeywordImplementation.Click(By.XPath("//UIAWindow[2]//UIAButton[contains(@name,'Done')]")); }
public void ValidateAppVersion() { string versionInfo = KeywordImplementation.UIObject(By.Id("Version Number"), TimeSpan.FromSeconds(2)).Text; if ((versionInfo.Split('.').Length - 1) == 3) { Logger.logSuccess(string.Format("Application version {0} displayed is correct", versionInfo)); } else { Logger.logFailure(string.Format("Application version {0} displayed is incorrect", versionInfo)); } }
public void SwipePatientLeft(string lastName, string firstName) { var client = KeywordImplementation.UIObject(By.XPath("//UIATableView[@name='Search results']//UIAStaticText[@name='" + lastName + ", " + firstName + "']")); var size = client.Size; int startx = (int)(size.Width * 0.70); int endx = (int)(size.Width * 0.30); int starty = size.Height / 2; //Swipe from right to left ((IOSDriver <IOSElement>)Accessor.getDriver()).Swipe(client.Location.X + startx, client.Location.Y + starty, client.Location.X + endx, client.Location.Y + starty, 2000); Delay.Seconds(1); }
public void ValidateAppVersion() { KeywordImplementation.SwipeVerticle(3, 0.50, 0.20, By.Id("itemTextViewRight"), true); string versionInfo = KeywordImplementation.UIObject(By.Id("itemTextViewRight"), TimeSpan.FromSeconds(2)).Text; if ((versionInfo.Split('.').Length - 1) == 3) { Logger.logSuccess(string.Format("Application version {0} displayed is correct", versionInfo)); } else { Logger.logFailure(string.Format("Application version {0} displayed is incorrect", versionInfo)); } }
private void ValidateSelectedBrand(string brand) { //Logger.logInfo(KeywordImplementation.UIObject(By.Id("Img_Language_Checkmark")).GetAttribute("resourceId")); //Logger.logInfo(KeywordImplementation.UIObject(By.Id("Img_Language_Checkmark")).GetAttribute("name")); //Logger.logInfo(KeywordImplementation.UIObject(By.Id("Img_Language_Checkmark")).GetAttribute("contentDesc")); if (KeywordImplementation.UIObject(By.Id("Img_Language_Checkmark")).GetAttribute("name").Contains(brand)) { Logger.logSuccess("Brand " + brand + " is selected", true); } else { Logger.logFailure("Brand " + brand + " is not selected", true); } }
private void DrawPTEAudiogramPoints(string side, string points) { Logger.logInfo(string.Format("Draw audiogram points \"{0}\"", points)); if (KeywordImplementation.UIObject(By.Id("Txt_ActionBar_Title"), TimeSpan.FromSeconds(5)).Text.Equals("Pure Tone Estimation")) { Logger.logInfo("PTE page is selected"); if (side.Equals("right", StringComparison.CurrentCultureIgnoreCase)) { if (KeywordImplementation.UIObject(By.Id("Btn_ActionBar_Right")).GetAttribute("name").Contains("Right") && KeywordImplementation.UIObject(By.Id("Txt_PureToneTest_FreqWithoutBg")).Text.Contains("500 Hz")) { Logger.logInfo("PTE right side is selected"); } } if (side.Equals("left", StringComparison.CurrentCultureIgnoreCase)) { if (KeywordImplementation.UIObject(By.Id("Btn_ActionBar_Right")).GetAttribute("name").Contains("Right") && KeywordImplementation.UIObject(By.Id("Txt_PureToneTest_FreqWithoutBg")).Text.Contains("500 Hz")) { KeywordImplementation.Click(By.Id("Img_PureToneInst_Skip")); Logger.logInfo("Selecting the PTE left side"); } if (KeywordImplementation.UIObject(By.Id("Btn_ActionBar_Right")).GetAttribute("name").Contains("Left") && KeywordImplementation.UIObject(By.Id("Txt_PureToneTest_FreqWithoutBg")).Text.Contains("500 Hz")) { Logger.logInfo("PTE left side is selected"); } } //IWebElement elementImgBtnPteIncrease = Accessor.getDriver().FindElement(By.Id("ImgBtn_PureToneTest_Increase")); string[] aPoints = points.Split(';'); foreach (string point in aPoints) { int audValue = 0; audValue = (int.Parse(point) - 30) / 5; IWebElement elementImgBtnPteIncrease = Accessor.getDriver().FindElement(By.Id("ImgBtn_PureToneTest_Increase")); for (int i = 0; i < audValue; i++) { elementImgBtnPteIncrease.Click(); //KeywordImplementation.Click(By.Id("ImgBtn_PureToneTest_Increase")); } if (audValue >= 13) { KeywordImplementation.Click(By.Id("ImgBtn_PureToneTest_HeardUnHeard")); } KeywordImplementation.Click(By.Id("ImgBtn_PureToneInst_Next")); } } }
public void ValidateUsageStatistics(bool isON) { var switchUsageStatistics = KeywordImplementation.UIObject(By.Id("toggleButton"), TimeSpan.FromSeconds(1)); if ((isON.Equals(true) && switchUsageStatistics.Text.Equals("On")) || (isON.Equals(false) && switchUsageStatistics.Text.Equals("Off"))) { Logger.logSuccess("Usage statistics is " + switchUsageStatistics.Text); } else { Logger.logFailure("Usage statistics is " + switchUsageStatistics.Text); } Logger.logSnapshot(); }
public void ValidateUsageStatistics(bool isON) { var switchUsageStatistics = KeywordImplementation.UIObject(By.Id("switchUsageStatistics"), TimeSpan.FromSeconds(1)); if ((isON.Equals(true) && switchUsageStatistics.GetAttribute("value").Equals("true")) || (isON.Equals(false) && switchUsageStatistics.GetAttribute("value").Equals("false"))) { Logger.logSuccess("Usage statistics is " + switchUsageStatistics.GetAttribute("value")); } else { Logger.logFailure("Usage statistics is " + switchUsageStatistics.GetAttribute("value")); } Logger.logSnapshot(); }
public void ValidateMuteUnmute(bool on) { string message = null; if (KeywordImplementation.UIObject(By.Id("btnVolumeMute")).GetAttribute("selected").Equals(Convert.ToString(on), StringComparison.CurrentCultureIgnoreCase)) { message = on?"HI is Mute ":"HI is Unmute"; Logger.logSuccess(message); } else { message = on?"HI is Unmute":"HI is Mute "; Logger.logFailure(message); } }
public void ValidateUsageStatistics(bool isON) { string message = null; var switchUsageStatistics = KeywordImplementation.UIObject(By.Id("switchSettingUsage"), TimeSpan.FromSeconds(1)); if ((isON.Equals(true) && (switchUsageStatistics.GetAttribute("value").Equals("1") || switchUsageStatistics.GetAttribute("value").Equals("true"))) || (isON.Equals(false) && (switchUsageStatistics.GetAttribute("value").Equals("0") || switchUsageStatistics.GetAttribute("value").Equals("false")))) { message = isON? "Usage statistics is On" :"Usage statistics is Off"; Logger.logSuccess(message); } else { message = isON? "Usage statistics is Off":"Usage statistics is On"; Logger.logFailure(message); } }
public static Image CaptureSnapshot(By by) { Bitmap savedImage = null; Rectangle section = Rectangle.Empty; // if(Accessor.driverIsForIOS()) // if(TestSuite.Current.Parameters["isTablet"].Equals("True",StringComparison.CurrentCultureIgnoreCase)) // if(!TestSuite.Current.Parameters["Version"].Equals("10",StringComparison.CurrentCultureIgnoreCase)) // ((IOSDriver<IOSElement>)Accessor.getDriver()).Orientation=ScreenOrientation.Landscape; // if(Accessor.driverIsForIOS()) // if(!TestSuite.Current.Parameters["Version"].Equals("10",StringComparison.CurrentCultureIgnoreCase)) // ((IOSDriver<IOSElement>)Accessor.getDriver()).Orientation=ScreenOrientation.Landscape; if (by != null) { var elem = KeywordImplementation.UIObject(by); var size = elem.Size; var x = elem.Location.X; var y = elem.Location.Y; //((IOSDriver<IOSElement>)Accessor.getDriver()).Rotate(ScreenOrientation.Landscape); Bitmap source = new Bitmap(getSnapshotFileInfo(Accessor.getDriver()).ToString()); if (Accessor.driverIsForIOS()) { var width = Accessor.getDriver().Manage().Window.Size.Width; if (width == 414) { section = new Rectangle(x * 3, y * 3, size.Width * 3, size.Height * 3); } else { section = new Rectangle(x * 2, y * 2, size.Width * 2, size.Height * 2); } } else { section = new Rectangle(x, y, size.Width, size.Height); } savedImage = CropImage(source, section); } else { savedImage = new Bitmap(getSnapshotFileInfo(Accessor.getDriver()).FullName); } return(savedImage); }
public void ValidateSliderSteps() { string [] sliderSteps = null; for (int i = 0; i < 16; i++) { KeywordImplementation.Click(By.Id("imgViewVolumeUp")); } sliderSteps = KeywordImplementation.UIObject(By.Id("seekBarVolume")).GetAttribute("name").Split('_'); if ((sliderSteps[1].Equals(sliderSteps[2])) && (sliderSteps[2].Equals("15"))) { Logger.logInfo("Volume slider has 16 steps", true); } else { Logger.logFailure("Volume slider does not have 16 steps", false); } }
public void ValidateMuteUnmute(bool muteUnmute) { string message = null; var buttonMuteUnmute = KeywordImplementation.UIObject(By.Id("MuteUnmuteButton"), TimeSpan.FromSeconds(1)); if (buttonMuteUnmute.GetAttribute("label").Equals(muteUnmute.ToString(), StringComparison.CurrentCultureIgnoreCase)) { message = muteUnmute?"HI is mute":"HI is unmute"; Logger.logSuccess(message); } else { message = muteUnmute?"HI is unmute":"HI is mute"; Logger.logFailure(message); } // Logger.logFailure("HI is "+muteUnmute); // if(KeywordImplementation.UIObject(By.Id("MuteUnmuteButton")).GetAttribute("label").Equals(muteUnmute,StringComparison.CurrentCultureIgnoreCase)) // Logger.logSuccess("HI is "+muteUnmute); // else // Logger.logFailure("HI is "+muteUnmute); }
public void VerifyTextHighlighted(string objectName) { //Logger.logWarn("Information has to be added to identify highlighted text"); var size = Accessor.getDriver().Manage().Window.Size; 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.Name(objectName), TimeSpan.FromSeconds(1)))) { ((AndroidDriver <OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 500); count++; } if (KeywordImplementation.UIObject(By.Id("Active Step")).GetAttribute("value").Equals(objectName, StringComparison.CurrentCultureIgnoreCase)) { Logger.logSuccess(string.Format("'{0}' is highlighted", objectName)); } else { Logger.logFailure(string.Format("'{0}'is not highlighted", objectName)); } }
public static Image CaptureSnapshot(By by) { Bitmap savedImage = null; Rectangle section = Rectangle.Empty; if (by != null) { var size = KeywordImplementation.UIObject(by).Size; var x = KeywordImplementation.UIObject(by).Location.X; var y = KeywordImplementation.UIObject(by).Location.Y; //((IOSDriver<IOSElement>)Accessor.getDriver()).Rotate(ScreenOrientation.Landscape); Bitmap source = new Bitmap(getSnapshotFileInfo(Accessor.getDriver()).ToString()); if (!Accessor.driverIsForIOS()) { section = new Rectangle(x, y, size.Width, size.Height); } else { var width = Accessor.getDriver().Manage().Window.Size.Width; if (width == 414) { section = new Rectangle(x * 3, y * 3, size.Width * 3, size.Height * 3); } else { section = new Rectangle(x * 2, y * 2, size.Width * 2, size.Height * 2); } } savedImage = CropImage(source, section); } else { savedImage = new Bitmap(getSnapshotFileInfo(Accessor.getDriver()).FullName); } return(savedImage); }
public void ValidateAudiogramPointsOnCustomerOverviewScreen(string side, string points, bool isExist) { // Logger.logWarn("Aaudiogram point summary has to be added in Audiogram Layout object field for verification"); if (isExist) { var size = Accessor.getDriver().Manage().Window.Size; int starty = (int)(size.Height * 0.50); int endy = (int)(size.Height * 0.80); int startx = size.Width / 2; ((AndroidDriver <OpenQA.Selenium.Appium.Android.AndroidElement>)Accessor.getDriver()).Swipe(startx, starty, startx, endy, 1000); IWebElement audiogramGrid = null; if (side.Equals("right", StringComparison.CurrentCultureIgnoreCase)) { audiogramGrid = KeywordImplementation.UIObject(By.Id("AudiogramGrid_RightEar")); } else if (side.Equals("left", StringComparison.CurrentCultureIgnoreCase)) { audiogramGrid = KeywordImplementation.UIObject(By.Id("AudiogramGrid_LeftEar")); } if (audiogramGrid.GetAttribute("label").Contains(points)) { Logger.logSuccess("Audiogram point validation passed on customer overview screen"); } else { Logger.logFailure("Audiogram point validation failed on customer overview scxreen", true); } } else { Logger.logInfo(string.Format("'{0}' side audiogram points does not exist in customer overview screen", side)); } }
public void ValidateDateEmpty(bool empty) { //string message=null; Logger.ConditionalValidation(KeywordImplementation.UIObject(By.Id("txtDOB")).GetAttribute("value").Contains("yy"), empty, "DOB details has not found", string.Format("DOB details '{0}' has found", KeywordImplementation.UIObject(By.Id("txtDOB")).Text)); }