Selenium/How-to/Run tests targeting Quibble

From mediawiki.org
Jump to navigation Jump to search

This page describes how to run Selenium tests locally against your own Quibble MediaWiki install.

Advantages[edit]

  • It will be fast, since the target machine is local. MediaWiki core Selenium test run takes about 3 minutes on my machine. (As of March 2020.)
  • Works without an internet connection.
  • Doesn't require installing ChromeDriver or FFmpeg (compared to bare installs).
  • Doesn't require executing npm packages directly on your machine (which is scary).

Disadvantages[edit]

  • You need to have Docker installed.

Prerequisites[edit]

Setup Quibble[edit]

docker pull docker-registry.wikimedia.org/releng/quibble-stretch-php72:latest
git clone "https://gerrit.wikimedia.org/r/integration/quibble"
cd quibble
mkdir -p ref/mediawiki/skins
git clone --bare https://gerrit.wikimedia.org/r/mediawiki/core ref/mediawiki/core.git
git clone --bare https://gerrit.wikimedia.org/r/mediawiki/vendor ref/mediawiki/vendor.git
git clone --bare https://gerrit.wikimedia.org/r/mediawiki/skins/Vector ref/mediawiki/skins/Vector.git
mkdir cache
chmod 777 cache
mkdir -p log
chmod 777 log
mkdir -p src
chmod 777 src
docker run -it --rm \
  -v "$(pwd)"/cache:/cache \
  -v "$(pwd)"/log:/workspace/log \
  -v "$(pwd)"/ref:/srv/git:ro \
  -v "$(pwd)"/src:/workspace/src \
  docker-registry.wikimedia.org/releng/quibble-stretch-php72:latest
If you get PHP Fatal error error, you can continue with the next step. It should work. See phab:T278707.

Run Selenium tests[edit]

docker run -it --rm \
  -v "$(pwd)"/cache:/cache \
  -v "$(pwd)"/log:/workspace/log \
  -v "$(pwd)"/ref:/srv/git:ro \
  -v "$(pwd)"/src:/workspace/src \
  docker-registry.wikimedia.org/releng/quibble-stretch-php72:latest \
  --skip-zuul \
  --skip-deps \
  --run selenium

Log files are located in log folder, including videos of all tests.

ls -1 log/*.mp4

log/Page--should-be-creatable--CHROME--03-29-2021--17-16-57-680.mp4
log/Page--should-be-deletable--CHROME--03-29-2021--17-17-14-777.mp4
log/Page--should-be-editable-daily--CHROME--03-29-2021--17-17-08-260.mp4
log/Page--should-be-previewable--CHROME--03-29-2021--17-16-47-471.mp4
log/Page--should-be-re-creatable--CHROME--03-29-2021--17-17-02-981.mp4
log/Page--should-have-history-daily--CHROME--03-29-2021--17-17-12-006.mp4
log/User--should-be-able-to-create-account--CHROME--03-29-2021--17-18-48-341.mp4