selenium: Replace ES5 one-var assignments with const/let per line
[lhc/web/wiklou.git] / tests / selenium / specs / specialwatchlist.js
index 1e33b2b..57a0c96 100644 (file)
@@ -1,19 +1,16 @@
-const assert = require( 'assert' ),
-       Api = require( 'wdio-mediawiki/Api' ),
-       WatchlistPage = require( '../pageobjects/watchlist.page' ),
-       WatchablePage = require( '../pageobjects/watchable.page' ),
-       LoginPage = require( 'wdio-mediawiki/LoginPage' );
+const assert = require( 'assert' );
+const Api = require( 'wdio-mediawiki/Api' );
+const WatchlistPage = require( '../pageobjects/watchlist.page' );
+const WatchablePage = require( '../pageobjects/watchable.page' );
+const LoginPage = require( 'wdio-mediawiki/LoginPage' );
+const Util = require( 'wdio-mediawiki/Util' );
 
 describe( 'Special:Watchlist', function () {
        let username, password;
 
-       function getTestString( prefix = '' ) {
-               return prefix + Math.random().toString() + '-öäü-♠♣♥♦';
-       }
-
        before( function () {
-               username = getTestString( 'user-' );
-               password = getTestString( 'password-' );
+               username = Util.getTestString( 'user-' );
+               password = Util.getTestString( 'password-' );
 
                browser.call( function () {
                        return Api.createAccount( username, password );
@@ -21,19 +18,19 @@ describe( 'Special:Watchlist', function () {
        } );
 
        beforeEach( function () {
-               browser.deleteCookie();
+               browser.deleteAllCookies();
                LoginPage.login( username, password );
        } );
 
        it( 'should show page with new edit', function () {
-               const title = getTestString( 'Title-' );
+               const title = Util.getTestString( 'Title-' );
 
                browser.call( function () {
-                       return Api.edit( title, getTestString() ); // create
+                       return Api.edit( title, Util.getTestString() ); // create
                } );
                WatchablePage.watch( title );
                browser.call( function () {
-                       return Api.edit( title, getTestString() ); // edit
+                       return Api.edit( title, Util.getTestString() ); // edit
                } );
 
                WatchlistPage.open();