Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / tests / selenium / specs / specialwatchlist.js
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' ),
6 Util = require( 'wdio-mediawiki/Util' );
7
8 describe( 'Special:Watchlist', function () {
9 let username, password;
10
11 before( function () {
12 username = Util.getTestString( 'user-' );
13 password = Util.getTestString( 'password-' );
14
15 browser.call( function () {
16 return Api.createAccount( username, password );
17 } );
18 } );
19
20 beforeEach( function () {
21 browser.deleteCookie();
22 LoginPage.login( username, password );
23 } );
24
25 it( 'should show page with new edit', function () {
26 const title = Util.getTestString( 'Title-' );
27
28 browser.call( function () {
29 return Api.edit( title, Util.getTestString() ); // create
30 } );
31 WatchablePage.watch( title );
32 browser.call( function () {
33 return Api.edit( title, Util.getTestString() ); // edit
34 } );
35
36 WatchlistPage.open();
37
38 assert.strictEqual( WatchlistPage.titles[ 0 ].getText(), title );
39 } );
40
41 } );