Recently I started working with a playwright for one of the projects and started playing with a playwright but very impressed with the feature they provide.
You can execute playwright tests in various ways like CLI mode or directly from VSCode if you are using the Playwright extension.
While running the test from cli you might come across the below error No tests found In Playwright.
When you install playwright it comes with sample test and sample command to execute the test but when you can run the same command, you might get the same error.
How To Fix Error: No tests found
There is a quick fix just replace \ with / and we are good to go.
Earlier – npx playwright test .\tests\handleAlert.spec.js
Now – npx playwright test ./tests/handleAlert.spec.js
I have executed only one test but you can use different test using different playwright CLI command with options.
You might also come across the same issue if you trigger this from jenkins or any other CLI tool so make sure you make the changes accordingly.
Siddharth Barthwal says
it did not work
Mukesh Otwani says
Please check the path of the test that you have specified and let me know what exception you are getting.