Jump to content

Selenium/Getting Started/Run tests using Fresh

From mediawiki.org

Environments

[edit]

When using Fresh, you can target several wikis.

Advantages

[edit]
  • It will be fast, if the target is local. MediaWiki core Selenium test run takes about 2 minutes on my machine. (As of October 2019.)
  • Works without an internet connection, if the target is local.
  • Doesn't require executing npm packages directly on your machine (which is dangerous).

Disadvantages

[edit]
  • You need to have Docker installed.

Prerequisites

[edit]

Go to MediaWiki Core folder

[edit]
cd core

Environment variables

[edit]

If you're targeting MediaWiki-Docker, you don't have to do anything. If you're targeting another setup, see Selenium/How-to/Set environment variables.

Start a Fresh session

[edit]
you:core$ fresh-node -env -net

...

# env: MW_*, MEDIAWIKI_*
# net: expose host

🌱  Fresh!

nobody@docker-desktop:/core$

Install dependencies

[edit]
nobody@docker-desktop:/core$ npm ci

Run Selenium tests

[edit]
nobody@docker-desktop:/core$ npm run selenium-test

ERROR @wdio/runner: Error: connect ECONNREFUSED

[edit]

If you're getting ERROR @wdio/runner: Error: connect ECONNREFUSED, the Fresh container should use /usr/lib/chromium/chromium instead of the default /usr/bin/chromium. The simplest way to do it is to change path to Chromium.

wdio-defaults.conf.js

exports.config = {
  capabilities: [ {
    'goog:chromeOptions': {
      binary: '/usr/lib/chromium/chromium'
    }
  } ]
};

More information

[edit]