Debian Codegraph @

tests/selenium/wdio-mediawiki/README.md

raw symbols SCIP
1 # wdio-mediawiki
2
3 A plugin for [WebdriverIO](https://webdriver.io) providing utilities to simplify testing of MediaWiki features.
4
5 ## Getting Started
6
7 ### Page
8
9 The `Page` class is a base class for following the [Page Objects Pattern](https://webdriver.io/docs/pageobjects).
10
11 * `openTitle( title [, Object query [, string fragment ] ] )`
12
13 The convention is for implementations to extend this class and provide an `open()` method
14 that calls `super.openTitle()`, as well as add various getters for elements on the page.
15
16 See [BlankPage](./BlankPage.js) and [specs/BlankPage](./specs/BlankPage.js) for an example.
17
18 ### Api
19
20 Utilities to interact with the MediaWiki API. Uses the [mwbot](https://github.com/gesinn-it-pub/mwbot) library.
21
22 Actions are performed logged-in using `browser.config.mwUser` and `browser.config.mwPwd`,
23 which typically come from `MEDIAWIKI_USER` and `MEDIAWIKI_PASSWORD` environment variables.
24
25 * `bot([string username [, string password [, string baseUrl ] ] ])`
26 * `createAccount(MWBot bot, string username, string password)`
27 * `blockUser(MWBot bot, [ string username [, string expiry ] ])`
28 * `unblockUser(MWBot bot, [ string username ])`
29
30 Example:
31
32 ```js
33 bot = await Api.bot();
34 await bot.edit( 'Some page', 'Some initial content' );
35 await bot.edit( 'Some page', 'Some other content', 'Optional edit reason here' );
36 await bot.delete( 'Some page', 'Some deletion reason here' );
37 ```
38
39 ### RunJobs
40
41 Use the static `RunJobs.run()` method to ensure that any queued jobs are executed before
42 making assertions that depend on its outcome.
43
44 ### Util
45
46 `Util` is a collection of popular utility methods.
47
48 * `getTestString([ string prefix ])`
49 * `waitForModuleState(string moduleName [, string moduleStatus [, number timeout ] ])`
50
51 ## Versioning
52
53 This package follows [Semantic Versioning guidelines](https://semver.org) for its releases. In
54 particular, its major version must be bumped when compatibility is removed for a previous of
55 MediaWiki.
56
57 It is the expectation that this module will only support a single version of MediaWiki at any
58 given time, and that tests in older branches of MediaWiki-related projects naturally use the older
59 release line of this package.
60
61 In order to allow for smooth and decentralised upgrades, it is recommended that the only type of
62 breaking change made to this package is a change that removes something. Thus, in order to change
63 something, it must either be backwards-compatible, or must be introduced as a new method that
64 co-exists with its deprecated equivalent for at least one release.
65
66 ## Issue tracker
67
68 Please report issues to [Phabricator](https://phabricator.wikimedia.org/tag/mediawiki-core-tests).
69
70 ## Contributing
71
72 This module is maintained in the MediaWiki core repository and published from there as a
73 package to npmjs.org. To simplify development and to ensure changes are verified
74 automatically, MediaWiki core itself uses this module directly from the working copy
75 using [npm Local Paths](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#local-paths).