Skip to content

Commit

Permalink
docs: improvements to ci provider configs (#2565)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunattam authored Jun 13, 2020
1 parent 9854438 commit 6530c18
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
46 changes: 45 additions & 1 deletion docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ Playwright tests can be executed to run on your CI environments. To simplify thi
* [Travis CI](#travis-ci)
* [CircleCI](#circleci)
* [AppVeyor](#appveyor)
* [Bitbucket Pipelines](#bitbucket-pipelines)
- [Caching browsers](#caching-browsers)
- [Exception: `node_modules` are cached](#exception-nodemodules-are-cached)
- [Directories to cache](#directories-to-cache)
- [Debugging browser launches](#debugging-browser-launches)
- [Running headful](#running-headful)
<!-- GEN:stop -->

Broadly, configuration on CI involves **ensuring system dependencies** are in place, **installing Playwright and browsers** (typically with `npm install`), and **running tests** (typically with `npm test`). Windows and macOS build agents do not require any additional system dependencies. Linux build agents can require additional dependencies, depending on the Linux distribution.
Expand Down Expand Up @@ -66,7 +68,18 @@ Suggested configuration

For Windows or macOS agents, no additional configuration required, just install Playwright and run your tests.

For Linux agents, refer to [our Docker setup](docker/README.md) to see additional dependencies that need to be installed.
For Linux agents, you can use [our Docker container](docker/README.md) with Azure Pipelines support for [running containerized jobs](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops). Alternatively, you can refer to the [Dockerfile](docker/README.md) to see additional dependencies that need to be installed on a Ubuntu agent.

```yml
pool:
vmImage: 'ubuntu-18.04'
container: aslushnikov/playwright:bionic
steps:
- script: npm install
- script: npm run test
```

### Travis CI

Expand Down Expand Up @@ -146,6 +159,21 @@ We run our tests on CircleCI, with our [pre-built Docker image](docker/README.md

We run our tests on Windows agents in AppVeyor. Use our [AppVeyor configuration](/.appveyor.yml) to create your own.

### Bitbucket Pipelines

Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](docker/README.md)).

```yml
image: aslushnikov/playwright:bionic
```

While the Docker image supports sandboxing for Chromium, it does not work in the Bitbucket Pipelines environment. To launch Chromium on Bitbucket Pipelines, use the `--no-sandbox` launch argument.

```js
const { chromium } = require('playwright');
const browser = await chromium.launch({ args: ['--no-sandbox'] });
```

## Caching browsers

By default, Playwright downloads browser binaries when the Playwright NPM package
Expand Down Expand Up @@ -193,3 +221,19 @@ Playwright supports the `DEBUG` environment variable to output debug logs during
```
DEBUG=pw:browser* npm run test
```

## Running headful

By default, Playwright launches browsers in headless mode. This can be changed by passing a flag when the browser is launched.

```js
// Works across chromium, firefox and webkit
const { chromium } = require('playwright');
const browser = await chromium.launch({ headless: false });
```

On Linux agents, headful execution requires [Xvfb](https://en.wikipedia.org/wiki/Xvfb) to be installed. Our [Docker image](docker/README.md) and GitHub Action have Xvfb pre-installed. To run browsers in headful mode with Xvfb, add `xvfb-run` before the Node.js command.

```
xvfb-run node index.js
```
4 changes: 4 additions & 0 deletions docs/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ $ sudo docker container run -it --rm --ipc=host --security-opt seccomp=chrome.js
> to run Chrome without sandbox.
> Using `--ipc=host` is also recommended when using Chrome. Without it Chrome can run out of memory and crash.
> [See the docker documentation for this option here.](https://docs.docker.com/engine/reference/run/#ipc-settings---ipc)
## Playwright on Alpine

Browser builds for Firefox and WebKit are built for the [glibc](https://en.wikipedia.org/wiki/GNU_C_Library) library. Alpine Linux and other distributions that are based on the [musl](https://en.wikipedia.org/wiki/Musl) standard library are not supported.

0 comments on commit 6530c18

Please sign in to comment.