Interface E2ETestHelperMixin

    • Method Detail

      • assertConformingHtml

        default void assertConformingHtml​(String html)
                                   throws de.xima.nu_validator.wrapper.bridge.api.NuValidatorException
        Asserts the given HTML is W3C conform, without any errors, warnings or fatal errors.
        Parameters:
        html - The HTML to validate.
        Throws:
        de.xima.nu_validator.wrapper.bridge.api.NuValidatorException - When the HTML could not be validated.
      • assertConformingHtml

        default void assertConformingHtml​(String html,
                                          Consumer<de.xima.nu_validator.wrapper.common.api.INuValidatorOptionsBuilder> configurator)
                                   throws de.xima.nu_validator.wrapper.bridge.api.NuValidatorException
        Asserts the given HTML is W3C conform, without any errors, warnings or fatal errors.
        Parameters:
        html - The HTML to validate.
        configurator - Configurator for the options to use for validation.
        Throws:
        de.xima.nu_validator.wrapper.bridge.api.NuValidatorException - When the HTML could not be validated.
      • assertConformingHtml

        default void assertConformingHtml​(String html,
                                          de.xima.nu_validator.wrapper.bridge.api.INuValidator validator,
                                          Consumer<de.xima.nu_validator.wrapper.common.api.INuValidatorOptionsBuilder> configurator)
                                   throws de.xima.nu_validator.wrapper.bridge.api.NuValidatorException
        Asserts the given HTML is W3C conform, without any errors, warnings or fatal errors.
        Parameters:
        html - The HTML to validate.
        validator - Validator to use for validation.
        configurator - Configurator for the options to use for validation.
        Throws:
        de.xima.nu_validator.wrapper.bridge.api.NuValidatorException - When the HTML could not be validated.
      • assertConformingHtml

        default void assertConformingHtml​(org.openqa.selenium.WebDriver driver,
                                          Consumer<de.xima.nu_validator.wrapper.common.api.INuValidatorOptionsBuilder> configurator)
                                   throws de.xima.nu_validator.wrapper.bridge.api.NuValidatorException
        Gets the HTML from the currently open page, and asserts the given HTML is W3C conform, without any errors, warnings or fatal errors.
        Parameters:
        driver - The driver to use for getting the HTML.
        configurator - Configurator for the options to use for validation.
        Throws:
        de.xima.nu_validator.wrapper.bridge.api.NuValidatorException - When the HTML could not be validated.
      • assertConformingHtml

        default void assertConformingHtml​(org.openqa.selenium.WebDriver driver,
                                          de.xima.nu_validator.wrapper.bridge.api.INuValidator validator,
                                          Consumer<de.xima.nu_validator.wrapper.common.api.INuValidatorOptionsBuilder> configurator)
                                   throws de.xima.nu_validator.wrapper.bridge.api.NuValidatorException
        Gets the HTML from the currently open page, and asserts the given HTML is W3C conform, without any errors, warnings or fatal errors.
        Parameters:
        driver - The driver to use for getting the HTML.
        validator - Validator to use for validation.
        configurator - Configurator for the options to use for validation.
        Throws:
        de.xima.nu_validator.wrapper.bridge.api.NuValidatorException - When the HTML could not be validated.
      • assertConformingHtml

        default void assertConformingHtml​(de.xima.e2e.test_harness_selenium.bot.api.ISeleniumBot bot,
                                          Consumer<de.xima.nu_validator.wrapper.common.api.INuValidatorOptionsBuilder> configurator)
                                   throws de.xima.nu_validator.wrapper.bridge.api.NuValidatorException
        Gets the HTML from the currently open page, and asserts the given HTML is W3C conform, without any errors, warnings or fatal errors.
        Parameters:
        bot - The browser bot to use for getting the HTML.
        configurator - Configurator for the options to use for validation.
        Throws:
        de.xima.nu_validator.wrapper.bridge.api.NuValidatorException - When the HTML could not be validated.
      • assertConformingHtml

        default void assertConformingHtml​(de.xima.e2e.test_harness_selenium.bot.api.ISeleniumBot bot,
                                          de.xima.nu_validator.wrapper.bridge.api.INuValidator validator,
                                          Consumer<de.xima.nu_validator.wrapper.common.api.INuValidatorOptionsBuilder> configurator)
                                   throws de.xima.nu_validator.wrapper.bridge.api.NuValidatorException
        Gets the HTML from the currently open page, and asserts the given HTML is W3C conform, without any errors, warnings or fatal errors.
        Parameters:
        bot - The browser bot to use for getting the HTML.
        validator - Validator to use for validation.
        configurator - Configurator for the options to use for validation.
        Throws:
        de.xima.nu_validator.wrapper.bridge.api.NuValidatorException - When the HTML could not be validated.
      • assertContains

        default void assertContains​(Object expectedItem,
                                    Iterable<?> actualItems)
        Asserts that the given items contain the expected item.
        Parameters:
        expectedItem - Expected item.
        actualItems - Actual items.
      • assertContains

        default void assertContains​(String expectedSubstring,
                                    String actualText)
        Asserts that the given text contains the expected substring.
        Parameters:
        expectedSubstring - Expected substring.
        actualText - Actual text content.
      • assertMimeTypeEquals

        default void assertMimeTypeEquals​(String expected,
                                          HttpResponse<?> actual)
                                   throws javax.activation.MimeTypeParseException
        Asserts that the expected mime type equals the mime type of the given response.

        This method parses the MIME type and compares its parts. This ensures that formatting differences such as text/plain; charset=utf8; foo=bar vs text/plain;foo=bar;charset=utf8 do not affect the assertion.

        Parameters:
        expected - Expected MIME type.
        actual - Actual MIME type.
        Throws:
        javax.activation.MimeTypeParseException - When the given strings do not conform to the MIME type format.
      • assertMimeTypeEquals

        default void assertMimeTypeEquals​(String expected,
                                          String actual)
                                   throws javax.activation.MimeTypeParseException
        Asserts that the expected mime type equals the actual mime type.

        This method parses the MIME type and compares its parts. This ensures that formatting differences such as text/plain; charset=utf8; foo=bar vs text/plain;foo=bar;charset=utf8 do not affect the assertion.

        Parameters:
        expected - Expected MIME type.
        actual - Actual MIME type.
        Throws:
        javax.activation.MimeTypeParseException - When the given strings do not conform to the MIME type format.
      • checksum

        default String checksum​(MessageDigest digest,
                                InputStream in)
                         throws IOException
        Parameters:
        digest - Checksum algorithm to use.
        in - Input stream to read.
        Returns:
        The checksum of the data from the input stream.
        Throws:
        IOException - When the input stream could not be read.
      • checksum

        default String checksum​(MessageDigest digest,
                                com.codeborne.selenide.SelenideElement element)
                         throws FileNotFoundException,
                                IOException
        Downloads the file from the element and returns its checksum.
        Parameters:
        digest - Checksum algorithm to use.
        element - Element with a download.
        Returns:
        The checksum of the file from the element.
        Throws:
        FileNotFoundException - When the element does not have a file to download.
        IOException - When the file could not be downloaded.
      • createClientWithPluginAndForms

        default IFormcycleAppState createClientWithPluginAndForms​(IFormcycleProvisioner provisioner,
                                                                  String... forms)
                                                           throws Exception
        Creates a new client, installs the plugin, and imports all given forms. This method assumes that you follow the standard conventions as outlined below, use createClientWithPluginAndForms(IFormcycleProvisioner, URI, URI...) if you do not do so.

        All forms must have a file name that ends on .xfp, and must be placed in a folder name forms, and must be available as a class path resource. Usually that means you should create files like

         src/test/resources/forms/some-form.xfp
         src/test/resources/forms/another-form.xfp
         
        You must set a system property named plugin.path that contains the path to the plugin JAR. Optionally, you can also set a system property named plugin.properties with the path to the properties file containing the configuration for the plugin. Usually you would do this within the failsafe-maven-plugin section of the Maven pom like this:
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-failsafe-plugin</artifactId>
           <version>${maven-failsafe-plugin.version}</version>
           <executions>
             <execution>
               <id>default-e2e-test</id>
               <goals>
                 <goal>integration-test</goal>
               </goals>
               <configuration>
                 <systemPropertyVariables>
                   <plugin.path>${project.build.directory}/${project.artifactId}.jar</plugin.path>
                   <plugin.properties>${project.basedir}/src/test/resources/plugin-test.properties</plugin.properties>
                 </systemPropertyVariables>
               </configuration>
             </execution>
           </executions>
         </plugin>
         
        Parameters:
        provisioner - Provisioner to use for performing the setup actions.
        forms - List of forms to install. Must
        Returns:
        The result of the setup actions. Includes the ID of the created client.
        Throws:
        Exception - When the setup actions could not be performed.
      • createClientWithPluginAndForms

        default IFormcycleAppState createClientWithPluginAndForms​(IFormcycleProvisioner provisioner,
                                                                  Properties pluginProperties,
                                                                  String... forms)
                                                           throws Exception
        Creates a new client, installs the plugin, and imports all given forms. This method assumes that you follow the standard conventions as outlined below, use createClientWithPluginAndForms(IFormcycleProvisioner, URI, URI...) if you do not do so.

        All forms must have a file name that ends on .xfp, and must be placed in a folder name forms, and must be available as a class path resource. Usually that means you should create files like

         src/test/resources/forms/some-form.xfp
         src/test/resources/forms/another-form.xfp
         
        You must set a system property named plugin.path that contains the path to the plugin JAR. Optionally, you can also set a system property named plugin.properties with the path to the properties file containing the configuration for the plugin. Usually you would do this within the failsafe-maven-plugin section of the Maven pom like this:
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-failsafe-plugin</artifactId>
           <version>${maven-failsafe-plugin.version}</version>
           <executions>
             <execution>
               <id>default-e2e-test</id>
               <goals>
                 <goal>integration-test</goal>
               </goals>
               <configuration>
                 <systemPropertyVariables>
                   <plugin.path>${project.build.directory}/${project.artifactId}.jar</plugin.path>
                   <plugin.properties>${project.basedir}/src/test/resources/plugin-test.properties</plugin.properties>
                 </systemPropertyVariables>
               </configuration>
             </execution>
           </executions>
         </plugin>
         
        Parameters:
        provisioner - Provisioner to use for performing the setup actions.
        pluginProperties - Optional properties with the configuration for the plugin. These are applied on top of the properties from the system property plugin.properties.
        forms - List of forms to install.
        Returns:
        The result of the setup actions. Includes the ID of the created client.
        Throws:
        Exception - When the setup actions could not be performed.
      • createClientWithPluginAndForms

        default IFormcycleAppState createClientWithPluginAndForms​(IFormcycleProvisioner provisioner,
                                                                  URI jarUri,
                                                                  URI... forms)
                                                           throws Exception
        Creates a new client, installs the plugin, and imports all given forms.

        You must set a system property that contains the path t

        Parameters:
        provisioner - Provisioner to use for performing the setup actions.
        jarUri - URI with the plugin to install.
        forms - List of URIs with the forms to import.
        Returns:
        The result of the setup actions. Includes the ID of the created client.
        Throws:
        Exception - When the setup actions could not be performed.
      • createClientWithPluginAndForms

        default IFormcycleAppState createClientWithPluginAndForms​(IFormcycleProvisioner provisioner,
                                                                  URI jarUri,
                                                                  Properties pluginProperties,
                                                                  URI... forms)
                                                           throws Exception
        Creates a new client, installs the plugin, and imports all given forms.

        You must set a system property that contains the path t

        Parameters:
        provisioner - Provisioner to use for performing the setup actions.
        jarUri - URI with the plugin to install.
        pluginProperties - Optional properties with the configuration for the plugin.
        forms - List of URIs with the forms to import.
        Returns:
        The result of the setup actions. Includes the ID of the created client.
        Throws:
        Exception - When the setup actions could not be performed.
      • fetchUriAsBinary

        default HttpResponse<byte[]> fetchUriAsBinary​(URI uri)
                                               throws IOException,
                                                      InterruptedException
        Similar to readUriAsBinary(URI), but uses the native HTTP client to read the contents of the URI via a GET request. Redirect are not followed.
        Parameters:
        uri - URI to read.
        Returns:
        The body of the HTTP response.
        Throws:
        IOException - When the URI could not be accessed.
        InterruptedException - When this thread was interrupted while waiting for the response to the HTTP request.
      • fetchUriAsBinaryFollowingRedirects

        default HttpResponse<byte[]> fetchUriAsBinaryFollowingRedirects​(URI uri)
                                                                 throws IOException,
                                                                        InterruptedException
        Similar to readUriAsBinary(URI), but uses the native HTTP client to read the contents of the URI via a GET request. Redirect are followed.
        Parameters:
        uri - URI to read.
        Returns:
        The body of the HTTP response.
        Throws:
        IOException - When the URI could not be accessed.
        InterruptedException - When this thread was interrupted while waiting for the response to the HTTP request.
      • fetchUriAsText

        default HttpResponse<String> fetchUriAsText​(URI uri)
                                             throws IOException,
                                                    InterruptedException
        Similar to readUriAsText(URI, Charset), but uses the native HTTP client to read the contents of the URI via a GET request. Uses the UTF_8 encoding to decode the data into a string. Redirects are not followed.
        Parameters:
        uri - URI to read.
        Returns:
        The body of the HTTP response, read as a string with the given encoding.
        Throws:
        IOException - When the URI could not be accessed.
        InterruptedException - When this thread was interrupted while waiting for the response to the HTTP request.
      • fetchUriAsText

        default HttpResponse<String> fetchUriAsText​(URI uri,
                                                    Charset charset)
                                             throws IOException,
                                                    InterruptedException
        Similar to readUriAsText(URI, Charset), but uses the native HTTP client to read the contents of the URI via a GET request. Redirects are not followed.
        Parameters:
        uri - URI to read.
        charset - Charset to use for decoding the data to a string.
        Returns:
        The body of the HTTP response, read as a string with the given encoding.
        Throws:
        IOException - When the URI could not be accessed.
        InterruptedException - When this thread was interrupted while waiting for the response to the HTTP request.
      • fetchUriAsTextFollowingRedirects

        default HttpResponse<String> fetchUriAsTextFollowingRedirects​(URI uri,
                                                                      Charset charset)
                                                               throws IOException,
                                                                      InterruptedException
        Similar to readUriAsText(URI, Charset), but uses the native HTTP client to read the contents of the URI via a GET request. Redirects are followed.
        Parameters:
        uri - URI to read.
        charset - Charset to use for decoding the data to a string.
        Returns:
        The body of the HTTP response, read as a string with the given encoding.
        Throws:
        IOException - When the URI could not be accessed.
        InterruptedException - When this thread was interrupted while waiting for the response to the HTTP request.
      • getClasspathResourceAsUri

        default URI getClasspathResourceAsUri​(String path)
                                       throws IllegalArgumentException
        Gets the URI for a given class path resource, using the current loadingClass().
        Parameters:
        path - (Absolute) path of the class path resource.
        Returns:
        A URI pointing to the class path resource.
        Throws:
        IllegalArgumentException - When the resource was not found.
      • loadingClass

        default Class<?> loadingClass()
        Gets the class to use for loading resources. Defaults to this class.
        Returns:
        Class to use for loading resources.
      • md5

        default MessageDigest md5()
        Returns:
        The MD5 checksum algorithm.
      • openClasspathResource

        default InputStream openClasspathResource​(String path)
                                           throws IOException
        Opens an input stream to a class path resource, using the loadingClass().
        Parameters:
        path - (Absolute) path of a class path resource.
        Returns:
        An input stream with the data of the given class path resource.
        Throws:
        IOException - When the input stream could not be opened; or when the resource does not exist.
      • readClasspathResourceAsBinary

        default byte[] readClasspathResourceAsBinary​(String path)
                                              throws IOException
        Reads a class path resource and returns the binary content of the resource.
        Parameters:
        path - (Absolute) path of a class path resource.
        Returns:
        The contents of the resource.
        Throws:
        IOException - When the resource could not be opened or was not found.
      • readClasspathResourceAsText

        default String readClasspathResourceAsText​(String path,
                                                   Charset charset)
                                            throws IOException
        Reads a class path resource and returns the text content of the resource.
        Parameters:
        path - (Absolute) path of a class path resource.
        charset - Charset to use for reading the resource.
        Returns:
        The contents of the resource.
        Throws:
        IOException - When the resource could not be opened or was not found.
      • readClasspathResourceAsText

        default String readClasspathResourceAsText​(String path)
                                            throws IOException
        Reads a class path resource and returns the text content of the resource. Uses the UTF_8 encoding.
        Parameters:
        path - (Absolute) path of a class path resource.
        Returns:
        The contents of the resource.
        Throws:
        IOException - When the resource could not be opened or was not found.
      • readPageSourceViaScript

        default String readPageSourceViaScript​(org.openqa.selenium.WebDriver driver)
        Reads the source HTML of the currently active browsing window via JavaScript.
        Parameters:
        driver - WebDriver to use for reading the source.
        Returns:
        The source of the currently active browsing window.
      • readUriAsBinary

        default byte[] readUriAsBinary​(URI uri)
                                throws IOException
        Reads the data of a URI and returns its contents as a byte array.
        Parameters:
        uri - URI to read.
        Returns:
        The contents of the resource pointed to by the URI.
        Throws:
        IOException - When the URI could not be read.
      • readUriAsText

        default String readUriAsText​(URI uri,
                                     Charset charset)
                              throws IOException
        Reads the data of a URI and returns its contents as a string, using the given charset to decode the binary data.
        Parameters:
        uri - URI to read.
        charset - Charset to use for decoding the text content.
        Returns:
        The contents of the resource pointed to by the URI.
        Throws:
        IOException - When the URI could not be read.
      • readUriAsText

        default String readUriAsText​(URI uri)
                              throws IOException
        Reads the data of a URI and returns its contents as a string, using the UTF_8 charset to decode the binary data.
        Parameters:
        uri - URI to read.
        Returns:
        The contents of the resource pointed to by the URI.
        Throws:
        IOException - When the URI could not be read.
      • sha256

        default MessageDigest sha256()
        Returns:
        The SHA-256 checksum algorithm.
      • toUri

        default URI toUri​(String uri)
                   throws URISyntaxException
        Converts a URI to a URL.
        Parameters:
        uri - URI to convert.
        Returns:
        The converted URL.
        Throws:
        URISyntaxException - When the URI could not be converted to a URL.
      • toUri

        default URI toUri​(URL url)
                   throws URISyntaxException
        Converts a URL to a URI.
        Parameters:
        url - The URL to convert.
        Returns:
        The converted URI.
        Throws:
        URISyntaxException - When the URL could not be converted.
      • urlEncode

        default String urlEncode​(Iterable<? extends Map.Entry<String,​?>> data)
        Encodes the given data as a string according to the application/x-www-form-urlencoded format.
        Parameters:
        data - Data map to convert.
        Returns:
        A application/x-www-form-urlencoded encoded string with the data.
      • urlEncode

        default String urlEncode​(Map<String,​?> data)
        Encodes the given data as a string according to the application/x-www-form-urlencoded format.
        Parameters:
        data - Data map to convert.
        Returns:
        A application/x-www-form-urlencoded encoded string with the data.