Test web pages with Playwright, Chrome, axe, and Lighthouse in a multi-stage Python image.
1.5K
Test web pages with Playwright, Chrome, axe, and Lighthouse in a multi-stage Python image.
COPY --from to merge Node.js tools into a Python base imagePLAYWRIGHT_BROWSERS_PATH controls where Playwright stores its browser downloadDETECT_CHROMEDRIVER_VERSION=true matches ChromeDriver to an installed Chrome versionThis image contains:
Use it for browser tests, behavior tests, and accessibility checks. The working
directory is /workspace. The default command starts Bash. The image includes
Chromium and Chrome. For Firefox and WebKit, a separate installation is necessary.
| Tag | Meaning | Platform |
|---|---|---|
latest | Latest successful build from main. | linux/amd64 |
View all tags on Docker Hub.
The latest tag changes when a new build passes its tests.
docker pull stden/web-qa:latest
Run these commands from your project directory. Give the browser tests shared memory
with --shm-size=1g.
docker run --rm --shm-size=1g -v "$PWD":/workspace \
stden/web-qa:latest pytest
docker run --rm --shm-size=1g -v "$PWD":/workspace \
stden/web-qa:latest behave
Install extra project dependencies in a child image. Keep the installed
Playwright package and its browser revision together. If you change the package
version, run python -m playwright install --with-deps chromium in that build.
For Python Playwright code, use playwright.chromium.launch() for Chromium.
Set channel="chrome" to use Google Chrome.
Replace https://example.com with the page to test. The commands save the reports to
the mounted project directory.
docker run --rm --shm-size=1g -v "$PWD":/workspace stden/web-qa:latest \
axe https://example.com --exit \
--chrome-options="no-sandbox,disable-dev-shm-usage,remote-debugging-pipe" \
--save axe.json
docker run --rm --shm-size=1g -v "$PWD":/workspace stden/web-qa:latest \
lighthouse https://example.com --only-categories=accessibility \
--chrome-flags="--headless --no-sandbox --disable-dev-shm-usage" \
--output=html --output-path=lighthouse.html
Use these commands only for pages that you control. They run Chrome without its
sandbox in a disposable container. Inside the container, localhost is the
container itself. Use a Docker network and a service name to connect to another
container.
The smoke test opens a local page in Chromium and Chrome. It also runs pytest, Behave, axe, and a Lighthouse accessibility check.
Content type
Image
Digest
sha256:0dcfe5764…
Size
1.3 GB
Last updated
1 day ago
docker pull stden/web-qa