-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from gma/automated-documentation-update-1173190…
…6767 Automated documentation update
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
|
||
# Playwright Test Browser Dependencies (playwright) | ||
|
||
Installs Playwright browsers' dependencies, and caches browsers in Docker volume. | ||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/gma/devcontainer-features/playwright:1": {} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
|-----|-----|-----|-----| | ||
| browsers | List of browsers whose dependencies will be installed | string | chromium | | ||
|
||
## Notes on usage | ||
|
||
This feature has been written to speed up the installation of [Playwright] within your devcontainers. | ||
|
||
Playwright is installed with `npm`, which means we need Node.js to be installed inside your devcontainer. You can achieve that by including the Node feature in your your `devcontainre.json` file, alongside this Playwright feature: | ||
|
||
```json | ||
"features": { | ||
... | ||
"ghcr.io/devcontainers/features/node:1": {}, | ||
"ghcr.io/gma/devcontainer-features/playwright:1": {}, | ||
... | ||
}, | ||
``` | ||
|
||
While your devcontainer is building this feature will: | ||
|
||
- Temporarily install the latest version of the `playwright` package | ||
- Use Playwight to install any operating system dependencies required by the browers you want to use (i.e. it runs `npx playwright install-deps <browser>`) | ||
- Setup a named volume called `playwright-browsers` that Playwright will (later) use when you actually install some browsers | ||
|
||
By default the dependencies for Chromium are installed. If you'd like to specify different browsers you can so by setting the "browsers" option: | ||
|
||
```json | ||
... | ||
"ghcr.io/gma/devcontainer-features/playwright:1": { | ||
"browsers": "firefox chrome" | ||
}, | ||
... | ||
``` | ||
|
||
Once the container is running, you'll take care of installing Playwright in your application as normal, with a command like this: | ||
|
||
```sh | ||
npm install --save-dev playwright@<version> | ||
``` | ||
|
||
Once you've installed Playwright into your project, you'll be able to install the browsers you want to use: | ||
|
||
```sh | ||
npx playwright install chromium | ||
``` | ||
|
||
The `playwright install` command will store the downloaded Chromium files in `/playwright/browsers`, which is mounted as a Docker volume. They'll therefore persist if you delete and then restart the container, or rebuild the image. | ||
|
||
[Playwright]: https://playwright.dev | ||
|
||
|
||
--- | ||
|
||
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/gma/devcontainer-features/blob/main/src/playwright/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ |