playwright
playwright copied to clipboard
[Bug]: UI doesn't call setup and passes incorrect outputDir
Version
1.46.1
Steps to reproduce
Note: the tests don't matter, it's purely a config & setup/teardown issue.
- Set
globalSetupto a file which containsconsole.log("setup", config.projects[0].outputDir) - Set
globalTeardownto a file which containsconsole.log("teardown", config.projects[0].outputDir) - Run
playwright test --output blahand observe that setup and teardown were called and logged appropriately - Run
playwright test --output blah --uiand observe that setup was not called and teardown was called with the incorrect outputDir.
Expected behavior
When running in UI mode, I expected setup to be called before the test started and for the correct config value to be passed. And I expected teardown to be called with the correct config value.
Actual behavior
Setup was not called in UI mode and teardown was called with an incorrect (default) value.
Additional context
The last version where this worked correctly was 1.42. This has broken as of 1.43 and is still broken as of the latest at the time of writing 1.46.1.
Related to https://github.com/microsoft/playwright/issues/30886
Environment
System:
OS: Windows 10 10.0.19045
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Memory: 10.74 GB / 15.95 GB
Binaries:
Node: 20.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 10.5.2 - C:\Program Files\nodejs\npm.CMD
IDEs:
VSCode: 1.92.2 - C:\Users\User\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
Languages:
Bash: 4.4.23 - C:\Program Files\Git\usr\bin\bash.EXE
npmPackages:
@playwright/test: ^1.43.0 => 1.43.0
Cannot reproduce it with 1.46.1, global setup runs once before all tests and you can see it in the output panel
(), global teardown runs once when UI mode window is closed. Can you share full project where it is not working?
I didn't know that button opened output. Okay so slight edit to the bug report then with that knowledge:
- Previously (1.42 and lower) the setup output was written to the console where the playwright command was run, now it's written to the output tab of the playwright UI window.
- And the output in that tab still shows the incorrect outputDir when logged.
Here's a repro repo: https://github.com/CreativeTechGuy/playwright-outputDir-repro
Thanks for the repro, that helps! outputDir indeed seems to be incorrect in UI mode, I'm gonna write a fix for that.