Skip to content

[Feature]: Support a Method to Explicitly Mark Test as Passed and Exit Early #36409

Open
@slittleton

Description

@slittleton

🚀 Feature Request

Currently, Playwright does not provide a method such as test.pass() to immediately mark a test as passed and exit early. While using return achieves a similar effect, it can be ambiguous when reviewing test logs or understanding developer intent. Having a clear, expressive way to exit a test with a "passed" status—especially under conditional scenarios—would improve readability and convey semantics more directly.

Example

  1. Sometimes I need to run a test suite but some of the tests should be skipped either for time saving or they are not relevant.

  2. Dynamically skipping parts of a test when preconditions are met, but still considering it a successful validation.

  3. Improving clarity in CI logs by distinguishing between skipped, failed, and explicitly passed conditions.

  4. Allowing finer control in custom test helpers and shared test setups.

Motivation

I believe that are a number of use cases for this functionality and I specifically find that test.skip() is often inconvenient if I want part of a test to run. This would allow us to pass a test at any point where we determine it is appropriate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions