//Method to check for Name and DOB details for Pupil. public bool GetPupilBasicDetailsNameDOB() { var displayNamePopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforNamePopUp))); var pupilNamePopup = displayNamePopup[0].Text; var displayDOBPopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforDOBPopUp))); var pupilDOBPopup = displayDOBPopup[0].Text; var elements = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId("PreferredListName_Learner"))); String Name = elements[0].Text; String fName = Name.ToString().Substring((Name.IndexOf(",") + 2)); String lName = Name.ToString().Substring(0, Name.IndexOf(",")); String pupilName = fName + lName; StringAssert.AreNotEqualIgnoringCase(pupilName, pupilNamePopup, "Failed"); TestResultReporter.Log("<b>Pupil Name - </b> " + pupilNamePopup); int index = pupilDOBPopup.IndexOf(':'); TestResultReporter.Log("<b> DOB - </b>" + pupilDOBPopup.ToString().Substring(index + 1)); return((pupilNamePopup != null) && (pupilDOBPopup != null)); // All are mandatory fields }
public void ScreenshotMethod() { var s = new ScreenshotLog("page title", "reports/screenshot/lkfdkjdf.jpg", "name"); TestResultReporter.Log(s); Assembly.LoadFrom("somewhere."); }
public bool GetPupilBasicDetails() { var displayNamePopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforNamePopUp))); var pupilNamePopup = displayNamePopup[0].Text; /* Popup Pupil name*/ var displayGenderPopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforGenderPopUp))); var pupilGenderPopup = displayGenderPopup[0].Text; var displayDOBPopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforDOBPopUp))); var pupilDOBPopup = displayDOBPopup[0].Text; var elements = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId("PreferredListName_Learner"))); // Elements in result tile String Name = elements[0].Text; int index1 = Name.IndexOf(","); String PupilName1 = (Name.ToString().Substring((index1 + 2))); String PupilName2 = (Name.ToString().Substring(0, (index1))); String pupilName = PupilName1 + " " + PupilName2; StringAssert.AreEqualIgnoringCase(pupilName, pupilNamePopup, "Failed"); //Verify if name displayed in the new popup is same as name in the results fetched TestResultReporter.Log("<b>Pupil Name - </b> " + pupilNamePopup); TestResultReporter.Log("<b> Gender - </b>" + pupilGenderPopup); int index = pupilDOBPopup.IndexOf(':'); TestResultReporter.Log("<b> DOB - </b>" + pupilDOBPopup.ToString().Substring(index + 1)); return((pupilNamePopup != null) && (pupilGenderPopup != null) && (pupilDOBPopup != null)); // All are mandatory fields }
public void RunTests(RunTests command, ITestResultReceiver reporter) { _assemblyLoaderProxy.AddDirectory(command.AssemblyPath); var ourProxy = new TestResultReporter(reporter); _runnerProxy.RunTest(command, ourProxy); }
//Method to check for gender details for Pupil - Returns true if Gender details are blank. public bool CheckPupilGenderDetailsForBlank() { var displayGenderPopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforGenderPopUp))); var pupilGenderPopup = displayGenderPopup[0].Text; TestResultReporter.Log("<b> Gender - </b>" + pupilGenderPopup); return(pupilGenderPopup == ""); }
public async Task <ContentResult> GetMessagesAsync() { TestResultAnalysis deviceAnalysis = TestResultReporter.GetDeviceReport(Settings.Current.ToleranceInMilliseconds); await this.PublishToLogAnalyticsAsync(deviceAnalysis); return(new ContentResult { Content = JsonConvert.SerializeObject(deviceAnalysis.MessagesReport, Formatting.Indented) }); // explicit serialization needed due to the wrapping list }
public static void GoToRoomScreen() { var menu = new TaskMenuBar(); menu.ClickCommunicationTaskMenuBar(); SeleniumHelper.WaitForElementClickableThenClick(AddressBookElements.TGScreenLink); // menu.ClickSchoolManagementLink(); menu.ClickRoomLink(); TestResultReporter.Log("Successfully Navigated to Rooms Page"); }
public async Task <ContentResult> GetReport() { TestResultAnalysis deviceAnalysis = TestResultReporter.GetDeviceReport(Settings.Current.ToleranceInMilliseconds); await this.PublishToLogAnalyticsAsync(deviceAnalysis); return(new ContentResult { Content = deviceAnalysis.ToString() }); }
public static void LogLinkVisibility(string screenName) { if (LoadedQuickSearchLink.Displayed) { TestResultReporter.Log("Quick Search Link is displayed on " + screenName); } else { TestResultReporter.Log("Quick Search Link is not displayed on " + screenName); } }
public void Screenshot() { try { WebContext.Screenshot(); } catch (Exception e) { TestResultReporter.Log("Couldn't take screenshot " + e.Message); } }
public bool GetClassYear() { var elements = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId("Learner_YearGroupClass"))); var resultCount = elements.Count; if (resultCount >= 1) { String pupilClassYear = elements[0].Text; TestResultReporter.Log("<b>Class/Year Group of this pupil is </b><b>" + pupilClassYear + "</b"); } return(elements[0].Text != null); }
public void GetPupilDetails() { if (HaveAssociatedPupil() >= 1) { for (int i = 1; i < HaveAssociatedPupil(); i++) { var elements = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId("contact_card_container"))); // Elements in result tile } } else { TestResultReporter.Log("No associated Pupils here"); } }
public bool IsEmailDisplayed() { try { WebContext.WebDriver.FindElement(AddressBookElements.EmailElement); IWebElement Email = WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("communication_email_basic"))); TestResultReporter.Log("<b>Email Address -</b> " + Email.Text); return(true); } catch (NoSuchElementException e) { return(false); } }
public bool IsPupilTelephoneDisplayed() { try { WebContext.WebDriver.FindElement(AddressBookElements.TelephoneElement); IWebElement PupilTelephone = WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("communication_telephone_basic"))); TestResultReporter.Log("<b>Telephone Number -</b> " + PupilTelephone.Text); return(true); } catch (NoSuchElementException e) { return(false); } }
public bool IsAddressDisplayed() { try { WebContext.WebDriver.FindElement(AddressBookElements.AddressElement); IWebElement Address = WebContext.WebDriver.FindElement(By.CssSelector(SeleniumHelper.AutomationId("meaning_home_icon_basic"))); TestResultReporter.Log("<b> Address -</b> " + Address.Text); return(true); } catch (NoSuchElementException e) { return(false); } }
private void SearchAndClickRoom(RoomPage roomPage, string shortRoomName, string longRoomName) { TestResultReporter.Log("Searching room >> " + shortRoomName); roomPage.EnterShortNameSearchPanel(shortRoomName); roomPage.EnterLongNameSearchPanel(longRoomName); roomPage.ClickSeachRoomButton(); SearchResults.WaitForResults(); Assert.IsTrue(SearchResults.HasResults(1)); TestResultReporter.Log(string.Format("Room '{0}' FOUND!!", shortRoomName)); roomPage.ClickSearchResults(); SearchResults.WaitForResults(); TestResultReporter.Log(string.Format("Opened Room '{0}'", shortRoomName)); }
private void InvokeWithTimeout(TestMethodInstance instance, ITestResult result) { var tokenSource = new CancellationTokenSource(); var token = tokenSource.Token; var timeOut = instance.Attr.TimeoutSeconds * 1000; var context = WebContext.GetThreadLocalContext(); var task = Task.Factory.StartNew(() => { WebContext.Set(context); TestResultReporter.Set(result); instance.Invoke(); }, token); if (!task.Wait(timeOut, token)) { throw new WebDriverTimeoutException("test timed out after " + instance.Attr.TimeoutSeconds + " sec"); } }
public bool GetStaffBasicDetails() { var displayNamePopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforNamePopUp))); var staffNamePopup = displayNamePopup[0].Text; /* Popup Pupil name*/ var displayGenderPopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforGenderPopUp))); var staffGenderPopup = displayGenderPopup[0].Text; var elements = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId("search_result_tile_Staff"))); // Elements in result tile String Name = elements[0].Text; int index1 = Name.IndexOf(","); String StaffName1 = (Name.ToString().Substring((index1 + 2))); String StaffName2 = (Name.ToString().Substring(0, (index1))); String staffName = StaffName1 + " " + StaffName2; // StringAssert.AreEqualIgnoringCase(pupilContactName, pupilContactNamePopup, "Failed"); //Verify if name displayed in the new popup is same as name in the results fetched //Parul: Check for Title in names TestResultReporter.Log("<b>Staff Name - </b> " + staffNamePopup); TestResultReporter.Log("<b> Gender - </b>" + staffGenderPopup); return((staffNamePopup != null) && (staffGenderPopup != null)); // All are mandatory fields }
public void Log(string message) { TestResultReporter.Log(message); }
private ITestResult RunOnce(TestMethodInstance instance) { ITestResult result = new TestResult(instance); TestResultReporter.Set(result); // the instance couldn't be constructed properly, and cannot be run. if (instance.RunnerException != null) { result.Exception = instance.RunnerException; result.Status = Status.Skipped; return(result); } try { // TODO freynaud check parameters for missmatch before running beforeMethod. foreach (var listener in _listeners) { listener.OnTestStart(instance, result); } } catch (Exception e) { result.Exception = e.InnerException; result.Status = Status.Skipped; foreach (var listener in _listeners) { listener.OnTestSkipped(instance, result); } result.StopWatch(); TestResultReporter.Clear(); return(result); } try { //instance.Invoke(); InvokeWithTimeout(instance, result); result.Status = Status.Passed; foreach (var listener in _listeners) { listener.OnTestPassed(instance, result); } } catch (Exception e) { //TestResultReporter.Log(e.Message); // reflection + another thread. Needs to go 2 level down. // except when it times out result.Exception = e.InnerException == null ? e : e.InnerException.InnerException; if (e.InnerException != null && e.InnerException.InnerException != null && e.InnerException.InnerException.GetType().Name == "InconclusiveException") { result.Status = Status.Skipped; } else { result.Status = Status.Failed; } foreach (var listener in _listeners) { if (result.Status == Status.Skipped) { try { listener.OnTestSkipped(instance, result); } catch (Exception tle) { result.Log("WARNING. A OnTestSkipped() listener skipped with the following message :" + tle.Message); } } else { try { listener.OnTestFailed(instance, result); } catch (Exception tle) { result.Log("WARNING. A OnTestFailed() listener failed with the following error :" + tle.Message); } } } } finally { // TODO freynaud the order needs to be reversed. First listener executed last makes more sense. foreach (var listener in _listeners) { try { listener.OnTestFinished(instance, result); } catch (Exception e) { Runner.Log("OnTestFinished ERROR " + e); } } } result.StopWatch(); TestResultReporter.Clear(); return(result); }