1 const assert
= require( 'assert' ),
2 CreateAccountPage
= require( '../pageobjects/createaccount.page' ),
3 PreferencesPage
= require( '../pageobjects/preferences.page' ),
4 UserLoginPage
= require( '../pageobjects/userlogin.page' );
6 describe( 'User', function () {
11 // disable VisualEditor welcome dialog
13 browser
.localStorage( 'POST', { key
: 've-beta-welcome-dialog', value
: '1' } );
16 beforeEach( function () {
17 browser
.deleteCookie();
18 username
= `User-${Math.random().toString()}`;
19 password
= Math
.random().toString();
22 it( 'should be able to create account', function () {
24 CreateAccountPage
.createAccount( username
, password
);
27 assert
.equal( CreateAccountPage
.heading
.getText(), `Welcome, ${username}!` );
30 it( 'should be able to log in', function () {
32 browser
.call( function () {
33 return CreateAccountPage
.apiCreateAccount( username
, password
);
37 UserLoginPage
.login( username
, password
);
40 assert
.equal( UserLoginPage
.userPage
.getText(), username
);
43 it( 'should be able to change preferences', function () {
44 var realName
= Math
.random().toString();
47 browser
.call( function () {
48 return CreateAccountPage
.apiCreateAccount( username
, password
);
52 UserLoginPage
.login( username
, password
);
55 PreferencesPage
.changeRealName( realName
);
58 assert
.equal( PreferencesPage
.realName
.getValue(), realName
);