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
67.36k stars 3.71k forks source link

[Bug]: When starting from VSCode extension, 'devtools: true' in launchOptions does nothing #29899

Open karyon opened 8 months ago

karyon commented 8 months ago

Version

1.42.1

Steps to reproduce

  1. clone https://github.com/karyon/playwright-examples
  2. git checkout repro-devtools-doing-nothing
  3. npm install, npx playwright install
  4. Using the VSCode extension, run any test with "show browser" enabled

Expected behavior

Browser opens and has devtools open

Actual behavior

Browser opens but does not have devtools open

Additional context

browserType.launch() docs launchOptions docs say any browserType.launch() option (docs) can be used In https://github.com/microsoft/playwright/issues/28529#issuecomment-1845009195 someone is reporting this is working for them In playwright.config.ts, uncomment args: ['--auto-open-devtools-for-tabs'], this does work.

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
    Memory: 6.92 GB / 31.76 GB
  Binaries:
    Node: 18.17.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.21 - C:\Program Files\nodejs\yarn.CMD
    npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.15.4 - C:\Program Files\nodejs\pnpm.CMD
  IDEs:
    VSCode: 1.85.2 - C:\Program Files\Microsoft VS Code\bin\code.CMD
  Languages:
    Bash: 5.2.26 - C:\Program Files\Git\usr\bin\bash.EXE
  npmPackages:
    @playwright/test: ^1.42.1 => 1.42.1
mxschmitt commented 8 months ago

Investigation: The devtools: true option does not get taken into account when using the VSCode extension.

When running the tests via the CLI, it works: npx playwright test --project=chromium --headed api-mocking:5.

karyon commented 8 months ago

Ah I forgot! When using chromium.launch in test code, it works too.

karyon commented 7 months ago

I agree with @odinho in #30025, the VSCode debugging doesn't seem like an adequate replacement for the chrome devtools at the moment. I used this to debug code in page.evaluate, whereas putting breakpoints in VSCode in a page.evaluate doesn't seem to do anything. I'll have to continue using args: ['--auto-open-devtools-for-tabs'] which seems like a poor workaround.