Rayrun
← Back to Discord Forum

Is there a way to get the argument of "playwright test" or list of tests to be run in global setup?

In my playwright repo there is a globalSetup project. In this project I want to run certain tests based on what the user has filled in on the command line.

For example, if the user typed "npm run test:visual" (which runs "playwright test tests/visual"), the setup project will do some setup tasks for the visual tests. If the user typed "npm run test:e2e" (which runs "playwright test tests/e2e"), then the setup project will do some preparations for the e2e tests.

By far I have been using "process.env.npm_lifecycle_script" to retrieve the path of tests. But this stopped working after I upgrade node/npm versions.

So my question is, is there another to get the arguments of "playwright test" in the global setup project? Or even better, if there a way to list all the tests of project that will be running later?

This thread is trying to answer question "Is there a way to get the arguments of 'playwright test' in the global setup project? Or is there a way to list all the tests of the project that will be running later?"

2 replies
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].