Skip to content

[Feature]: Expose further CLI flags and make available to test.info() #38965

@JayAshton

Description

@JayAshton

🚀 Feature Request

The ask is that flags such as --grep, --grep-invert and --project are exposed as part of test.info(). For example, we might use the below command with flags:

npx playwright test --project=chrome --grep @smoke-tests

However, I may also have a global setup dependency for the chrome project which sets up authentication various types of users. Let's say, regularuser, adminuser and superuser.

In the above command, I am opting to only run the smoke tests and only regularuser is actually being used in those tests. As part of my global setup dependency, I would like to be able to check (using the newly exposed CLI flag) what --grep was such that I can choose to set up authentication for the relevant users.

Example

Currently, I would use npx playwright test --project=chrome --grep @smoke-tests and I would end up with users being set up for all types of users. regularuser, adminuser and superuser.

Instead, I would run the same command and as part of my global setup being able to detect what tests were being run, only regularuser would be set up.

Motivation

Improve flexibility of using playwrights config when writing fixtures. Needed to support large playwright suites where multiple different types of users are used. Avoids using custom solutions which can bypass the playwright test runner

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