chore: hide docker integration behind the curtain (#17715)

This is not ready for the prime time yet.
This commit is contained in:
Andrey Lushnikov 2022-09-29 17:22:09 -04:00 committed by GitHub
parent d009500fa1
commit d897407833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 57 deletions

View File

@ -146,59 +146,3 @@ The image will be tagged as `playwright:localbuild-focal` and could be run as:
docker run --rm -it playwright:localbuild /bin/bash docker run --rm -it playwright:localbuild /bin/bash
``` ```
## (Experimental) Playwright Test Docker Integration
* langs: js
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.
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/
If you use [Docker Desktop](https://www.docker.com/products/docker-desktop/), make sure to increase
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
```
1. Run Docker container in the background.
```bash js
npx playwright docker start
```
1. Run tests inside Docker container using the `PLAYWRIGHT_DOCKER` environment variable.
You can set this environment variable as a part of your config:
```ts
// playwright.config.ts
import type { PlaywrightTestConfig } from '@playwright/test';
process.env.PLAYWRIGHT_DOCKER = '1';
const config: PlaywrightTestConfig = {
/* ... configuration ... */
};
export default config;
```
NOTE: Playwright will automatically detect a running Docker container or start it if needed.
1. Finally, stop background Docker container when you're done working with tests:
```bash js
npx playwright docker stop
```

View File

@ -276,7 +276,7 @@ function createStacklessError(message: string) {
} }
export function addDockerCLI(program: Command) { export function addDockerCLI(program: Command) {
const dockerCommand = program.command('docker') const dockerCommand = program.command('docker', { hidden: true })
.description(`Manage Docker integration (EXPERIMENTAL)`); .description(`Manage Docker integration (EXPERIMENTAL)`);
dockerCommand.command('build') dockerCommand.command('build')