chore(docker): address review comments (#17279)
Co-authored-by: Ross Wollman <rwoll@users.noreply.github.com>
This commit is contained in:
parent
809c5d8a98
commit
8640d29ce4
|
|
@ -149,46 +149,47 @@ docker run --rm -it playwright:localbuild /bin/bash
|
||||||
## (Experimental) Playwright Test Docker Integration
|
## (Experimental) Playwright Test Docker Integration
|
||||||
* langs: js
|
* langs: js
|
||||||
|
|
||||||
Playwright Test now ships an **experimental** Docker integration.
|
Playwright Test now ships an **experimental** Docker integration. The Docker container provides a consistent environment, eliminating browser rendering differences across platforms.
|
||||||
With this integration, **only** browser binaries are running inside a Docker container,
|
With this integration, **only** browser binaries are running inside a Docker container,
|
||||||
while all the code is still running on the host operating system.
|
while all the code is still running on the host operating system.
|
||||||
|
|
||||||
Docker container provides a consistent environment, eliminating browser rendering
|
Playwright Test will automatically proxy host network traffic
|
||||||
differences across platforms. Playwright Test will automatically proxy host network traffic
|
|
||||||
into the container, so browsers can access servers running on the host.
|
into the container, so browsers can access servers running on the host.
|
||||||
|
|
||||||
:::note
|
:::note
|
||||||
Docker integration requires Docker installed & running on your computer.
|
Docker integration requires Docker installed & running on your computer.
|
||||||
See https://docs.docker.com/get-docker/
|
See https://docs.docker.com/get-docker/
|
||||||
:::
|
|
||||||
|
|
||||||
:::note
|
|
||||||
If you use [Docker Desktop](https://www.docker.com/products/docker-desktop/), make sure to increase
|
If you use [Docker Desktop](https://www.docker.com/products/docker-desktop/), make sure to increase
|
||||||
default CPU and mem limit for better performance.
|
default CPU and memory limit for better performance.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Docker integration usage:
|
Docker integration usage:
|
||||||
|
|
||||||
1. Build a local Docker image that will be used to run containers. This step
|
1. Build a local Docker image that will be used to run containers. This step
|
||||||
needs to be done only once.
|
needs to be done only once.
|
||||||
```bash js
|
|
||||||
npx playwright docker build
|
```bash js
|
||||||
```
|
npx playwright docker build
|
||||||
|
```
|
||||||
|
|
||||||
2. Run Docker container in the background.
|
2. Run Docker container in the background.
|
||||||
```bash js
|
|
||||||
npx playwright docker start
|
```bash js
|
||||||
```
|
npx playwright docker start
|
||||||
|
```
|
||||||
|
|
||||||
3. Run tests inside Docker container. Note that this command accepts all the same arguments
|
3. Run tests inside Docker container. Note that this command accepts all the same arguments
|
||||||
as a regular `npx playwright test` command.
|
as a regular `npx playwright test` command.
|
||||||
```bash js
|
|
||||||
npx playwright docker test
|
```bash js
|
||||||
```
|
npx playwright docker test
|
||||||
|
```
|
||||||
|
|
||||||
Note that this command will detect running Docker container, and auto-launch it if needed.
|
Note that this command will detect running Docker container, and auto-launch it if needed.
|
||||||
|
|
||||||
4. Finally, stop Docker container when it is no longer needed.
|
4. Finally, stop background Docker container when you're done working with tests:
|
||||||
```bash js
|
|
||||||
npx playwright docker stop
|
```bash js
|
||||||
```
|
npx playwright docker stop
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,11 @@ function addDockerCommand(program: Command) {
|
||||||
console.log('Done in ' + (deltaMs / 1000).toFixed(1) + 's');
|
console.log('Done in ' + (deltaMs / 1000).toFixed(1) + 's');
|
||||||
}
|
}
|
||||||
console.log([
|
console.log([
|
||||||
`- VNC session: ${info.vncSession}`,
|
`- View screen:`,
|
||||||
|
` ${info.vncSession}`,
|
||||||
`- Run tests with browsers inside container:`,
|
`- Run tests with browsers inside container:`,
|
||||||
` npx playwright docker test`,
|
` npx playwright docker test`,
|
||||||
`- Stop container *manually* when it is no longer needed:`,
|
`- Stop background container *manually* when you are done working with tests:`,
|
||||||
` npx playwright docker stop`,
|
` npx playwright docker stop`,
|
||||||
].join('\n'));
|
].join('\n'));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue