Class Parameters


  • public class Parameters
    extends Object
    • Constructor Detail

      • Parameters

        public Parameters()
    • Method Detail

      • setDebug

        public static void setDebug​(boolean isDebug)
        Turns debugging info on/off
        Parameters:
        isDebug - true if debugging info should be turned on, false otherwise
      • isDebug

        public static boolean isDebug()
        Returns:
        true if debugging info should be shown, false otherwise
      • setScreenshotComparisonCursorDetection

        public static void setScreenshotComparisonCursorDetection​(boolean isScreenshotComparisonCursorDetection)
        Turns cursor detection on/off when comparing screen shots. If on, the screen shot comparison will pass if the only difference is a text input cursor.
        Parameters:
        isScreenshotComparisonCursorDetection - true to enable cursor detection
      • isScreenshotComparisonCursorDetection

        public static boolean isScreenshotComparisonCursorDetection()
        Tells whether to treat screen shots with the only difference being a text input cursor as equal or not. If true, they will be treated as equal.
        Returns:
        true if cursor detection is used, false otherwise
      • setScreenshotReferenceDirectory

        public static void setScreenshotReferenceDirectory​(String screenshotReferenceDirectory)
        Sets the directory to search for reference images.
        Parameters:
        screenshotReferenceDirectory - the directory to search for reference images
      • getScreenshotReferenceDirectory

        public static String getScreenshotReferenceDirectory()
        Returns:
        the directory to search for reference images.
      • setScreenshotErrorDirectory

        public static void setScreenshotErrorDirectory​(String screenshotErrorDirectory)
        Sets the directory where error screen shots are stored.
        Parameters:
        screenshotErrorDirectory - the directory path
      • getScreenshotErrorDirectory

        public static String getScreenshotErrorDirectory()
        Returns:
        the directory where error screen shots are stored.
      • setScreenshotComparisonTolerance

        public static void setScreenshotComparisonTolerance​(double tolerance)
        Sets the error tolerance for screen shot comparisons. The tolerance is a value between 0 and 1, where 0 means that the images must be a pixel perfect match and 1 means that any changes are accepted.
        Parameters:
        tolerance - the error tolerance.
      • getScreenshotComparisonTolerance

        public static double getScreenshotComparisonTolerance()
        Returns:
        the error tolerance to use for screen shots. The default tolerance is 0.01
      • setMaxScreenshotRetries

        public static void setMaxScreenshotRetries​(int maxRetries)
        Sets the maximum allowed retries when comparing screen shots. This is useful since in some situations it might take a little bit longer for all the elements to settle into place.
        Parameters:
        maxRetries - the maximum number of retries for screenshot comparisons
      • getMaxScreenshotRetries

        public static int getMaxScreenshotRetries()
        Returns:
        the maximum amount of times to retry screen shot comparison.
      • setScreenshotRetryDelay

        public static void setScreenshotRetryDelay​(int retryDelay)
        Sets the delay between screen shot comparison retries. The default is 500 milliseconds.
        Parameters:
        retryDelay - the delay in milliseconds.
      • getScreenshotRetryDelay

        public static int getScreenshotRetryDelay()
        Returns:
        the delay between screen shot comparison retries.
      • setTestsInParallel

        public static void setTestsInParallel​(int testsInParallel)
        Sets the maximum number of tests to run in parallel.
        Parameters:
        testsInParallel - maximum number of tests to run in parallel.
      • getTestsInParallel

        public static int getTestsInParallel()
        Returns:
        maximum number of tests to run in parallel.
      • setTestSuitesInParallel

        public static void setTestSuitesInParallel​(int testSuitesInParallel)
        Sets the maximum number of test suites to run in parallel.
        Parameters:
        testSuitesInParallel - maximum number of testSuites to run in parallel.
      • getTestSuitesInParallel

        public static int getTestSuitesInParallel()
        Returns:
        maximum number of test suites to run in parallel.
      • getHubHostname

        public static String getHubHostname()
        Gets host name of the hub to run tests on.

        This will override any @RunOnHub annotation present on the test class.

        Returns:
        the host name of the hub, or null if no host name has been defined
      • getRunLocallyBrowserName

        public static String getRunLocallyBrowserName()
        Gets the name of the browser to use for a local test.

        Reads the value from the com.vaadin.testbench.Parameters.runLocally system property. If the parameter is defined, it will override any @RunLocally annotation.

        The format of the system property is "[browsername]" or "[browsername]-[version]" where the version is optional.

        If the system property is defined, the test will be run locally and not on a hub. The property effectively does the same thing as a @RunLocally annotation on the test class.

        Returns:
        the browser name read from the system property, or null if it has not been set
      • getRunLocallyBrowserVersion

        public static String getRunLocallyBrowserVersion()
        Gets the version of the browser to use for a local test.

        Reads the value from the com.vaadin.testbench.Parameters.runLocally system property. If the parameter is defined, it will override any @RunLocally annotation.

        The format of the system property is "[browsername]" or "[browsername]-[version]" where the version is optional.

        Returns:
        the browser version read from the system property, or null if it has not been set
      • isLocalWebDriverUsed

        public static boolean isLocalWebDriverUsed()
      • getMaxAttempts

        public static int getMaxAttempts()
        Gets the maximum number of times to run the test in case of a random failure. See RetryRule for details.
        Returns:
        maximum attempts the test can be run.
      • setMaxAttempts

        public static void setMaxAttempts​(int maxAttempts)
        Sets the maximum number of times to run the test in case of a random failure
        Parameters:
        maxAttempts - maximum attempts the test can be run.
      • getGridBrowsersString

        public static String getGridBrowsersString()
        Returns:
        The configuration string of browsers (and their versions) as a comma separated list. Defaults to null string.
      • getGridBrowsers

        public static List<org.openqa.selenium.remote.DesiredCapabilities> getGridBrowsers()
        Parses the grid browsers string and returns a new List of DesiredCapabilities
        Returns:
        a list of DesiredCapabilities based on getGridBrowsersString. Empty list if nothing configured.
      • setGridBrowsers

        public static void setGridBrowsers​(String browsers)
        Sets the default browsers used in test grid if not overridden in a ParallelTest
        Parameters:
        browsers - comma separated list of browsers e.g. "chrome,safari-9,firefox-53"
      • isHeadless

        public static boolean isHeadless()
        Checks if requested to run browsers in headless mode when runnning on a local machine using a browser supporting it (currently Chrome and Firefox).
        Returns:
        true, if requested to run in headless mode, false otherwise
      • setHeadless

        public static void setHeadless​(boolean headless)
        Sets whether to run browsers in headless mode when runnning on a local machine using a browser supporting it (currently Chrome and Firefox).
        Parameters:
        headless - true, to run in headless mode, false otherwise
      • setReadTimeout

        public static void setReadTimeout​(int readTimeout)
        Sets the time to wait for a response to a command sent to a remote web driver.

        If you are running on a hub that limits the number of concurrent sessions and you are requesting more sessions than that, your session request might time out before the hub responds with a new session. In this case, you can increase this timeout to make it wait longer.

        Note that this value must be set before a remote web driver is created, which typically happens during the "before" phase of a unit test.

        Parameters:
        readTimeout - the timeout in seconds
      • getReadTimeout

        public static int getReadTimeout()
        Gets the time to wait for a response to a command sent to a remote web driver.
        Returns:
        the timeout in seconds