Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Playwright VS Code extension - No tests have been found in Test Explorer #19863

Closed
Shylpx opened this issue Jan 4, 2023 · 7 comments
Closed
Assignees
Labels

Comments

@Shylpx
Copy link

Shylpx commented Jan 4, 2023

Context:

  • Playwright Version: 8.11.0
  • Operating System: Linux - Ubuntu 20.04.5 LTS
  • Node.js version: v16.16.0 (over nvm), with npm 8.11.0 and yarn 1.22.5
  • Browser: All
  • Extra:
    • VSCode: 1.74.2 (installed with snap, but I also removed it and installed it with apt-get, but same result)
    • Playwright Test for VSCode extension: v1.0.3
    • I have no other extensions installed

Describe the bug

I've followed the steps in https://playwright.dev/docs/getting-started-vscode to install the VS Code Extension, but it doesn't matter how many times I refresh the tests, I always get the No tests have been found in this workspace yet message, and no green arrows to run isolated tests:

Screenshot from 2023-01-04 10-17-29

Things that are working

Everything else seems to be working properly:

  • Installing playwright with the command:
    Screenshot from 2023-01-04 10-13-11
    Screenshot from 2023-01-04 10-14-08
  • tests and tests-examples were automatically created, together with the config file (playwright.config.ts):
    Screenshot from 2023-01-04 10-15-12
  • I can execute tests from the command line: npx playwright test example
    Screenshot from 2023-01-04 10-15-45
  • The Playwright section appears in the Testing tab, and I can even record a new test:
    Screenshot from 2023-01-04 10-41-40
    Screenshot from 2023-01-04 10-42-55
  • Test explorer gets the environments, from the config file:
    Screenshot from 2023-01-04 10-18-00
@ManuelLR
Copy link

ManuelLR commented Jan 5, 2023

I also had the same problem

@arpan-patelia
Copy link

I had the same issue. Installing system-wide npm, instead of using npm from nvm fixed it for me. A possible fix will be available in v1.30.

#18954

@pavelfeldman
Copy link
Member

Fixed in the next version.

@Shylpx
Copy link
Author

Shylpx commented Jan 26, 2023

Hi! I've updated the package to the version v1.30 released yesterday, but still getting the same result.

I've also updated:

  • VSCode: 1.74.2 -> 1.74.3
  • Playwright Test for VSCode extension: v1.0.3 -> v1.0.6

I had the same issue. Installing system-wide npm, instead of using npm from nvm fixed it for me

I also tried removing nvm and installing system-wide npm but no luck so far.

@alex-vukov
Copy link

@pavelfeldman updating to v1.30 temporary fixed the issue but after a restart of VSCode I have it again. Same as @Shylpx

@redbugz
Copy link

redbugz commented Feb 23, 2023

I have the same issue, node installed via nvm, no system installation, @playwright/test 1.31.0, vscode extension 1.0.7 on a Mac.

I have other extensions installed as well that use Node (eslint, jest), they seem to find node/npm correctly somehow

@chastabor
Copy link

I currently have this same issue. I'm able to get the Test Explorer to show tests when I use nvm to install node, but when I use a snap node version the Test Explorer does not show any tests and displays a message asking me to install Playwright. Through strace I believe that the snap version is getting an error when a child node process is attempting to write to the standard out:

837817 ioctl(1, TCGETS, 0x7ffc12e386f0) = -1 ENOTTY (Inappropriate ioctl for device)
837817 fstat(1, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x1, 0x3), ...}) = 0
837817 ioctl(2, TCGETS, 0x7ffc12e38530) = -1 ENOTTY (Inappropriate ioctl for device)
837817 fstat(2, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x1, 0x3), ...}) = 0
837817 write(1, "{\"pwtIndex\":\"/home/<<...removed...part...of...path...>>/playwright/node_modules/@playwright/test/index.js\",\"version\":\"1.40.0\"}\n", 120) = -1 EACCES (Permission denied)

I think this is an issue where the child node process is prohibited from inheriting file descriptors from its parent, and thus doesn't have access to the parent nodejs' standard io.

What I see in VSCode is the following:

SyntaxError: Unexpected end of JSON input
  at JSON.parse (<anonymous>)
  at Oe.getPlaywrightInfo (/home/<<removed>>/.vscode/extensions/ms-playwright.playwright-1.0.17/out/extension.js:14:4228)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async Ve._rebuildModel (/home/<<removed>>/.vscode/extensions/ms-playwright.playwright-1.0.17/out/extension.js:91:5603)
  at async Ve.activate (/home/<<removed>>/.vscode/extensions/ms-playwright.playwright-1.0.17/out/extension.js:91:4812)
w @ console.ts:137

And when I run the offending code in the VSCode console it will still work in the snap version:

node "-e" 'try { const pwtIndex = require.resolve("@playwright/test"); const version = require("@playwright/test/package.json").version; console.log(JSON.stringify({ pwtIndex, version})); } catch { console.log("undefined"); }'
{"pwtIndex":"/home/<<removed>>/playwright/node_modules/@playwright/test/index.js","version":"1.40.0"}

Currently my workaround is to use nvm to install nodejs for me, however, I wanted to post what I ran into on this thread in case someone else is running into a similar issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants