Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Browser closes when debugging tests in VS Code even with "Show browser" toggled on #34083

Open
segevfiner opened this issue Dec 19, 2024 · 3 comments

Comments

@segevfiner
Copy link
Contributor

Version

1.49.1

Steps to reproduce

  1. Create a new vue project with Playwright using pnpm create vue.
  2. cd <project>
  3. pnpm i
  4. Open it in VS Code.
  5. Open e2e/vue.spec.ts.
  6. Set a breakpoint in the test and run it with debugging.

Expected behavior

The browser remains open after the test finishes.

Actual behavior

The browser closes when the test finishes. Unlike in run test without debugging.

Additional context

The extension also doesn't seem to break when the test fails in debug mode anymore.

Environment

System:
    OS: macOS 14.7.2
    CPU: (10) arm64 Apple M1 Pro
    Memory: 109.00 MB / 16.00 GB
  Binaries:
    Node: 18.20.5 - ~/.local/state/fnm_multishells/19564_1734601341724/bin/node
    npm: 10.9.1 - ~/.local/state/fnm_multishells/19564_1734601341724/bin/npm
    pnpm: 9.15.0 - ~/.local/state/fnm_multishells/19564_1734601341724/bin/pnpm
  IDEs:
    VSCode: 1.96.1 - /usr/local/bin/code
  Languages:
    Bash: 5.2.37 - /opt/homebrew/bin/bash
  npmPackages:
    @playwright/test: ^1.49.0 => 1.49.1
@pavelfeldman
Copy link
Member

This works fine for me. Did you install browsers (pnpm exec playwright install)?

@segevfiner
Copy link
Contributor Author

Yep. The tests do run. They browser just closes immediately when the tests end when debugging the test. I can post a video or any other debug info that can help.

@pavelfeldman
Copy link
Member

I misread your report and simply ran the test. I can repro debug mode closing the page.

We do that because in debug mode we don't reuse the browser / browser context between tests /runs. That is so that you did not end up debugging side-effects from previous runs. As a side-effect of that, the browser context is closed after each test. You basically need a breakpoint in the last line of your test to keep the window open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants