Interface ReportingCommandsExecutor

  • All Known Implementing Classes:
    CustomAppiumCommandExecutor, CustomHttpCommandExecutor

    public interface ReportingCommandsExecutor
    Interface implemented by custom executors. Allows to skip reporting for "internal" commands, such as those used during redaction.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.slf4j.Logger LOG
      Logger instance.
      static java.lang.String STATE_SUCCESS
      Successful response state returned by the server (Selenium / Appium).
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void clearStash()
      Reports any outstanding commands before the driver quits and session is closed.
      org.openqa.selenium.remote.Response execute​(org.openqa.selenium.remote.Command command, boolean skipReporting)
      Executes a command.
      default java.lang.Object extractResponse​(org.openqa.selenium.remote.Response response)
      Extracts exception message from server response, omitting noisy information.
      AgentClient getAgentClient()
      Getter for AgentClient instance.
      java.util.concurrent.atomic.AtomicReference<java.lang.String> getCurrentTest()
      Getter for CURRENT_TEST field.
      io.testproject.sdk.internal.helpers.StashedCommands getStashedCommands()
      Getter for stashed commands hashmap.
      default java.lang.String inferTestName​(java.util.List<java.lang.StackTraceElement> traces)
      Infer Test name from call stack.
      boolean isCommandReportsDisabled()
      Getter for commandReportsDisabled field.
      boolean isRedactionDisabled()
      Getter for redactDisabled field.
      boolean isReportsDisabled()
      Getter for reportsDisabled field.
      boolean isTestAutoReportsDisabled()
      Getter for testReportsDisabled field.
      default boolean reportCommand​(AgentClient agentClient, org.openqa.selenium.remote.Command command, org.openqa.selenium.remote.Response response, ReportingCommandsExecutor executor)
      Reports a command executed by the driver and the result.
      default void reportCommand​(org.openqa.selenium.remote.Command command, org.openqa.selenium.remote.Response response)
      Reports a command to the Agent.
      default void reportTest​(java.util.List<java.lang.StackTraceElement> traces, boolean force)
      Report Test to Agent.
      void setCommandReportsDisabled​(boolean disable)
      Setter for commandReportsDisabled field.
      void setRedactionDisabled​(boolean disable)
      Setter for redactDisabled field.
      void setReportsDisabled​(boolean disable)
      Setter for reportsDisabled field.
      void setTestAutoReportsDisabled​(boolean disable)
      Setter for testReportsDisabled field.
    • Field Detail

      • LOG

        static final org.slf4j.Logger LOG
        Logger instance.
      • STATE_SUCCESS

        static final java.lang.String STATE_SUCCESS
        Successful response state returned by the server (Selenium / Appium).
        See Also:
        Constant Field Values
    • Method Detail

      • execute

        org.openqa.selenium.remote.Response execute​(org.openqa.selenium.remote.Command command,
                                                    boolean skipReporting)
        Executes a command.
        Parameters:
        command - Command to execute
        skipReporting - Flag to control reporting
        Returns:
        Server response
      • getStashedCommands

        io.testproject.sdk.internal.helpers.StashedCommands getStashedCommands()
        Getter for stashed commands hashmap.
        Returns:
        value of stashed commands hashmap.
      • isReportsDisabled

        boolean isReportsDisabled()
        Getter for reportsDisabled field.
        Returns:
        value of reportsDisabled field
      • setReportsDisabled

        void setReportsDisabled​(boolean disable)
        Setter for reportsDisabled field.
        Parameters:
        disable - True to disable or False to enable.
      • isCommandReportsDisabled

        boolean isCommandReportsDisabled()
        Getter for commandReportsDisabled field.
        Returns:
        value of commandReportsDisabled field
      • setCommandReportsDisabled

        void setCommandReportsDisabled​(boolean disable)
        Setter for commandReportsDisabled field.
        Parameters:
        disable - True to disable or False to enable.
      • isTestAutoReportsDisabled

        boolean isTestAutoReportsDisabled()
        Getter for testReportsDisabled field.
        Returns:
        value of testReportsDisabled field
      • setTestAutoReportsDisabled

        void setTestAutoReportsDisabled​(boolean disable)
        Setter for testReportsDisabled field.
        Parameters:
        disable - True to disable or False to enable.
      • isRedactionDisabled

        boolean isRedactionDisabled()
        Getter for redactDisabled field.
        Returns:
        value of redactDisabled field
      • setRedactionDisabled

        void setRedactionDisabled​(boolean disable)
        Setter for redactDisabled field.
        Parameters:
        disable - True to disable or False to enable.
      • getCurrentTest

        java.util.concurrent.atomic.AtomicReference<java.lang.String> getCurrentTest()
        Getter for CURRENT_TEST field.
        Returns:
        value of CURRENT_TEST field
      • reportCommand

        default void reportCommand​(org.openqa.selenium.remote.Command command,
                                   org.openqa.selenium.remote.Response response)
        Reports a command to the Agent.
        Parameters:
        command - Command to report.
        response - Response to the reported command.
      • reportTest

        default void reportTest​(java.util.List<java.lang.StackTraceElement> traces,
                                boolean force)
        Report Test to Agent.
        Parameters:
        traces - Call Stack to analyze when searching for Test name.
        force - True if called just before session is getting closed, but test hasn't changed, to force reporting. Otherwise False.
      • inferTestName

        default java.lang.String inferTestName​(java.util.List<java.lang.StackTraceElement> traces)
        Infer Test name from call stack.
        Parameters:
        traces - Call Stack to analyze.
        Returns:
        Test name.
      • reportCommand

        default boolean reportCommand​(AgentClient agentClient,
                                      org.openqa.selenium.remote.Command command,
                                      org.openqa.selenium.remote.Response response,
                                      ReportingCommandsExecutor executor)
        Reports a command executed by the driver and the result. If the response is an Element, extracts its ID and sends as the result.
        Parameters:
        agentClient - AgentClient instance to use for reporting
        command - Command executed by the driver.
        response - Response provided by the driver.
        executor - Executor instance that executed the command
        Returns:
        True if successfully reported, otherwise False.
      • extractResponse

        default java.lang.Object extractResponse​(org.openqa.selenium.remote.Response response)
        Extracts exception message from server response, omitting noisy information.
        Parameters:
        response - Response received from the server.
        Returns:
        Exception message (in case of an exception response), or original response.
      • clearStash

        default void clearStash()
        Reports any outstanding commands before the driver quits and session is closed. Should be always called before session ends, to avoid unreported command in FluentWait sequence.