Closed dawidkwiecien closed 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.
Thanks Pavel for yours clarification. Maybe it’s worth to add that feature ? Or it’s intentional to show all tests?
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.
Thanks Pavel this fully clarifying my thoughts
Context:
Code Snippet
import { defineConfig, devices } from '@playwright/test';
/**
/**
See https://playwright.dev/docs/test-configuration. / export default defineConfig({ / Run tests in files in parallel / fullyParallel: false, / Fail the build on CI if you accidentally left test.only in the source code. / forbidOnly: !!process.env.CI, / Retry on CI only / retries: process.env.CI ? 2 : 0, / Opt out of parallel tests on CI. / workers: 1, / Reporter to use. See https://playwright.dev/docs/test-reporters / reporter: [['./my-awesome-reporter.ts'],['blob'],['html']], / Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. / use: { / Base URL to use in actions like
await page.goto('/')
. */ // baseURL: 'http://127.0.0.1:3000',/ Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer / trace: 'on-first-retry', browserName: 'chromium', channel:'chrome' },
/ Configure projects for major browsers / projects: [ { name: 'default' }, { name: 'change', grep: /change_tc\d\d\d.spec.ts/, testDir: './tests/suites/change/', }, { name: 'asset', grep: /asset_tc\d\d\d.spec.ts/, testDir: './tests/suites/asset/', },
], });
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.