chore(docker): address review comments (#17279)

Co-authored-by: Ross Wollman <rwoll@users.noreply.github.com>
This commit is contained in:
Andrey Lushnikov 2022-09-13 05:55:26 -07:00 committed by GitHub
parent 809c5d8a98
commit 8640d29ce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 21 deletions

View File

@ -149,46 +149,47 @@ docker run --rm -it playwright:localbuild /bin/bash
## (Experimental) Playwright Test Docker Integration
* 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,
while all the code is still running on the host operating system.
Docker container provides a consistent environment, eliminating browser rendering
differences across platforms. Playwright Test will automatically proxy host network traffic
Playwright Test will automatically proxy host network traffic
into the container, so browsers can access servers running on the host.
:::note
Docker integration requires Docker installed & running on your computer.
See https://docs.docker.com/get-docker/
:::
:::note
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:
1. Build a local Docker image that will be used to run containers. This step
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.
```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
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.
4. Finally, stop Docker container when it is no longer needed.
```bash js
npx playwright docker stop
```
4. Finally, stop background Docker container when you're done working with tests:
```bash js
npx playwright docker stop
```

View File

@ -61,10 +61,11 @@ function addDockerCommand(program: Command) {
console.log('Done in ' + (deltaMs / 1000).toFixed(1) + 's');
}
console.log([
`- VNC session: ${info.vncSession}`,
`- View screen:`,
` ${info.vncSession}`,
`- Run tests with browsers inside container:`,
` 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`,
].join('\n'));
});