mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-16 18:58:45 +00:00
26e413e04d
Porting first selenium test from Ruby to Node.js using the mocha framework. Starting with `category.feature` test. Tests are placed in a new `tests/selenium` folder with their own eslint config. Bug: T190710 Change-Id: Iad954405a5ae0608fd5dc90dd5dfa434b3781037
31 lines
973 B
JavaScript
31 lines
973 B
JavaScript
/**
|
|
* World
|
|
*
|
|
* World is a function that is bound as `this` to each step of a scenario.
|
|
* It is reset for each scenario.
|
|
* https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/world.md
|
|
*
|
|
* Contrary to Cucumber.js best practices, this `MinervaWorld` is not being
|
|
* bound to scenarios with the `setWorldConstructor` like this:
|
|
*
|
|
* setWorldConstructor(MinervaWorld);
|
|
*
|
|
* Instead, it acts as a simple function that encapsulates all dependencies,
|
|
* and is exported so that it can be imported into each step definition file,
|
|
* allowing us to use the dependencies across scenarios.
|
|
*/
|
|
|
|
const MwBot = require( 'mwbot' ),
|
|
mwCorePages = require( '../support/pages/mw_core_pages' ),
|
|
minervaPages = require( '../support/pages/minerva_pages' );
|
|
|
|
function MinervaWorld() {
|
|
/* dependencies */
|
|
this.api = new MwBot();
|
|
/* pageObjects */
|
|
Object.assign( this, mwCorePages );
|
|
Object.assign( this, minervaPages );
|
|
}
|
|
|
|
module.exports = new MinervaWorld();
|