TestRun
Controls which tests will run and their expected status. A TestRun is available during reporter.preprocess(). Setup and teardown projects cannot be changed.
Methods
exclude
Added in: v1.62Excludes a test or suite from the run. Excluded tests do not appear in the report and their bodies are not executed.
Usage
testRun.exclude(test);
Arguments
fail
Added in: v1.62Marks a test or every test in a suite as "should fail". Playwright runs the tests and ensures they are actually failing, useful for documenting broken functionality until it is fixed.
Usage
testRun.fail(test);
testRun.fail(test, reason);
Arguments
-
Test or suite to mark as expected-to-fail.
-
Optional explanation surfaced as the annotation description.
fixme
Added in: v1.62Marks a test or every test in a suite as fixme. The test bodies are not executed and the tests are reported as skipped, with the intention to fix them.
Usage
testRun.fixme(test);
testRun.fixme(test, reason);
Arguments
-
Test or suite to mark as fixme.
-
Optional explanation surfaced as the annotation description.
skip
Added in: v1.62Skips a test or every test in a suite. The test bodies are not executed and the tests are reported as skipped.
Usage
testRun.skip(test);
testRun.skip(test, reason);
Arguments
-
Test or suite to skip.
-
Optional explanation surfaced as the annotation description.
skipSharding
Added in: v1.62Disables Playwright's built-in shard filter for this run, leaving sharding to the reporter. Reporters typically implement their own sharding by calling testRun.exclude() on out-of-shard tests.
Usage
testRun.skipSharding();