playwright
playwright copied to clipboard
[Bug]: Playwright Test for VSCode not always running global setup
trafficstars
Version
1.46.0
Steps to reproduce
- Install VS Code and add the Playwright Test for VSCode extension.
- Clone https://github.com/twalshOG/PlaywrightBug
- Run the test (this project only has one test for simplicity sake) from the Playwright test explorer
Note that global setup ran
- Run the test again via the test explorer
Note that global setup did not run
Expected behavior
I would expect global setup to run each time I run
Actual behavior
Global setup not running on subsequent runs when tests are run via the Playwright test extension for VS Code.
Additional context
Work arounds
- Close and reopen VS Code
- Manually trigger "Run global teardown"
This makes it so the next run will run global setup, but runs after that will continue to skip global setup.
Thoughts
- This look something was intentionally done
- If I am using my own test web service it stays up between runs
- The SETUP section of the TESTING: PLAYWRIGHT VSCode bar disables Run global setup and enables Run global teardown.
- Within many contexts this would work great, however it gets really unpleasant when trying to update/debug global setup
Recommendations
- Document when global setup/teardown should be/will be executed when using VSCode
- Add a setting that allows users to decide if they want to use the same global setup between test runs
Environment
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Max
Memory: 195.63 MB / 32.00 GB
Binaries:
Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
Yarn: 1.22.21 - /opt/homebrew/bin/yarn
npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
IDEs:
VSCode: 1.92.0 - /opt/homebrew/bin/code
Languages:
Bash: 3.2.57 - /bin/bash
npmPackages:
@playwright/test: ^1.46.0 => 1.46.0
Test extension:
Playwright Test for VSCode: v1.1.7
Looks like this is likely related to #32103
A setting makes sense to me.
Would such a setting also result in globalTeardown being ran after each test run? Right now it seems like it's never ran, which means you can end up with stale state that isn't cleaned up.