编剧 VSCode 给出 `No tests found` 消息

我已经安装了 Playwright vscode 扩展,但是当我进入测试区域时,我收到“在此工作区中未找到任何测试”消息。但是当我在 CLI 上运行 $> playwright test 时,它就像一个魅力。奇怪的是,前段时间它在 VSCode 中完美运行。

enter image description here

当我单击重新加载图标时,我得到

enter image description here

但几秒钟后,我又回到了开始的地方。当我单击蓝色按钮时,我转到扩展名列表

enter image description here

我不太确定我应该在这里安装什么。此外,它在过去确实有效。

这是我为 Playwright 安装的扩展:

enter image description here

有什么建议在我的 VSCode 中发生了什么?

stack overflow Playwright VSCode gives `No tests found` message
原文答案

答案:

作者头像

我有同样的问题,唯一对我有帮助的是 VS 代码更新,这个扩展只适用于 VS 代码的最新版本。 tests section

作者头像

我安装了 Microsoft 扩展和最新的 VSCode,并在使用“安装 Playwright”命令后在“测试”面板中收到了相同的消息。

对我来说,完全重新启动 VSCode 使扩展工作。请注意,这是一个完整的应用程序重新启动,而不仅仅是“开发人员:重新加载窗口”命令。

作者头像

检查您使用的是受支持的 playwright 版本。

在“详细信息”部分,我安装的扩展名说

此扩展适用于 Playwright Test 版本 v1.19+ 或更高版本。

我使用的是 Playwright 1.17 版,遇到了同样的问题。更新为使用 1.19 版修复了它。

作者头像

我对 Playwright 版本 1.26.0 有同样的问题

我实际上打开了一个 github 问题 https://github.com/microsoft/playwright/issues/17687

更新到 Playwright 版本 1.26.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.

作者头像

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.