← Back to Discord Forum

Issue where Playwright is not running all test files


I'm not sure what's going on but whenever I run npx playwright test without any arguments, it is only running a single test file (the last test file I was writing) instead of all test files. However, when I run npx playwright test --list, it will show all the test files, as expected. I am using @playwright/test@1.35.1 and playwright@1.35.1. Please help!

This thread is trying to answer question "Why is Playwright only running a single test file instead of all test files?"

8 replies

It can be a config issue…. I would suggest you to check value you have mentioned in testdir parameter in config file. Refer to below link for details


I have confirmed I have the testDir config option set correctly. I have it set to './e2e' which is where all my tests reside. Here is an example of the directory structure:

├── ...
├── playwright.config.ts
├── e2e
│   ├── fixtures
│   │   ├── ...
│   │   └── ...
│   ├── pageObjects
│   │   ├── ...
│   │   └── ...
│   ├── specs
│   │   ├── subDirA
│   │   │   ├── some-test-a.spec.ts
│   │   │   └── another-test-a.spec.ts
│   │   ├── subDirB
│   │   │   ├── some-test-b.spec.ts
│   │   │   └── another-test-b.spec.ts
│   │   ├── some-test.spec.ts
│   │   └── another-test.spec.ts
│   └── tsconfig.json
└── ...

Here is my playwright.config.ts file

Update: I removed the test file it keeps running against and tried npx playwright test again and it ran against all files. When I re-added the test file again, it went back to running against just that test file.

I just tried renaming the test file too, but it still runs only against that same test file, but with the new name...

perhaps you're using test.only?

@skorp32: 🤦‍♂️ yep... that was it. Thanks!

🤦‍♂️ yep... that was it. Thanks!

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.