Mairaj Ali
Mairaj Ali

Reputation: 221

Playwright JS: How do I convert my test files/code/directory from Jest test runner to Playwright test runner?

1- File names are like login.test.js but in playwright test runner file name should be login.spec.js

2- Directory is Login(Component) -> specs -> login.test.js but in playwright test runner it should be like tests/login.spec.js

3- In my code I use jest keywords for example describe but in Playwright test runner it is test.describe

4- The playwright test runner config file is not supported in my project because it uses Module export. It gives error while reading config file.

So in this situation how can I move my project to Playwright Test Runner?

Thank in advance.

Upvotes: 2

Views: 1630

Answers (1)

Yevhen Laichenkov
Yevhen Laichenkov

Reputation: 8692

  1. Not really. By default, Playwright Test runs .*(test|spec)
  2. In Playwright Test's config you can specify a directory that will be recursively scanned for test files. Use testDir property for that.
  3. Yep, you have to add test prefix for almost all methods such as describe, test, beforeAll, beforeEach, afterAll, afterEach.
  4. I believe that issue was fixed in this PR

Upvotes: 2

Related Questions