Merge "Add missing @group Database tags in tests"
[lhc/web/wiklou.git] / tests / selenium / specs / user.js
1 'use strict';
2 const assert = require( 'assert' ),
3 CreateAccountPage = require( '../pageobjects/createaccount.page' ),
4 UserLoginPage = require( '../pageobjects/userlogin.page' ),
5 UserLogoutPage = require( '../pageobjects/userlogout.page' ),
6 PreferencesPage = require( '../pageobjects/preferences.page' );
7
8 describe( 'User', function () {
9
10 var password,
11 username;
12
13 beforeEach( function () {
14 username = `User-${Math.random().toString()}`;
15 password = Math.random().toString();
16 } );
17
18 it( 'should be able to create account', function () {
19
20 // create
21 CreateAccountPage.createAccount( username, password );
22
23 // check
24 assert.equal( CreateAccountPage.heading.getText(), `Welcome, ${username}!` );
25
26 } );
27
28 it( 'should be able to log in', function () {
29
30 // create
31 CreateAccountPage.createAccount( username, password );
32
33 // logout
34 UserLogoutPage.open();
35
36 // log in
37 UserLoginPage.login( username, password );
38
39 // check
40 assert.equal( UserLoginPage.userPage.getText(), username );
41
42 } );
43
44 it( 'should be able to change preferences', function () {
45
46 var realName = Math.random().toString();
47
48 // create
49 CreateAccountPage.createAccount( username, password );
50
51 // change real name
52 PreferencesPage.changeRealName( realName );
53
54 // check
55 assert.equal( PreferencesPage.realName.getValue(), realName );
56
57 } );
58
59 } );