4

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?

0

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

3 Comments

Note, this won't stop tests from running outside this directory.
@FiddleFreak Let's say I have some tests in ./test and ./.example, I set testDir to ./tests, and run playwright test. Are you saying the tests in ./example would run as well? If not, could you clarify?
This works for me. There's a comment from Fiddle Freak in another thread that clarifies that this did work after all, there was some env variable getting in the way for them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.