I get an error about my storage state file path, Error: Error reading storage state from .auth/user.json:
Expected behavior
I should be able to use the VS Code extension
Actual behavior
In the VS Code "Test Results" tab:
Running 1 test using 1 worker
1) [chromium] › system.spec.ts:5:3 › Create › Can create a system ────────────────────────────────
Error: Error reading storage state from .auth/user.json:
ENOENT: no such file or directory, open '.auth/user.json'
1 failed
[chromium] › system.spec.ts:5:3 › Create › Can create a system ─────────────────────────────────
Additional context
In my auth.setup.ts file, if I change this line:
const authFile = ".auth/user.json";
to:
const authFile = "../.auth/user.json";
I still get the (exact same) error. If I instead change my playwright.config.ts from:
You can't use relative names because they are resolved relative to cwd in Node that you don't control in case of VSCode. Always resolve relative file paths.
Version
1.44.0
Steps to reproduce
Repro repo: https://github.com/machineghost/playwright-repro
Error: Error reading storage state from .auth/user.json:
Expected behavior
I should be able to use the VS Code extension
Actual behavior
In the VS Code "Test Results" tab:
Additional context
In my
auth.setup.ts
file, if I change this line:to:
I still get the (exact same) error. If I instead change my
playwright.config.ts
from:to:
I get almost the same error, but with the
../
:Those are the only two references to that file, so it seems clear that that the problem is with the Playwright config file.
However, I have no idea how to fix it, as adding a
../
didn't help, and the path is perfectly correct for non-VS-Code-based test runs.Environment