public void CheckFormInputAndSubmitElements() { CustomLogs.startTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); try { HomePage homePage = HomePage; FormPage formPage = homePage.ClickOnFormBtn(); Assert.IsTrue(formPage.CheckIfFormInputIsDisplayed()); Assert.IsTrue(formPage.CheckIfSubmitBtnIsDisplayed()); } catch (AssertFailedException afe) { CustomLogs.warn(afe.Message); throw new AssertFailedException(afe.Message); } catch (NoSuchElementException nsee) { CustomLogs.error(nsee.Message); throw new NoSuchElementException(nsee.Message); } catch (Exception exc) { CustomLogs.error(exc.Message + exc.StackTrace); throw new Exception(exc.Message); } finally { CustomLogs.endTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); } }
public void CheckParagraphMessageFromHomePage() { CustomLogs.startTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); try { HomePage homePage = HomePage; homePage.ClickOnHomeBtn(); Assert.IsTrue(homePage.checkHomeParagraphMessage()); } catch (AssertFailedException afe) { CustomLogs.warn(afe.Message); throw new AssertFailedException(afe.Message); } catch (NoSuchElementException nsee) { CustomLogs.error(nsee.Message); throw new NoSuchElementException(nsee.Message); } catch (Exception exc) { CustomLogs.error(exc.Message + exc.StackTrace); throw new Exception(exc.Message); } finally { CustomLogs.endTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); } }
public void ValidateHomePage() { CustomLogs.startTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); try { HomePage homePage = new HomePage(chrome, "home"); Assert.IsTrue(homePage.checkWelcomeMessage()); } catch (AssertFailedException afe) { CustomLogs.warn(afe.Message); throw new AssertFailedException(afe.Message); } catch (NoSuchElementException nsee) { CustomLogs.error(nsee.Message); throw new NoSuchElementException(nsee.Message); } catch (Exception exc) { CustomLogs.error(exc.Message + exc.StackTrace); throw new Exception(exc.Message); } finally { CustomLogs.endTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); } }
public void CheckUITestingMenuButton() { CustomLogs.startTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); try { HomePage homePage = HomePage; homePage.ClickOnUITestingBtn(); } catch (AssertFailedException afe) { CustomLogs.warn(afe.Message); throw new AssertFailedException(afe.Message); } catch (NoSuchElementException nsee) { CustomLogs.error(nsee.Message); throw new NoSuchElementException(nsee.Message); } catch (Exception exc) { CustomLogs.error(exc.Message + exc.StackTrace); throw new Exception(exc.Message); } finally { CustomLogs.endTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); } }
/// <summary> /// This method set up the 'Name' input field and clicks on 'Go' button /// </summary> /// <param name="inputValue">Enter the input value (prefered: name)</param> /// <returns>Returns the 'HelloPage' object type created</returns> public HelloPage SetUpInputValueAndClickGo(string inputValue) { helloInput.Clear(); helloInput.SendKeys(inputValue); CustomLogs.info(string.Format("The name '{0}' was typed in the input field", inputValue)); submitBtn.Click(); CustomLogs.info("'Go' button was pressed"); return(HelloPage(inputValue)); }
public ErrorPage(RemoteWebDriver driver) { _webDriver = driver; errorPage_identifier = string.Format("//h1[contains(text(),'404 Error')]"); ////title[contains(text(),'404 Error')] ??pageName??? #region Search Criteria _webDriver.FindElementByXPath(errorPage_identifier); ////Initialise Elements PageFactory.InitElements(_webDriver, this); CustomLogs.info("Error page was loaded."); #endregion }
public FormPage(RemoteWebDriver driver, string pageName) : base(driver, pageName) { _webDriver = driver; formPage_identifier = string.Format("li[class='active'] > a[id='{0}']", pageName); #region Search Criteria _webDriver.FindElementByCssSelector(formPage_identifier); ////Initialise Elements PageFactory.InitElements(_webDriver, this); CustomLogs.info("Form page was loaded. Page status = active"); #endregion }
public HelloPage(RemoteWebDriver driver, string nameTyped) : base(driver, nameTyped) { _webDriver = driver; helloPage_identifier = string.Format("//h1[@id='hello-text' and text()='Hello {0}!']", nameTyped); #region Search Criteria try { WaitUntilIsVisible(1500, By.XPath(helloPage_identifier)); _webDriver.FindElementByXPath(helloPage_identifier); CustomLogs.info("Hello Page was loaded."); } catch (NoSuchElementException) { throw new NoSuchElementException(string.Format("Hello Page does not contains the expected text message! Expected text: 'Hello {0}!' - Actual text: '{1}'", nameTyped, ReturnHelloText)); } #endregion }
/// <summary> /// This method validates the message from the Home Page paragraph! /// </summary> /// <returns>Returns true in case that the welcome page meet the requirements</returns> public bool checkHomeParagraphMessage() { try { if (paragraphMsg.Text.Equals(_paragraphMsg)) { CustomLogs.info("The paragraph message from the Home Page is displayed"); return(paragraphMsg.Displayed); } else { throw new NoSuchElementException(string.Format("The <p> (paragraph) element does not contains the expected text message! Actual Message: '{0}'", paragraphMsg.Text)); } } catch (NoSuchElementException) { throw new NoSuchElementException("The <p> (paragraph) element does not exists on Home Page!"); } }
public void CheckTitleOfallPages() { CustomLogs.startTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); try { HomePage homePage = new HomePage(chrome, "home"); Assert.IsTrue(homePage.checkPageName()); homePage.ClickOnUITestingBtn(); Assert.IsTrue(homePage.checkPageName()); FormPage formPage = homePage.ClickOnFormBtn(); Assert.IsTrue(formPage.checkPageName()); homePage = formPage.ClickOnHomeBtn(); Assert.IsTrue(homePage.checkPageName()); } catch (AssertFailedException afe) { CustomLogs.warn(afe.Message); throw new AssertFailedException(afe.Message); } catch (NoSuchElementException nsee) { CustomLogs.error(nsee.Message); throw new NoSuchElementException(nsee.Message); } catch (Exception exc) { CustomLogs.error(exc.Message + exc.StackTrace); throw new Exception(exc.Message); } finally { CustomLogs.endTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); } }
public void CheckHelloPage() { CustomLogs.startTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); try { HomePage homePage = HomePage; FormPage formPage = homePage.ClickOnFormBtn(); foreach (string name in nameList) { HelloPage hello = formPage.SetUpInputValueAndClickGo(name); hello.checkIfCompanyLogoIsDisplayed(); hello.ReturnToFormPage(); } } catch (AssertFailedException afe) { CustomLogs.warn(afe.Message); throw new AssertFailedException(afe.Message); } catch (NoSuchElementException nsee) { CustomLogs.error(nsee.Message); throw new NoSuchElementException(nsee.Message); } catch (Exception exc) { CustomLogs.error(exc.Message + exc.StackTrace); throw new Exception(exc.Message); } finally { CustomLogs.endTestCase(System.Reflection.MethodBase.GetCurrentMethod().Name); } }
public void Init() { CustomLogs.SetupLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); chrome = (ChromeDriver)BrowserFactory.getChromeBrowser(); chrome.Navigate().GoToUrl(uitestDoclerSite); }