In experimental ESM mode a child process is forked in order to run the tests. Currently the exit code of this child process is not propagated to the exit code of the parent process, which means that the process exits with a status code of `0` even if some of the tests failed.
This makes it difficult to use Playwright in CI in experimental mode, as the CI pipeline as a whole will pass despite the test failures.
This change addresses this by propagating the exit code in the case where it is non-zero.
This patch introduces `npm_i` command to install locally-built versions of
Playwright packages instead of fetching them from the registry.
With this patch:
```bash
npm i ${PLAYWRIGHT_CORE_TGZ}` # never needed anymore
npm_i playwright-core # the right way to install local package
```
Note that you can pass any NPM arguments to `npm_i` and cannot use it to install non-playwright packages.
* chore: improve installation tests
- all helper scripts and files are moved to `fixture-scripts`
subfolder.
- `./run_all_tests.sh` now shows a counter to estimate progress
- function `copy_test_scripts` is no longer needed; all fixture
scripts are automatically copied to test folder
Co-authored-by: Max Schmitt <max@schmitt.mx>
Co-authored-by: Max Schmitt <max@schmitt.mx>
This patch refactors installation tests. With this
refactoring:
- each test is a separate file
- to run a single test, just run the bash file
* tests support optional `--no-build` flag to re-use previously
built packages.
* tests support optional `--debug` flag to see line-by-line test output
* failed tests print a line that can be copied-and-pasted locally
to debug the test
- run all tests with `//installation-tests/run_all_tests.sh`
* test output is hidden for successful runs when run locally and is
shown when test fails
* runs all tests, and reports failed tests in the end
* command output is split into groups when viewed on Github.
This changes PlaywrigtServer to serve connections like `ws://localhost:3333/?browser=chromium`:
- launches the browser;
- talks `browserType.connect`-style protocol over websocket;
- compatible with `connectOptions` fixture.
```js
await playwright.chromium.connect({ wsEndpoint: 'ws://localhost:3333/?browser=chrome' });
```
The new (as of 1.18) `async testInfo.attach(…)` API handles this
gracefully (and is part of the reason for the new API's existence).
However, for the foreseeable future, it's still possible to manually
push onto the attachments array where we can't validate the contents
until it's too late, so this change ensures more graceful handling in
that case.
Fixes#11565