[Feature] Start webServer inside vscode / while recording / running tests
I can configure webserver to run with tests (an API and a front for instance), but when I want to record, these servers are not started.
Starting webServer from config is currently not supported, I changed it to a feature request.
We could in the future add a button "start Web Server" which is visible if there is a webServer in the config and it stops when either vscode closes or "close browser" button is pressed. For now we recommend to start it manually or use Visual Studio Code launch.json.
Thank you for your answer @mxschmitt I did not know launch.json, I will give it a try.
Plus one on a better way to consistently get the test environment setup when recording via vscode. Both starting the webserver, but also running the global setup & teardown scripts and starting the recording from the baseURL. It is surprising this isn't the case, and playwright should have all the information required from running tests to properly setup a test environment for a new test recording in vs code.
Related to #20059
I agree with tvongaza, and
We could in the future add a button "start Web Server"
I don't think this should be a button. It should run by default. As a PW user, you would very much expect for the extension to work exactly the same as running npx playwright test on command line does (except better). Starting a web server and setup/teardown stuff is part of the test procedure. It already is to be configured: In the PW config file. Even the --ui window does this, and its UI is very close to what the VSCode extension offers.
It would make sense to add an option to disable the auto-run though, in the rare case it leads to problems.
What's worse, you apparently can't configure web servers on a project basis currently, there's just the global webServer array. Outside VSCode, this is not too bad of a constraint, but in VSCode, this means you must start all unrelated webservers by hand or your single selected project won't even start!
This was implemented as part of https://github.com/microsoft/playwright-vscode/pull/624. If you click "Record test", the webserver is started before recording begins.
https://github.com/microsoft/playwright-vscode/pull/661 extends our test suite to ensure this doesn't regress.