15

I've installed the Playwright vscode extension but when I go to the testing area I get a "No tests have been found in this workspace" message. But when I run $> playwright test on the CLI it works like a charm. The weird thing is, that some time ago it was perfectly working in VSCode.

enter image description here

When I click the reload icon I get

enter image description here

But then after a couple of seconds I get back where I started. When I click the blue button I go to the list of extension

enter image description here

I'm not very sure what I am suppose to install here. Also, it did work in the past already.

This is the extension I installed for Playwright:

enter image description here

Any suggestion what is going on here in my VSCode?

Jeanluca Scaljeri
  • 26,343
  • 56
  • 205
  • 333

14 Answers14

9

I had the same issue today and below is the steps I did to make this work, I hope this helps someone.

  • I first tried the Command Pallete reload window and that didn't fix it.
  • I completely closed vscode, opened my terminal and traversed into the folder and opened vscode with code . and it fixed it

I'm using nvm with node v14.19.0 and vscode v1.77.0

gleek
  • 101
  • 1
  • 2
2

Update Node on your system to the latest and it will resolve it. I had the same issue and by updating node, Vs Code immidiately detected all the test files and it works like a charm.

M.Vand
  • 21
  • 4
1

I had the same issue, the only thing that helps me is VS code update, this extension works only on the latest version on VS code. tests section

1

I had the Microsoft extension installed and latest VSCode and got the same message in the Testing panel after using the "Install Playwright" command.

For me it was restarting VSCode completely that made the extension work. Note this was a full app restart and not just the "Developer: Reload Window" command.

Ali
  • 2,439
  • 23
  • 13
1

Please update your Playwright version (Version 1.28.1 at the time of this post) to the latest, (Steps below),

First Check your current version

 npx @playwright/test --version

Update to the latest version

npm install @playwright/test@latest

Install Browsers

npx playwright install

Check the updated version

npx @playwright/test --version

And also install/update the latest version of the Playwright Test for VSCode (v1.0.1 at the time of this post) and reload the IDE. This can be done by simply as follows,

  1. Go to Extensions
  2. Search for "Playwright Test for VSCode"
  3. Update or install the given latest version

It Worked for me.

1

Check your playwright.config.ts and make sure testDir: is pointing to the folder with all your tests in it.

export default defineConfig({

  quiet: false,

  expect: {
    timeout: 30 * 1000,
  },
  

  testDir: './e2e',  //<<<<<<<<<<<<<<<<<<<<<
Craig Wilcox
  • 1,577
  • 1
  • 12
  • 23
0

Check that you're using a supported version of playwright.

In the "details" section, the extention I have installed says

This extension works with Playwright Test version v1.19+ or newer.

I was using Playwright version 1.17, and faced this same issue. Updating to use version 1.19 fixed it.

Player One
  • 607
  • 6
  • 12
0

I had the same issue with Playwright version 1.26.0

I actually had a github issue open https://github.com/microsoft/playwright/issues/17687

Updating to Playwright version 1.26.1 solved the problem and tests were found once again.

ttqa
  • 326
  • 2
  • 12
0

I've had the same issue with a vs code which has been installed on a ubuntu box using the "ubuntu software" installer. This only installs snaps, which probably caused the issue. First I uninstalled the snap and deleted the .vscode folder in the users home directory. After using apt for installation ( as explained here https://linuxize.com/post/how-to-install-visual-studio-code-on-ubuntu-20-04/ ), the playwright plugin worked without any issues.

Andreas
  • 1
  • 1
0

I had the same issue when trying to use existing tests and the latest available version of VSCode and NodeJS just installed on my PC. It that the issue is in the lock files (yarn.lock and parameters-lock.json) contained conflicting requirements, I left only those files that already were with the tests and everything immediately worked after clicking the "update tests" button.

Py Sho
  • 1
0

I had the same issue, I was using vscode and node v16, once I switched to intellij and I could run the same tests with out any issue. Seems to be an issue with visual studio code editor.

0

Update playwright.config.ts file and make sure that testDir:''

testDir: './TypeScript-PlayWright/tests'
0

The above symptoms can also be caused by an error in the Playwright Test for VSCode extension start-up (playwright.config.ts issues, etc.). Open the output window: View / Output -> Window (last item in the select) and look for messages from the extension, e.g.

2023-08-21 12:27:36.238 [error] [Extension Host] Error while listing files: c:\Users\brent\Source\Test\node_modules\@playwright\test\cli.js list-files -c playwright.config.ts {"message":"Project 'chromium' depends on unknown project 'xsetup'","stack":"Error: Project 'chromium' depends on unknown project 'xsetup'\n"}
0

i have the same issue on Windows 10, on 1.37 Playwright version and vscode 1.81.1 2023 i update the vscode to latest version i checked the configuration in playwright.config.js closed the vs code completely then i go to the the project folder and i delete .vscode if it there. then right click on mouse and open this by vs code.