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