Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Playwright breaks in case of current directory case mismatch #16347

Closed
qwertie opened this issue Aug 8, 2022 · 4 comments · Fixed by #16636
Closed

[BUG] Playwright breaks in case of current directory case mismatch #16347

qwertie opened this issue Aug 8, 2022 · 4 comments · Fixed by #16636

Comments

@qwertie
Copy link

qwertie commented Aug 8, 2022

Context:

  • Playwright Version: 1.24.2
  • Browser: All
## System:
 - OS: Windows 10 10.0.19044
 - Memory: 2.98 GB / 15.93 GB
## Binaries:
 - Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
 - Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
 - npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
## Languages:
 - Bash: 4.4.20 - C:\Windows\system32\bash.EXE

Describe the bug

If the current directory doesn't have "correct" uppercase/lowercase letters, playwright won't run any tests and gives a confusing error message because it ignores playwright.config.ts and treats the tests themselves as configuration file(s). For example, it might say "Playwright Test did not expect test.beforeEach() to be called here".

Code Snippet

Powershell transcript using on the example shipped provided with playwright:

PS C:\Dev\Temp\playwright-test> npm init playwright@latest
...
PS C:\Dev\Temp\playwright-test> npx playwright test

Running 3 tests using 3 workers

  3 passed (4s)

To open last HTML report run:

  npx playwright show-report

PS C:\Dev\Temp\playwright-test> cd /dev/temp/playwright-test
PS C:\dev\temp\playwright-test> npx playwright test

Running 0 test using 0 worker


Error: ui-tests\example.spec.ts:5:16: 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.
...

The bug was originally described in #13092.

@rwoll rwoll added the triaging label Aug 8, 2022
@rwoll
Copy link
Member

rwoll commented Aug 8, 2022

Thanks for the report. The error message looks to be particularly confusing in this case. We will review!

@rwoll rwoll added v1.26 and removed triaging labels Aug 9, 2022
@rwoll
Copy link
Member

rwoll commented Aug 9, 2022

Discussed and looks like:

PS C:\Dev\Temp\playwright-test> npm init playwright@latest
PS C:\Dev\Temp\playwright-test> npx playwright test

and

PS C:\Dev\Temp\playwright-test> cd /dev/temp/playwright-test
PS C:\dev\temp\playwright-test> npx playwright test

should behave similarly. Since they are not, this likely means there is a bug in our file resolution logic. However, since there is a workaround for now, marking as a future release milestone. Thanks!

@mxschmitt
Copy link
Member

Folding into #9193.

@pavelfeldman
Copy link
Member

Folding into #9193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants