Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you specify a test folder/path with Playwright?

I want to be able to specify a folder where my tests live so that Playwright doesn't try to run tests from all folders. Is there a way to tell Playwright to only run tests from a specific folder?

like image 696
Cully Avatar asked Oct 27 '25 22:10

Cully


1 Answers

You can do this using the testDir config option. For example:

// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
  testDir: './tests/playwright',
};

export default config;

It's also possible to do this by providing a folder when running playwright from the command line:

npx playwright test path/to/tests/playwright
like image 104
Cully Avatar answered Oct 29 '25 13:10

Cully



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!