I cannot run playwright from outside of the directory where the config is installed. Perhaps I am misreading the help page?
Steps to reproduce:
$ mkdir tmp
$ cd tmp/
$ npm init playwright@latest
Getting started with writing end-to-end tests with Playwright:
Initializing project in '.'
✔ Do you want to use TypeScript or JavaScript? · TypeScript
✔ Where to put your end-to-end tests? · tests
✔ Add a GitHub Actions workflow? (y/N) · false
✔ Install Playwright browsers (can be done manually via 'npx playwright install')? (Y/n) · false
*** snipped ***
$ npx playwright test
Running 6 tests using 4 workers
6 passed (3.9s)
To open last HTML report run:
npx playwright show-report
$ cd ..
$ npx playwright test tmp
Error: Playwright Test did not expect test() to be called here.
Most common reasons include:
- You are calling test() in a configuration file.
- You are calling test() in a file that is imported by the configuration file.
- You have two different versions of @playwright/test. This usually happens
when one of the dependencies in your package.json depends on @playwright/test.
at tmp/tests/example.spec.ts:3
1 | import { test, expect } from '@playwright/test';
2 |
> 3 | test('has title', async ({ page }) => {
| ^
4 | await page.goto('https://playwright.dev/');
5 |
$ npx playwright test tmp/tests
****** snipped, output same as above *****