The web content of the abptestpages.org domain is automatically generated from the files in this repository.
See ARCHITECTURE.md for a full overview of the project structure, CMS pipeline, and test infrastructure.
The following tools are needed:
- Node >= 22
- npm >= 10
- Python 3
- Docker
The execution is done in Docker.
Checks are done using:
flake8with the flake8-eyeo extension for python scripts- npm
linthtmlfor html content - npm
eslintfor javascript content - npm
stylelintfor CSS content
To run the lint image:
docker build -t lintimage -f test/lint.Dockerfile .
docker run -it lintimageTests can be executed with:
docker build -t testpages .
docker run --shm-size=2g -it testpagesfirefox latest is the default browser. Other browsers can be run using the
GREP argument:
docker run --shm-size=2g -e GREP="chrome latest" -it testpagesThe available browsers are:
- chromium 79.0.3945.0 (oldest supported version, MV2)
- chromium 128.0.6613.0 (latest chromium version supporting MV2 extensions)
- chrome latest
- chrome beta
- chrome dev
- firefox latest
- firefox beta
- firefox 75.0
- firefox 68.0
- edge latest
- edge beta
GREP supports regular expressions syntax, which means it can be extended to
run a subset of those tests. Example:
docker run --shm-size=2g -e GREP="chrome latest.*(Blocking|Popup)" -it testpagesTo exclude a subset of the tests, use a negative regular expression. Example:
docker run --shm-size=2g -e GREP="^.*chrome latest((?\!Snippets).)*\$" -it testpagesThe default extension used to run the tests is the one matching the master
revision of adblockplusui/adblockpluschrome. Other packed extensions may be
used by providing the EXTENSION_FILE argument when building the image.
Example:
docker build -t testpages --build-arg EXTENSION_FILE="adblockpluschrome-*.zip" .Running the tests with a custom extension needs the SKIP_EXTENSION_DOWNLOAD
argument to be set to true, otherwise the custom extension would be overridden
by the default extension. Example:
docker run --shm-size=2g -e SKIP_EXTENSION_DOWNLOAD="true" -it testpagesAny ad blocking extension can be used to run automated tests on testpages, as long as it provides the following APIs:
subscriptions.get(ignoreDisabled, downloadable)- returning subscriptions urlssubscriptions.remove(url)- removing subscription with provided urlfilters.get- listing all filters available for userfilters.remove(text)- removing filter with provided textfilters.importRaw(text)- adding filter in a raw format with text specifieddebug.getLastError- returning last error thrown in extension consoletesting.getReadyState- returning "started" when the extension is ready to interact with. Only ABP is expected to implement this interface
The default behavior for debug.getLastError is to log a warning. That can be
changed to throw an actual error by setting the THROW_LAST_ERROR argument to
true. Example:
docker run --shm-size=2g -e THROW_LAST_ERROR="true" -it testpagesIn order to access the screenshots for failing tests run the following command,
which copies the screenshots to <destination> folder:
docker cp $(docker ps -aqf ancestor=testpages | head -n 1):/testpages.adblockplus.org/test/screenshots <destination>Another useful resource are the nginx (test pages server) logs. In order to access them, run the following command:
docker cp $(docker ps -aqf ancestor=testpages | head -n 1):/var/log/nginx/ <destination>To browse the rendered test pages locally add the domain local.testpages.adblockplus.org
to your host /etc/hosts once:
127.0.0.1 local.testpages.adblockplus.org
Then start the nginx server in Docker:
docker build -t testpages .
./test/start-nginx-server.sh testpagesThe site will be available at https://local.testpages.adblockplus.org:5001/en/. The certificate is self-signed, so you'll need to accept the browser warning.
Note: Other local debugging tools are documented in Local execution without Docker.