You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After taking a look at the source code, I think everything's working as intended here. testDir is used as the root dir for formatting path names in reporter outputs. If you don't specify a testDir, it defaults to the directory containing the config file. That matches what you're seeing.
The reason you're navigated to the wrong file is that you have two sample.spec.ts files. Does that commonly happen for the projects you're looking at, or is this more of a hypothetical?
The reason you're navigated to the wrong file is that you have two sample.spec.ts files. Does that commonly happen for the projects you're looking at, or is this more of a hypothetical?
Yes, I intentionally included the second sample.spec.ts file to illustrate the problem as clearly as possible.
Consider a more common scenario where subdirectories contain files with the same name:
In this case, VS Code also can't determine the correct file location, and navigation by Cmd+Click is broken.
I think, displaying the full path in the terminal output would be more reliable solution across different IDEs.
At the same time, HTML report can show paths relative to testDir.
I think we have a bug and I have a fix on the way. Terminal/CLI reporters should use cwd to resolve file names so that the tooling that runs them (VSCode) could pick those paths up.
Version
1.49.1
Steps to reproduce
Follow the steps in the reproduction repo: https://github.com/vitalets/playwright-issues/tree/invalid-location
In the error output Playwright does not append
testDir
to the error location. Due to that, I'm navigated to the wrong file by CMD+Click:Screen.Recording.2024-12-21.at.14.19.59.mp4
Expected behavior
Error location contains full path to the failed test, relative to the project root.
Actual behavior
Error location contains path, relative to the
testDir
:Additional context
If I remove
testDir
from Playwright config and it uses defaulttestDir
, then error location containstestDir
and navigation by CMD+Click is correct.Environment
The text was updated successfully, but these errors were encountered: