com.vaadin.testbench.

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 -

      • isDebug

        public static boolean isDebug()

        Returns:

        true if debugging info is to be shown

      • 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 -

      • 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

      • setScreenshotReferenceDirectory

        public static void setScreenshotReferenceDirectory(String screenshotReferenceDirectory)

        Sets the directory to search for reference images.

        Parameters:

        screenshotReferenceDirectory -

      • 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 -

      • 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

      • setCaptureScreenshotOnFailure

        @Deprecated
        public static void setCaptureScreenshotOnFailure(boolean isCaptureScreenshotOnFailure)

        Deprecated. This does nothing, use ScreenshotOnFailureRule

        Sets whether to capture a screen shot when a test fails or not.

        Parameters:

        isCaptureScreenshotOnFailure -

        Throws:

        UnsupportedOperationException

      • 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 -

      • 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.

      • setMaxThreads

        @Deprecated
        public static void setMaxThreads(int maxThreads)

        Deprecated. Use setTestsInParallel(int)

        Sets the maximum number of tests to run in parallel.

        Parameters:

        maxThreads - maximum number of tests to run in parallel.

      • 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. "ie11,chrome,safari-9,firefox-53"