microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.4k stars 3.63k forks source link

[BUG]Changing Project in VSCode it doesn't influence for tests visibility in Test Explorer #29251

Closed dawidkwiecien closed 8 months ago

dawidkwiecien commented 8 months ago

Context:

Code Snippet

import { defineConfig, devices } from '@playwright/test';

/**

/**

Describe the bug

I've 3 projects setuped in playwright.config.ts. While i was changed project in Test Explorer, the list of availible test in Test Explorer is not change even if in project i have grep and TestDir changed.

If i tried run from command line, reporter is informing me that i dont have tests --------->That correct behaviour But if i try same from test explorer it didnt filter list of tests and present all tests.

dawidkwiecien commented 8 months ago

Screenshot 2024-01-31 090027

Screenshot 2024-01-31 085922

Screenshot 2024-01-31 085819

Screenshot 2024-01-31 085819

pavelfeldman commented 8 months ago

Test explorer shows all the tests unconditionally, the project that you select is a "run" configuration. I.e. that's what runs when you press the Run button.

dawidkwiecien commented 8 months ago

Thanks Pavel for yours clarification. Maybe it’s worth to add that feature ? Or it’s intentional to show all tests?

pavelfeldman commented 8 months ago

That's how VS Code Test Explorer is designed. It asks providers for tests and for list of configurations. We aren't even supposed to know which configuration is currently selected. Think about profiles as "how you run tests" not "which tests you run". The mapping of this model to Playwright projects is not exact, but is more or less the best we could find.

dawidkwiecien commented 8 months ago

Thanks Pavel this fully clarifying my thoughts