wiki.techinc.nl/tests/selenium/wdio-mediawiki
Željko Filipin 4f62b94d4e selenium: Add timestamp to screenshot file name
When debugging, it's useful to have screenshots from multiple test runs.
At the moment, file name is created only with test suite name and test
name. When a new test (suite) is executed, screenshots from the previous
one are overwritten.

This patch adds date and time in a slightly modified ISO 8601 format.
(Colons and dots are replaced with dashes.)

Example old file name:
Special%3ARecentChanges-shows-page-creation.png

Example new file name:
Special%3ARecentChanges-shows-page-creation-2021-04-27T12-58-01-822Z.png

Bug: T280970
Change-Id: I90fbcdaf5cb22ea455fd55e718e8db3b3c1dfaea
2021-04-28 21:08:56 +00:00
..
specs eslint: Update to eslint-config-wikimedia 0.16.0 2020-06-02 21:32:56 +01:00
Api.js eslint: Update to eslint-config-wikimedia 0.16.0 2020-06-02 21:32:56 +01:00
BlankPage.js selenium: Tests pass if Vector skin is not installed 2021-03-09 15:02:03 +00:00
CHANGELOG.md wdio-mediawiki: Release 1.0.0 2019-11-05 14:47:48 -05:00
index.js selenium: Add timestamp to screenshot file name 2021-04-28 21:08:56 +00:00
LICENSE
LoginPage.js eslint: Update to eslint-config-wikimedia 0.16.0 2020-06-02 21:32:56 +01:00
package.json build: Upgrade eslint-config-wikimedia from 0.17.0 to 0.18.1 2021-02-18 08:39:09 -08:00
Page.js eslint: Update to eslint-config-wikimedia 0.16.0 2020-06-02 21:32:56 +01:00
README.md selenium: Fix more inefficient MWBot use and simplify wdio-mediawiki Api 2019-10-04 18:16:28 +01:00
RunJobs.js eslint: Update to eslint-config-wikimedia 0.16.0 2020-06-02 21:32:56 +01:00
Util.js eslint: Update to eslint-config-wikimedia 0.16.0 2020-06-02 21:32:56 +01:00

wdio-mediawiki

A plugin for WebdriverIO providing utilities to simplify testing of MediaWiki features.

Getting Started

Page

The Page class is a base class for following the Page Objects Pattern.

  • openTitle( title [, Object query [, string fragment ] ] )

The convention is for implementations to extend this class and provide an open() method that calls super.openTitle(), as well as add various getters for elements on the page.

See BlankPage and specs/BlankPage for an example.

Api

Utilities to interact with the MediaWiki API. Uses the mwbot library.

Actions are performed logged-in using browser.config.mwUser and browser.config.mwPwd, which typically come from MEDIAWIKI_USER and MEDIAWIKI_PASSWORD environment variables.

  • bot([string username [, string password [, string baseUrl ] ] ])
  • createAccount(MWBot bot, string username, string password)
  • blockUser(MWBot bot, [ string username [, string expiry ] ])
  • unblockUser(MWBot bot, [ string username ])

Example:

bot = await Api.bot();
await bot.edit( 'Some page', 'Some initial content' );
await bot.edit( 'Some page', 'Some other content', 'Optional edit reason here' );
await bot.delete( 'Some page', 'Some deletion reason here' );

RunJobs

Use the static RunJobs.run() method to ensure that any queued jobs are executed before making assertions that depend on its outcome.

Util

Util is a collection of popular utility methods.

  • getTestString([ string prefix ])
  • waitForModuleState(string moduleName [, string moduleStatus [, number timeout ] ])

Versioning

This package follows Semantic Versioning guidelines for its releases. In particular, its major version must be bumped when compatibility is removed for a previous of MediaWiki.

It is the expectation that this module will only support a single version of MediaWiki at any given time, and that tests in older branches of MediaWiki-related projects naturally use the older release line of this package.

In order to allow for smooth and decentralised upgrades, it is recommended that the only type of breaking change made to this package is a change that removes something. Thus, in order to change something, it must either be backwards-compatible, or must be introduced as a new method that co-exists with its deprecated equivalent for at least one release.

Issue tracker

Please report issues to Phabricator.

Contributing

This module is maintained in the MediaWiki core repository and published from there as a package to npmjs.org. To simplify development and to ensure changes are verified automatically, MediaWiki core itself uses this module directly from the working copy using npm Local Paths.