Class WebDriverVerifications<SELF extends WebDriverVerifications<SELF>>

  • Type Parameters:
    SELF - the type of the subclass
    All Implemented Interfaces:
    dev.aherscu.qa.jgiven.commons.model.ScenarioType<WebDriverScenarioType>, dev.aherscu.qa.jgiven.commons.utils.MayAttachScreenshots<SELF>

    @ThreadSafe
    public class WebDriverVerifications<SELF extends WebDriverVerifications<SELF>>
    extends dev.aherscu.qa.jgiven.commons.steps.GenericVerifications<WebDriverScenarioType,​SELF>
    implements dev.aherscu.qa.jgiven.commons.utils.MayAttachScreenshots<SELF>
    Generic browser verifications.
    Author:
    aherscu
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ThreadLocal<dev.aherscu.qa.jgiven.commons.utils.WebDriverEx> webDriver
      Expected browser object.
      • Fields inherited from class dev.aherscu.qa.jgiven.commons.utils.StageEx

        assertElementTimer, ATTACHEMENT_TRANSFORMER, clickTimer, currentStep, locateTimer, pollDelay, pollTimeout, retryPolicy, scrollIntoViewTimer, sendKeysTimer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SELF attaching_screenshot()  
      SELF attaching_screenshot​(int delayMs)  
      protected org.openqa.selenium.WebElement element​(org.openqa.selenium.By locator)
      Finds an element by specified locator and brings it into view.
      SELF element​(org.openqa.selenium.By locator, org.hamcrest.Matcher<org.openqa.selenium.WebElement> matcher)
      Verifies that a specific element matches given criteria.
      protected List<org.openqa.selenium.WebElement> elements​(org.openqa.selenium.By locator)
      Finds all elements matching specified locator.
      SELF elements​(org.openqa.selenium.By locator, org.hamcrest.Matcher<Iterable<org.openqa.selenium.WebElement>> matcher)
      Verifies that a specific set of elements matches given criteria.
      protected org.openqa.selenium.WebElement scrollIntoView​(org.openqa.selenium.WebElement element)
      Scrolls specified element into view.
      SELF the_application​(org.hamcrest.Matcher<io.appium.java_client.appmanagement.ApplicationState> matcher, String appId)
      Verifies application state matches specified criteria.
      SELF the_title​(org.hamcrest.Matcher<String> expected)
      Verifies the title is as expected.
      protected dev.aherscu.qa.jgiven.commons.utils.WebDriverEx thisWebDriver()  
      • Methods inherited from class dev.aherscu.qa.jgiven.commons.steps.GenericVerifications

        beforeScenarioConfigurePolling, eventually, eventually, eventually_assert_that, should_succeed, the_file_$_should_contain, the_file_$_should_match, the_JSON_file_$_should_contain
      • Methods inherited from class dev.aherscu.qa.jgiven.commons.utils.StageEx

        alert, attach, attachScreenshot, attachScreenshot, attachScreenshot, context, element, elements, ensureElements, retry, safely
      • Methods inherited from class com.tngtech.jgiven.Stage

        and, but, comment, given, then, when, with
      • Methods inherited from class com.tngtech.jgiven.base.StageBase

        $, $, self
    • Field Detail

      • webDriver

        @ExpectedScenarioState
        protected ThreadLocal<dev.aherscu.qa.jgiven.commons.utils.WebDriverEx> webDriver
        Expected browser object.
    • Constructor Detail

      • WebDriverVerifications

        public WebDriverVerifications()
    • Method Detail

      • attaching_screenshot

        @Hidden
        public SELF attaching_screenshot()
        Specified by:
        attaching_screenshot in interface dev.aherscu.qa.jgiven.commons.utils.MayAttachScreenshots<SELF extends WebDriverVerifications<SELF>>
      • attaching_screenshot

        @Hidden
        public SELF attaching_screenshot​(int delayMs)
        Specified by:
        attaching_screenshot in interface dev.aherscu.qa.jgiven.commons.utils.MayAttachScreenshots<SELF extends WebDriverVerifications<SELF>>
      • element

        public SELF element​(org.openqa.selenium.By locator,
                            org.hamcrest.Matcher<org.openqa.selenium.WebElement> matcher)
        Verifies that a specific element matches given criteria.
        Parameters:
        locator - the element to look for
        matcher - the criteria
        Returns:
        StageBase.self()
        Throws:
        org.openqa.selenium.NoSuchElementException - if the element does not exist
      • elements

        public SELF elements​(org.openqa.selenium.By locator,
                             org.hamcrest.Matcher<Iterable<org.openqa.selenium.WebElement>> matcher)
        Verifies that a specific set of elements matches given criteria.
        Parameters:
        locator - the elements to look for
        matcher - the criteria
        Returns:
        StageBase.self()
      • the_application

        public SELF the_application​(org.hamcrest.Matcher<io.appium.java_client.appmanagement.ApplicationState> matcher,
                                    String appId)
        Verifies application state matches specified criteria.
        Parameters:
        matcher - verification criteria
        appId - application identifier
        Returns:
        StageBase.self()
      • the_title

        public SELF the_title​(org.hamcrest.Matcher<String> expected)
        Verifies the title is as expected.
        Parameters:
        expected - the expected title
        Returns:
        StageBase.self()
      • element

        @Hidden
        protected org.openqa.selenium.WebElement element​(org.openqa.selenium.By locator)
        Finds an element by specified locator and brings it into view. If the locator is matching multiple elements then the first one is returned.

        locateTimer metric will be updated not including the scrolling into view.

        Parameters:
        locator - the locator
        Returns:
        the element
        Throws:
        org.openqa.selenium.NoSuchElementException - If no matching elements are found
      • elements

        protected List<org.openqa.selenium.WebElement> elements​(org.openqa.selenium.By locator)
        Finds all elements matching specified locator.

        locateTimer metric will be updated not including the scrolling into view.

        Parameters:
        locator - the locator
        Returns:
        the element
      • scrollIntoView

        protected org.openqa.selenium.WebElement scrollIntoView​(org.openqa.selenium.WebElement element)
        Scrolls specified element into view.

        scrollIntoView metric will be updated.

        Overrides:
        scrollIntoView in class dev.aherscu.qa.jgiven.commons.utils.StageEx<SELF extends WebDriverVerifications<SELF>>
        Parameters:
        element - the element to scroll into view
        Returns:
        the element
      • thisWebDriver

        protected final dev.aherscu.qa.jgiven.commons.utils.WebDriverEx thisWebDriver()