This directory contains JS tests that make use of Puppeteer. Puppeteer is a Node.js library that provides an API to instantiate and control a headless Chromium browser. Most things that can be done manually in the browser can be done using Puppeteer.
Examples of such tests might include:
Screenshot-grabbing tests. For example, in the case of lit-html components, such a test might perform the following steps:
Integration tests. Example steps:
Tests under this directory use the Mocha test runner.
Any output files generated from these tests (e.g. screenshots) will be found in $SKIA_INFRA_ROOT/golden/puppeteer-tests/output
.
Puppeteer tests run inside a Docker container. This provides a more stable testing environment and reduces screenshot flakiness.
The corresponding Dockerfile
can be found in $SKIA_INFRA_ROOT/golden/puppeteer-tests/docker
.
Run make puppeteer-test
from $SKIA_INFRA_ROOT/golden
. This will build and run a Docker container that executes the Mocha test runner. Then, look at $SKIA_INFRA_ROOT/golden/puppeteer-tests/output
for the created PNGs.
If you wish to run these tests outside of Docker, try make puppeteer-test-nodocker
. Or equivalently, cd
into $SKIA_INFRA_ROOT/golden/puppeteer-tests/test
and run npx mocha
.
The two options below run the tests outside of Docker.
cd
into $SKIA_INFRA_ROOT/golden/puppeteer-tests/test
and run npx mocha debug
. This will start the tests and immediately drop into the Node.js inspector.cd
into $SKIA_INFRA_ROOT/golden/puppeteer-tests/test
and run npx mocha --inspect-brk
. This will start the tests and wait until a debugger is attached. Attach any debugger of your liking, e.g. Chrome Dev Tools, VSCode, IntelliJ, etc. See here for more.