java.lang.Object
net.serenitybdd.screenplay.playwright.interactions.ReportConsoleMessages
All Implemented Interfaces:
net.serenitybdd.core.SkipNested, net.serenitybdd.screenplay.Performable

public class ReportConsoleMessages extends Object implements net.serenitybdd.screenplay.Performable
Report captured console messages to the Serenity report as evidence.

This interaction attaches console messages to the Serenity report, making them visible in the test results. Use this to include browser console output in your reports for debugging or verification purposes.

Sample usage:

     // Capture console messages during the test
     actor.attemptsTo(CaptureConsoleMessages.duringTest());

     // ... perform actions that may generate console output ...

     // Report only errors and warnings to the Serenity report
     actor.attemptsTo(ReportConsoleMessages.errorsAndWarnings());

     // Or report all messages
     actor.attemptsTo(ReportConsoleMessages.all());

     // Or report only errors
     actor.attemptsTo(ReportConsoleMessages.errors());
 
See Also:
  • Method Details

    • all

      public static ReportConsoleMessages all()
      Report all captured console messages to the Serenity report.
    • errors

      public static ReportConsoleMessages errors()
      Report only console errors to the Serenity report.
    • warnings

      public static ReportConsoleMessages warnings()
      Report only console warnings to the Serenity report.
    • errorsAndWarnings

      public static ReportConsoleMessages errorsAndWarnings()
      Report console errors and warnings to the Serenity report. This is the recommended option for most use cases.
    • performAs

      public <T extends net.serenitybdd.screenplay.Actor> void performAs(T actor)
      Specified by:
      performAs in interface net.serenitybdd.screenplay.Performable