Hello! I have recently installed VS Code - Playwright test for VS Code extension. If I have opened my project repository it does not show any tests. It says "No tests have been found in this workspace yet" . I use playwright Version 1.35.1 and node v18.16.0. Anyone has any ideas? I want see the tests.
This thread is trying to answer question "Why does the VS Code - Playwright test for VS Code extension not show any tests?"
Can you try just adding a new project from scratch to see if vscode and the extension are working from the examples. This will rule out any issues there. In your screenshot you have testDir: './specs' did you override this in your projects configuration? Make sure this is correct in your setup. Also, if you are using testMatch as a setting that that is correct as well. Finally, ensure that you have no errors in compilation, that will cause an issue as well.
I had this issue too until recently & tried all sorts of things to fix. I had some other network type issues as well (logging in & settings sync) with vscode & so focused on the vscode install. Once I upgraded vscode & reinstalled from on network it started working. It didn't fix my other issues however 🙃
MY PROJECT DIRECTORY IS: C:\Users\XXXX\OPERATION-XXL\operator.app>
PLAYWRIGHT CONFIG IS IN: C:\Users\XXXX\OPERATION-XXL\operator.app\test\playwright\playwright.config.ts
My E2E test cases are in: C:\Users\XXXX\OPERATION-XXL\operator.app\test\playwright\specs\connext\e2e
MY TERMINAL STARTS WITH: C:\Users\XXXX\OPERATION-XXL\operator.app>
AT THE MOMENT MY PLAYWRIGHT CONFIG IS: testDir: './specs/connext/e2e',
PS: When I try to new project where I also have playwright, there it works OK.
Or better yet. Create a simple clean new project form vs code, Should have two sample tests and that should all work... Does it? Follow the install as Debbie shows in this video... https://playwright.dev/docs/getting-started-vscode
Would assert if you follow that and it fails then you have a bug you can file...
While generally "C:\Users" is not the best place to be working it can inject issues with permissions. Create a folder in tmp "c:\tmp\WorkFromHere" not under your 'users' folder.
@zorro it does not I am getting: Error: ENOENT: no such file or directory, open 'debug.json' at Object.openSync (node:fs:601:3) at readFileSync (node:fs:469:35) at Object.<anonymous> (C:\Users\thoang\OPERATOR-XXL\operator.app\test\playwright\playwright.config.ts:18:38) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module.f._compile (C:\Users\thoang\OPERATOR-XXL\operator.app\test\playwright\node_modules@playwright\test\lib\utilsBundleImpl.js:16:994) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Object.i.<computed>.ut._extensions.<computed> (C:\Users\thoang\OPERATOR-XXL\operator.app\test\playwright\node_modules@playwright\test\lib\utilsBundleImpl.js:16:1010) at Module.load (node:internal/modules/cjs/loader:1117:32) at Function.Module._load (node:internal/modules/cjs/loader:958:12) at Module.require (node:internal/modules/cjs/loader:1141:19) at require (node:internal/modules/cjs/helpers:110:18) at requireOrImport (C:\Users\thoang\OPERATOR-XXL\operator.app\test\playwright\node_modules@playwright\test\lib\transform\transform.js:172:20) at requireOrImportDefaultObject (C:\Users\thoang\OPERATOR-XXL\operator.app\test\playwright\node_modules@playwright\test\lib\common\configLoader.js:83:53) at ConfigLoader.loadConfigFile (C:\Users\thoang\OPERATOR-XXL\operator.app\test\playwright\node_modules@playwright\test\lib\common\configLoader.js:56:26) at runTests (C:\Users\thoang\OPERATOR-XXL\operator.app\test\playwright\node_modules@playwright\test\lib\cli.js:120:55) at qr.<anonymous> (C:\Users\thoang\OPERATOR-XXL\operator.app\test\playwright\node_modules@playwright\test\lib\cli.js:40:7) { errno: -4058, syscall: 'open', code: 'ENOENT', path: 'debug.json' }
yes new project from the scratch works with clean repository. But it must be working on my work project as well thats where we use playwright
If it works in a clean/new project, would assert PW is fine then. So as you mention something about your configuration is effecting it. Any 3rd party tools or packages, pnpm and not npm, Errors/problems noted in VS Code for your project, found some errors may appear, even had it happen last night valid javascript but had unknown members on an object and something failed to parse, and no test showed up. I could right mouse in the file and "Debug test at cursor" and it ran. While the error "debug.json" hmmm who's file is that, i all my PW projects their is no such file... Think that is your issue...
@martinh3309 This is what I did:
So things are working for me in the above scenario, as you can see I am running the latest playwright 1.36.0, vs code latest 1.80.0 and vs code extension 1.0.13
Let me know if you did something different, also interested if you do a similar scenario from the above steps will it work for you in the same manner. Sorry was not able to find the smoking gun here, it just worked for me. Was thinking possible permissions issue would pop up being under the Users folder, but nothing strange occurred.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].