Motivation: On Windows we call around 50 times `PrintDeps.exe` which
takes on a very fast machine 500+ms. On Linux we do it around 120 times
(`ldd`) which takes around 150ms.
This change validates the dependencies once on browser install (`npx
playwright install`). In case its failing, it will emit a warning, in
case of a success, it will create a marker file that the binary has been
validated. For future `launch()` calls, we'll read this file and if
exists, we'll not validate again. Otherwise we'll validate again.
Note: If the marker file is older than 30 days, the browser will be
validated again.
Additionally introduce `@playwright/browser-<browser>` packages that
just download the respective browser, but do not export anything.
References #26614.
This should fix:
Error: ENOTEMPTY: directory not empty, rmdir
'C:\Users\RUNNER~1\AppData\Local\Temp\pwt\workspaces\playwright-xyz-should-work-playwright-chromium-should-work-installation-tests\browsers\chromium-1076\chrome-win'
Before all the browser downloads were stored in the workspace folder for
the corresponding test. After this change, we clean it up once the test
has finished to save disk space.
~800 MB per test before, now 30MB.
Migrate to version 4 which returns a promise rather than leverages a
callback. -> https://www.npmjs.com/package/rimraf?activeTab=readme
- contains its own types, eliminate "@types/rimraf"
- Parameter `maxBusyTries` changed to `maxRetries`
This patch:
- changes the `childProcess` fixture to reliably SIGKILL all descendants
(children and grand-children, regardless of their process group).
This is achieved using the `ps` command to build the process tree, and
then send
`SIGKILL` to the descendant process groups.
- changes the `runCLI` fixture to **not** auto-close codegen by default;
the `childProcess` fixture will clean up all processes. This makes
sure that all `runCLI.waitFor()` commands actually wait until the
necessary
output.
- for a handful of tests that do actually want to auto-close codegen,
introduce an optional `autoCloseWhen` flag for the `runCLI` fixture
that makes sure to close the codegen once a certain output was reached.
This removes everything related to docker integration experiments that
we conducted over the last 6 months.
I'll send a follow-up with an alternative suggestion that was demo'ed on
a team meeting in the end of December.
This patch adds a reverse proxy in front of novnc and playwright
server inside the container.
As a result:
- container exposes a single HTTP port to the host
- all Playwright clients can connect using this exposed port, e.g.
`http://127.0.0.1:5400`
- navigating to the exposed port in the browser lands on a nice HTML
page
with a link to view container screen
- users can also manually navigate to `http://127.0.0.1:5400/screen` to
view screen
This configuration option allows to set a string with template
values for precise control over snapshot path location.
An example of `snapshotPathTemplate` usage:
```ts
// playwright.config.ts
// Notice the `testDir` configuration!
export default {
testDir: './tests',
snapshotPathTemplate: './__screenshots__/{platform}/{projectName}/{testFilePath}/{arg}{ext}',
}
```
Currently supported "magic tokens" inside the `snapshotPathTemplate`
are:
- `{testDir}` - project's `testDir`
- `{snapshotDir}` - project's `snapshotDir`
- `{platform}` - `process.platform`
- `{projectName}` - Project's sanitized name
- `{testFileDir}` - Directories in relative path from `testDir` to test
file path (e.g. `page/` in the example below)
- `{testFileName}` - Test file name (with extension) (e.g.
`page-click.spec.ts` in the example below)
- `{testFilePath}` - Relative path from `testDir` to test file path
(e.g. `page/page-click.spec.ts` in the example below)
- `{ext}` - snapshot extension (with dots)
- `{arg}` - joined snapshot name parts, without extension (e.g.
`foo/bar/baz` in the example below)
- `{snapshotSuffix}` - `testInfo.snapshotSuffix` value.
Consider the following file structure:
```
playwright.config.ts
tests/
└── page/
└── page-click.spec.ts
```
The following `page-click.spec.ts`:
```ts
// page-click.spec.ts
import { test, expect } from '@playwright/test';
test('should work', async ({ page }) => {
await expect(page).toHaveScreenshot(['foo', 'bar', 'baz.png']);
});
```
Fixes#7792