2019-10-01 01:36:15 +00:00
|
|
|
const assert = require( 'assert' );
|
|
|
|
|
const CreateAccountPage = require( '../pageobjects/createaccount.page' );
|
|
|
|
|
const PreferencesPage = require( '../pageobjects/preferences.page' );
|
|
|
|
|
const UserLoginPage = require( 'wdio-mediawiki/LoginPage' );
|
|
|
|
|
const Api = require( 'wdio-mediawiki/Api' );
|
|
|
|
|
const Util = require( 'wdio-mediawiki/Util' );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
describe( 'User', function () {
|
2019-10-01 01:36:15 +00:00
|
|
|
let password, username;
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
beforeEach( function () {
|
2019-09-27 03:08:00 +00:00
|
|
|
browser.deleteAllCookies();
|
2018-06-20 11:06:45 +00:00
|
|
|
username = Util.getTestString( 'User-' );
|
|
|
|
|
password = Util.getTestString();
|
2016-12-19 16:39:29 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
it( 'should be able to create account', function () {
|
|
|
|
|
// create
|
|
|
|
|
CreateAccountPage.createAccount( username, password );
|
|
|
|
|
|
|
|
|
|
// check
|
2018-06-06 10:49:33 +00:00
|
|
|
assert.strictEqual( CreateAccountPage.heading.getText(), `Welcome, ${username}!` );
|
2016-12-19 16:39:29 +00:00
|
|
|
} );
|
|
|
|
|
|
2018-09-04 09:27:01 +00:00
|
|
|
it( 'should be able to log in @daily', function () {
|
2016-12-19 16:39:29 +00:00
|
|
|
// create
|
2017-05-08 10:10:18 +00:00
|
|
|
browser.call( function () {
|
2018-05-02 17:48:24 +00:00
|
|
|
return Api.createAccount( username, password );
|
2017-05-08 10:10:18 +00:00
|
|
|
} );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
// log in
|
|
|
|
|
UserLoginPage.login( username, password );
|
|
|
|
|
|
|
|
|
|
// check
|
2018-06-06 10:49:33 +00:00
|
|
|
assert.strictEqual( UserLoginPage.userPage.getText(), username );
|
2016-12-19 16:39:29 +00:00
|
|
|
} );
|
|
|
|
|
|
2018-07-31 19:28:31 +00:00
|
|
|
// Disabled due to flakiness (T199446)
|
|
|
|
|
it.skip( 'should be able to change preferences', function () {
|
2018-06-20 11:06:45 +00:00
|
|
|
var realName = Util.getTestString();
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
// create
|
2017-05-08 10:10:18 +00:00
|
|
|
browser.call( function () {
|
2018-05-02 17:48:24 +00:00
|
|
|
return Api.createAccount( username, password );
|
2017-05-08 10:10:18 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
// log in
|
|
|
|
|
UserLoginPage.login( username, password );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
2017-05-08 10:10:18 +00:00
|
|
|
// change
|
2016-12-19 16:39:29 +00:00
|
|
|
PreferencesPage.changeRealName( realName );
|
|
|
|
|
|
|
|
|
|
// check
|
2018-06-06 10:49:33 +00:00
|
|
|
assert.strictEqual( PreferencesPage.realName.getValue(), realName );
|
2016-12-19 16:39:29 +00:00
|
|
|
} );
|
|
|
|
|
} );
|