1 const assert
= require( 'assert' ),
2 Api
= require( 'wdio-mediawiki/Api' ),
3 WatchlistPage
= require( '../pageobjects/watchlist.page' ),
4 WatchablePage
= require( '../pageobjects/watchable.page' ),
5 LoginPage
= require( 'wdio-mediawiki/LoginPage' );
7 describe( 'Special:Watchlist', function () {
8 let username
, password
;
10 function getTestString( prefix
= '' ) {
11 return prefix
+ Math
.random().toString() + '-öäü-♠♣♥♦';
15 username
= getTestString( 'user-' );
16 password
= getTestString( 'password-' );
18 browser
.call( function () {
19 return Api
.createAccount( username
, password
);
23 beforeEach( function () {
24 browser
.deleteCookie();
25 LoginPage
.login( username
, password
);
28 it( 'should show page with new edit', function () {
29 const title
= getTestString( 'Title-' );
31 browser
.call( function () {
32 return Api
.edit( title
, getTestString() ); // create
34 WatchablePage
.watch( title
);
35 browser
.call( function () {
36 return Api
.edit( title
, getTestString() ); // edit
41 assert
.strictEqual( WatchlistPage
.titles
[ 0 ].getText(), title
);