public void AddEducation(string education) { educationPage.Add.Click(); educationPage.Level.SendKeys(education); educationPage.Save.Click(); if (String.IsNullOrEmpty(educationPage.SuccessfullySaved.GetTextValue().Trim())) { ObjReport.Pass("Validate Successfully Saved Message.", educationPage.SuccessfullySaved.Text.Trim()); } var actualEducation = educationPage.GetEducation("Level", CellPosition.VALUE_BASE, education, IsHyperLink: true).Text; validation.VerifyText(education, actualEducation, "Validate Education Level Added Successfully."); webDriver.WaitForAjax(); webDriver.WaitForPage(); }
public void EnsureSatisfied(string passMessage, string failMessage) { if (!this.IsSatisfied) { if (this.lastException != null) { failMessage += "\n ***** Check inner waiter exception. *****\n"; } //ObjReport.Error(failMessage, new TimeoutException(failMessage, this.lastException).Message); throw new TimeoutException(failMessage, this.lastException); } else { ObjReport.Pass(passMessage); } }
public void VerifyErrorMessage(ErrorMessageType errorMessageType, string userName, string password) { ObjReport.Info("Verify Page Url and Text before Login"); validation.VerifyPageText(ObjLoginPage.pageSource); validation.VerifyPageUrl(ObjLoginPage.pageUrl); if (errorMessageType.Equals(ErrorMessageType.UserNameEmpty)) { ObjLoginPage.Password.SendKeys(password); ObjLoginPage.Login.Submit(); WaitForErrorMessage(); Assert.AreEqual(ErrorMessageType.UserNameEmpty.GetDescription(), ObjLoginPage.ErrorMessage, "Error Message is not matched."); var info = "Expected Error Msg: " + ErrorMessageType.UserNameEmpty.GetDescription() + "\t" + "Actual Error Msg: " + ObjLoginPage.ErrorMessage; ObjReport.Pass("Verify User Empty Error Message", info); } if (errorMessageType.Equals(ErrorMessageType.PasswordEmpty)) { Logger.Info("Verify Password Empty Error Message"); ObjLoginPage.UserName.SendKeys(userName); ObjLoginPage.Login.Submit(); WaitForErrorMessage(); Assert.AreEqual(ErrorMessageType.PasswordEmpty.GetDescription(), ObjLoginPage.ErrorMessage, "Error Message is not matched."); var info = "Expected Error Msg: " + ErrorMessageType.UserNameEmpty.GetDescription() + "\t" + "Actual Error Msg: " + ObjLoginPage.ErrorMessage; ObjReport.Pass("Verify Password Empty Error Message", info); } if (errorMessageType.Equals(ErrorMessageType.InvalidCredentials)) { Logger.Info("Verify Invalid Credentials Error Message"); ObjLoginPage.UserName.SendKeys(userName); ObjLoginPage.Password.SendKeys(password); ObjLoginPage.Login.Submit(); WaitForErrorMessage(); Assert.AreEqual(ErrorMessageType.InvalidCredentials.GetDescription(), ObjLoginPage.ErrorMessage, "Error Message is not matched."); var info = "Expected Error Msg: " + ErrorMessageType.UserNameEmpty.GetDescription() + "\t" + "Actual Error Msg: " + ObjLoginPage.ErrorMessage; ObjReport.Pass("Verify Invalid Credentials Error Message", info); } ObjReport.Info("Verify Page Url and Text After Login"); validation.VerifyPageText(ObjLoginPage.pageSource); validation.VerifyPageUrl(ObjLoginPage.pageUrl); }