Class WebDriverFixtures<SELF extends WebDriverFixtures<SELF>>

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

    @ThreadSafe
    public class WebDriverFixtures<SELF extends WebDriverFixtures<SELF>>
    extends dev.aherscu.qa.jgiven.commons.steps.GenericFixtures<WebDriverScenarioType,​SELF>
    Generic web driver fixtures. If WebDriver's capabilities contain AUTO_QUIT, then closes the WebDriver by end of scenario.
    Author:
    aherscu
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String AUTO_QUIT
      Add to capabilities in order to automatically quit the web driver by end of scenario; value does not matter.
      protected ThreadLocal<dev.aherscu.qa.jgiven.commons.utils.WebDriverEx> webDriver
      The given Web Driver.
      • 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 a_web_driver​(dev.aherscu.qa.jgiven.commons.utils.WebDriverEx webDriver)
      Sets a web driver for this scenario.
      SELF at​(String applicationUrl)
      Opens Web application at specified host if not already open.
      protected SELF context​(Predicate<String> byRule)
      Switches to specified Appium context.
      protected org.openqa.selenium.WebElement scrollIntoView​(org.openqa.selenium.WebElement element)
      Scrolls specified element into view.
      protected dev.aherscu.qa.jgiven.commons.utils.WebDriverEx thisWebDriver()  
      • Methods inherited from class dev.aherscu.qa.jgiven.commons.steps.GenericFixtures

        nothing
      • Methods inherited from class dev.aherscu.qa.jgiven.commons.utils.StageEx

        alert, attach, attachScreenshot, attachScreenshot, attachScreenshot, beforeScenarioConfigurePolling, 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

      • AUTO_QUIT

        public static final String AUTO_QUIT
        Add to capabilities in order to automatically quit the web driver by end of scenario; value does not matter.
        See Also:
        Constant Field Values
      • webDriver

        @ProvidedScenarioState
        protected final ThreadLocal<dev.aherscu.qa.jgiven.commons.utils.WebDriverEx> webDriver
        The given Web Driver.
    • Constructor Detail

      • WebDriverFixtures

        public WebDriverFixtures()
    • Method Detail

      • a_web_driver

        @NestedSteps
        public SELF a_web_driver​(dev.aherscu.qa.jgiven.commons.utils.WebDriverEx webDriver)
        Sets a web driver for this scenario. If it has has a capability named AUTO_QUIT, then it will automatically quit after scenario.
        Parameters:
        webDriver - the driver
        Returns:
        StageBase.self()
        Throws:
        NullPointerException - if the driver reference was null
      • at

        public SELF at​(String applicationUrl)
        Opens Web application at specified host if not already open.
        Parameters:
        applicationUrl - the location of the application
        Returns:
        StageBase.self()
      • context

        @Hidden
        protected SELF context​(Predicate<String> byRule)
        Switches to specified Appium context.
        Parameters:
        byRule - naming rule of Appium context
        Returns:
        StageBase.self()
        Throws:
        org.openqa.selenium.NoSuchContextException - if no such context exists
      • 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 WebDriverFixtures<SELF>>
        Parameters:
        element - the element to scroll into view
        Returns:
        the element
      • thisWebDriver

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