Merge "Align "What's this" vertically"
[lhc/web/wiklou.git] / tests / selenium / specs / user.js
1 'use strict';
2 const assert = require( 'assert' ),
3 CreateAccountPage = require( '../pageobjects/createaccount.page' ),
4 PreferencesPage = require( '../pageobjects/preferences.page' ),
5 UserLoginPage = require( '../pageobjects/userlogin.page' );
6
7 describe( 'User', function () {
8
9 var password,
10 username;
11
12 before( function () {
13 // disable VisualEditor welcome dialog
14 UserLoginPage.open();
15 browser.localStorage( 'POST', { key: 've-beta-welcome-dialog', value: '1' } );
16 } );
17
18 beforeEach( function () {
19 browser.deleteCookie();
20 username = `User-${Math.random().toString()}`;
21 password = Math.random().toString();
22 } );
23
24 it( 'should be able to create account', function () {
25
26 // create
27 CreateAccountPage.createAccount( username, password );
28
29 // check
30 assert.equal( CreateAccountPage.heading.getText(), `Welcome, ${username}!` );
31
32 } );
33
34 it( 'should be able to log in', function () {
35
36 // create
37 browser.call( function () {
38 return CreateAccountPage.apiCreateAccount( username, password );
39 } );
40
41 // log in
42 UserLoginPage.login( username, password );
43
44 // check
45 assert.equal( UserLoginPage.userPage.getText(), username );
46
47 } );
48
49 it( 'should be able to change preferences', function () {
50
51 var realName = Math.random().toString();
52
53 // create
54 browser.call( function () {
55 return CreateAccountPage.apiCreateAccount( username, password );
56 } );
57
58 // log in
59 UserLoginPage.login( username, password );
60
61 // change
62 PreferencesPage.changeRealName( realName );
63
64 // check
65 assert.equal( PreferencesPage.realName.getValue(), realName );
66
67 } );
68
69 } );