Beispiel #1
0
        /// <summary>
        /// Send an executed WebDriver command to the Agent.
        /// </summary>
        /// <param name="command">The WebDriver command that was executed.</param>
        /// <param name="result">The result of the command execution.</param>
        /// <param name="passed">True if command execution was successful, false otherwise.</param>
        private void SendCommandToAgent(Command command, object result, bool passed)
        {
            if (this.ReportsDisabled || this.CommandReportsDisabled)
            {
                Logger.Trace($"Command '{command.Name}' {(passed ? "passed" : "failed")}");
                return;
            }

            if (!this.RedactionDisabled)
            {
                command = RedactHelper.RedactCommand(this.commandExecutor, command);
            }

            DriverCommandReport driverCommandReport = new DriverCommandReport(command.Name, command.Parameters, result, passed);

            if (!passed)
            {
                driverCommandReport.Screenshot = this.GetScreenshot();
            }

            AgentClient.GetInstance().ReportDriverCommand(driverCommandReport);
        }
Beispiel #2
0
        /// <summary>
        /// Send an executed WebDriver command to the Agent.
        /// </summary>
        /// <param name="command">The WebDriver command that was executed.</param>
        /// <param name="result">The result of the command execution.</param>
        /// <param name="passed">True if command execution was successful, false otherwise.</param>
        private void SendCommandToAgent(Command command, object result, bool passed)
        {
            if (this.ReportsDisabled || this.CommandReportsDisabled.Equals(DriverCommandsFilter.All))
            {
                Logger.Trace($"Command '{command.Name}' {(passed ? "passed" : "failed")}");
                return;
            }

            if (this.CommandReportsDisabled.Equals(DriverCommandsFilter.Passing) && !passed)
            {
                // Report failed driver commands in a user friendly way if explicitly requested by the user
                StepReport stepReport = new StepReport(
                    description: $"Failed to execute driver command '{command.Name}'",
                    message: result.ToJson(),
                    passed: false,
                    screenshot: this.GetScreenshot());

                AgentClient.GetInstance().ReportStep(stepReport);
                return;
            }

            if (this.CommandReportsDisabled.Equals(DriverCommandsFilter.None))
            {
                if (!this.RedactionDisabled)
                {
                    command = RedactHelper.RedactCommand(this.commandExecutor, command);
                }

                DriverCommandReport driverCommandReport = new DriverCommandReport(command.Name, command.Parameters, result, passed);

                if (!passed)
                {
                    driverCommandReport.Screenshot = this.GetScreenshot();
                }

                AgentClient.GetInstance().ReportDriverCommand(driverCommandReport);
            }
        }