← Back to Discord Forum

Running a specific test as headless:false

keinarelkayamposted in #help-playwright
Open in Discord

Hi, All of our tests run headless. There is an option to define on the playwright.config.ts file that when the test name contains #headlessFalse, the test will run as headless:false? We need it to define it for specific tests.

This thread is trying to answer question "Can I run a specific test as headless:false in a project where all tests run headless?"

5 replies

Create a separate project for those tests with different headless value or move to a different file and add top-level test.use({ headless: false }) to force tests in headless false

As far as I know, you cannot really run tests tagged as "#headlessFalse", going by your example, however, what you can do is:

  • Create a separate project for tests that require headed mode, add the test.use({headless: false}) on top level of the spec file right before you specify your test blocks.
  • Launch tests by tags directly from the command line by using npx playwright test --headed --grep "#headlessFalse"

Thanks guys, So if I add before my tests in the spec file test.use({headless: false}); it will only affect the tests in this specific file. correct?


Great, thanks. Can I do it for a specific test under my spec file?

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 luc@ray.run.