Class CheckConsole
java.lang.Object
net.serenitybdd.screenplay.playwright.interactions.CheckConsole
- All Implemented Interfaces:
net.serenitybdd.core.SkipNested,net.serenitybdd.screenplay.Performable
Check for console errors and warnings, optionally failing the test if any are found.
This interaction provides a convenient way to verify that no JavaScript errors or warnings occurred during a test, which is a common quality check for web applications.
Sample usage:
// Setup: Start capturing console messages
actor.attemptsTo(CaptureConsoleMessages.duringTest());
// ... perform actions ...
// Fail the test if any console errors occurred
actor.attemptsTo(CheckConsole.forErrors());
// Fail if any errors OR warnings occurred
actor.attemptsTo(CheckConsole.forErrorsAndWarnings());
// Just report to Serenity without failing the test
actor.attemptsTo(CheckConsole.forErrors().andReportOnly());
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException thrown when console messages are found and reportOnly is false. -
Method Summary
Modifier and TypeMethodDescriptionReport any found messages to Serenity but don't fail the test.static CheckConsoleCheck for console errors.static CheckConsoleCheck for both console errors and warnings.static CheckConsoleCheck for console warnings.<T extends net.serenitybdd.screenplay.Actor>
voidperformAs(T actor) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.serenitybdd.screenplay.Performable
then
-
Method Details
-
forErrors
Check for console errors. Fails the test if any errors are found. -
forWarnings
Check for console warnings. Fails the test if any warnings are found. -
forErrorsAndWarnings
Check for both console errors and warnings. Fails the test if any are found. -
andReportOnly
Report any found messages to Serenity but don't fail the test. Use this when you want to document console output without enforcing it. -
performAs
public <T extends net.serenitybdd.screenplay.Actor> void performAs(T actor) - Specified by:
performAsin interfacenet.serenitybdd.screenplay.Performable
-
getMessageTypeDescription_forStep
-