Reputation: 29179
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.
When I click the reload icon I get
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
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:
Any suggestion what is going on here in my VSCode?
Upvotes: 30
Views: 51987
Reputation: 1630
Another cause is - Playwright extension is not able to find node.exe executable
Fix - Add path to node.exe to windows PATH windows environment variable
echo %PATH%
Upvotes: 0
Reputation: 14585
For me renaming the "example.spec.ts" to "test1.ts" and then back to "example.spec.ts" worked.
Upvotes: 0
Reputation: 4495
Check your settings in playwrights tab.
Yours project should know what platform to use for tests.
Bug in Github
Upvotes: 3
Reputation: 258
Upgrading to playwright 1.38.0 solved it for me 🙂
If you hit "Refresh Tests" in the Test Explorer, Playwright should give you a pop up in the bottom right telling you 1.38.0 is required for the playwright extension to work.
Upvotes: 0
Reputation: 3461
for VOLTA users:
In your ~/.bash_profile
, add those lines:
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
Then your vsCode will also know where the hell is Node
Upvotes: 0
Reputation: 1
"description": "",
"main": "index.js",
"type": "module",
removing this "type": "module",
from my package.json
file worked for me.
Upvotes: 0
Reputation: 1
Got the same issue on latest version of VScode & Playwright. Closing and reopening solved the issue.
Upvotes: 0
Reputation: 1
Uninstalled the vscode and installed again then restart my pc that worked for me
Upvotes: 0
Reputation: 7167
I've fixed it by changing the playwright.config.ts to the default value. I must have had some issue there but couldn't find what.
Upvotes: 0
Reputation: 1438
Certainly not your case, but as this is the first related question from Google, I'll give my resolution.
In my case I was using vite aliases (defined in vite.config.js). Importing using these vite aliases would make my test files NOT detected by Playwright. Using resolved path was the solution:
From
import {mod1} from "@app/modules/mod1.mjs";
To
import {mod1} from "./../src/modules/mod1.mjs";
EDIT
Playwright now supports jsconfig.json and tsconfig.json where you can set up aliases. Github Issue
Upvotes: 1
Reputation: 11
an update of the folder name in the playwright.config.js/ts worked for me
module.exports = defineConfig({
testDir: './tests'
})
Upvotes: 1
Reputation: 654
This could when node isnt loading properly I used to get this error when loading my shell
N/A: version "N/A -> N/A" is not yet installed.
You need to run "nvm install N/A" to install it before using it.`
Fix was to fix my node version to latest
nvm alias default node
and restart my terminal and vscode
Upvotes: 1
Reputation: 21
I faced the same problem with Playwright version 1.38.1 on my Mac. I fixed it by uninstalling Visual Studio Code and then downloading the latest version.
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 21
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"}
Upvotes: 0
Reputation: 41
Update playwright.config.ts file and make sure that testDir:''
testDir: './TypeScript-PlayWright/tests'
Upvotes: 2
Reputation: 1637
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', //<<<<<<<<<<<<<<<<<<<<<
Upvotes: 5
Reputation: 411
I had the same issue today and below is the steps I did to make this work, I hope this helps someone.
code .
and it fixed itI'm using nvm with node v14.19.0 and vscode v1.77.0
Upvotes: 30
Reputation: 1
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.
Upvotes: 0
Reputation: 1
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.
Upvotes: 0
Reputation: 51
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.
Upvotes: 5
Reputation: 169
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,
It Worked for me.
Upvotes: 5
Reputation: 1
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.
Upvotes: 0
Reputation: 602
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.
Upvotes: 0
Reputation: 617
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.
Upvotes: 0
Reputation: 2563
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.
Upvotes: 1
Reputation: 41
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
Upvotes: 2