2016-12-19 16:39:29 +00:00
|
|
|
const assert = require( 'assert' ),
|
|
|
|
|
CreateAccountPage = require( '../pageobjects/createaccount.page' ),
|
2017-05-08 10:10:18 +00:00
|
|
|
PreferencesPage = require( '../pageobjects/preferences.page' ),
|
2018-01-29 19:47:07 +00:00
|
|
|
UserLoginPage = require( '../pageobjects/userlogin.page' );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
describe( 'User', function () {
|
|
|
|
|
var password,
|
|
|
|
|
username;
|
|
|
|
|
|
2017-07-05 11:52:47 +00:00
|
|
|
before( function () {
|
|
|
|
|
// disable VisualEditor welcome dialog
|
|
|
|
|
UserLoginPage.open();
|
|
|
|
|
browser.localStorage( 'POST', { key: 've-beta-welcome-dialog', value: '1' } );
|
|
|
|
|
} );
|
|
|
|
|
|
2016-12-19 16:39:29 +00:00
|
|
|
beforeEach( function () {
|
2017-05-08 10:10:18 +00:00
|
|
|
browser.deleteCookie();
|
2016-12-19 16:39:29 +00:00
|
|
|
username = `User-${Math.random().toString()}`;
|
|
|
|
|
password = Math.random().toString();
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
it( 'should be able to create account', function () {
|
|
|
|
|
// create
|
|
|
|
|
CreateAccountPage.createAccount( username, password );
|
|
|
|
|
|
|
|
|
|
// check
|
|
|
|
|
assert.equal( CreateAccountPage.heading.getText(), `Welcome, ${username}!` );
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
it( 'should be able to log in', function () {
|
|
|
|
|
// create
|
2017-05-08 10:10:18 +00:00
|
|
|
browser.call( function () {
|
|
|
|
|
return CreateAccountPage.apiCreateAccount( username, password );
|
|
|
|
|
} );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
// log in
|
|
|
|
|
UserLoginPage.login( username, password );
|
|
|
|
|
|
|
|
|
|
// check
|
|
|
|
|
assert.equal( UserLoginPage.userPage.getText(), username );
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
it( 'should be able to change preferences', function () {
|
|
|
|
|
var realName = Math.random().toString();
|
|
|
|
|
|
|
|
|
|
// create
|
2017-05-08 10:10:18 +00:00
|
|
|
browser.call( function () {
|
|
|
|
|
return CreateAccountPage.apiCreateAccount( username, password );
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
assert.equal( PreferencesPage.realName.getValue(), realName );
|
|
|
|
|
} );
|
|
|
|
|
} );
|