playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug] [VSCODE extension]: Multi-root workspaces with playwright confuses the extension, both test suites never show up

Open alexrecuenco opened this issue 1 year ago • 2 comments

Version

1.46.1

Steps to reproduce

  1. Clone my repo https://github.com/alexrecuenco/playwright-multiroot-report
  2. cd playwright-multiroot-report
  3. npm install in both a and b
  4. Open it with code ./report-playwright.code-workspace to open a multi-root workspace
  5. Go to the Testing View,
  6. See that not both a and b ever show up, and if you refresh you get either a or b showing up their tests suites
Screenshot 2024-08-27 at 2 32 49 PM Screenshot 2024-08-27 at 2 32 54 PM

Expected behavior

I see both test suites, the test suites of a and b

Actual behavior

The test suite of a shows up, or b , it appears to be random

Additional context

We currently have multiple projects. And I prefer to have them all collected into one workspace from which to work, and playwright seems to be causing some conflict

Environment

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M2
    Memory: 87.95 MB / 16.00 GB
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
  IDEs:
    VSCode: 1.92.2 - /usr/local/bin/code
  Languages:
    Bash: 5.2.26 - /opt/homebrew/bin/bash
  npmPackages:
    @playwright/test: ^1.46.1 => 1.46.1

alexrecuenco avatar Aug 27 '24 12:08 alexrecuenco

I would put it in microsoft/playwright-vscode but that repository doesn't allow issues. So I imagine you want the report here

alexrecuenco avatar Aug 27 '24 12:08 alexrecuenco

I also saw this, but I have managed to get around it. I have a branch here with instructions on reproducing it.

💡 Note that I am using the v1.1.10 pre-release version (not sure if that makes a difference)

I managed to get it to work with the following steps:

  1. Click on the playwright gear icon at the bottom of the test view: Image

  2. Select the missing project(s): Image

Now both projects are showing up in the test window and I can run them with the top-level controls: Image

LiamLamb avatar Oct 19 '24 07:10 LiamLamb

@alexrecuenco could you try this as well on the latest VSCode extension version?

mxschmitt avatar Nov 01 '24 16:11 mxschmitt

Hey, nop. Same issue with v1.1.11. I just tried it by cloning the repo with the steps provided above.

But @LiamLamb steps seem to circumvent this issue

Are the steps I showed difficult to replicate?

alexrecuenco avatar Nov 01 '24 21:11 alexrecuenco

I was able to reproduce that when you open the projects initially, you sometimes get a and sometimes b shown. This is because we pick internally the first one which resolves from findFiles which has a non-deterministic order. I created a patch to workaround this here: https://github.com/microsoft/playwright-vscode/pull/563.

To address the issue that only one project is getting listed I was able to fix by enabling it. See the following steps similar to the ones shown in https://github.com/microsoft/playwright/issues/32338#issuecomment-2423659833.

  1. Open "Testing" view
  2. In Playwright click the gear icon:

Image

  1. Make sure to select both projects:

Image

mxschmitt avatar Nov 23 '24 17:11 mxschmitt

How do you get the Playwright VSCode extension to detect tests at all? I've tried with opening the sub-folder. I've tried with a multi-root workspace. It always says there are no tests. I've looked at all the extension documentation. Nothing works. :/

matthew-dean avatar May 29 '25 17:05 matthew-dean