2 const assert
= require( 'assert' ),
3 CreateAccountPage
= require( '../pageobjects/createaccount.page' ),
4 PreferencesPage
= require( '../pageobjects/preferences.page' ),
5 UserLoginPage
= require( '../pageobjects/userlogin.page' );
7 describe( 'User', function () {
12 beforeEach( function () {
13 browser
.deleteCookie();
14 username
= `User-${Math.random().toString()}`;
15 password
= Math
.random().toString();
18 it( 'should be able to create account', function () {
21 CreateAccountPage
.createAccount( username
, password
);
24 assert
.equal( CreateAccountPage
.heading
.getText(), `Welcome, ${username}!` );
28 it( 'should be able to log in', function () {
31 browser
.call( function () {
32 return CreateAccountPage
.apiCreateAccount( username
, password
);
36 UserLoginPage
.login( username
, password
);
39 assert
.equal( UserLoginPage
.userPage
.getText(), username
);
43 it( 'should be able to change preferences', function () {
45 var realName
= Math
.random().toString();
48 browser
.call( function () {
49 return CreateAccountPage
.apiCreateAccount( username
, password
);
53 UserLoginPage
.login( username
, password
);
56 PreferencesPage
.changeRealName( realName
);
59 assert
.equal( PreferencesPage
.realName
.getValue(), realName
);