playwrightplaywright-test

How to run particular file with Playwright?


I have multiple test files in a specific folder with extension spec.ts. How I can run a particular file with Playwright?

Currently for configuration is set as the test folder and will run all files (tests) from it:

testDir: './smokeTests', 

I assume that there is some option in the config file, but I'm not sure which one.


Solution

  • Use testMatch in config:

    testMatch:['sampleTest.spec.ts']
    

    https://playwright.dev/docs/api/class-testconfig#test-config-test-match