Create users and pages for Selenium tests using action API
[lhc/web/wiklou.git] / tests / selenium / specs / page.js
1 'use strict';
2 const assert = require( 'assert' ),
3 EditPage = require( '../pageobjects/edit.page' ),
4 HistoryPage = require( '../pageobjects/history.page' );
5
6 describe( 'Page', function () {
7
8 var content,
9 name;
10
11 beforeEach( function () {
12 browser.deleteCookie();
13 content = Math.random().toString();
14 name = Math.random().toString();
15 } );
16
17 it( 'should be creatable', function () {
18
19 // create
20 EditPage.edit( name, content );
21
22 // check
23 assert.equal( EditPage.heading.getText(), name );
24 assert.equal( EditPage.displayedContent.getText(), content );
25
26 } );
27
28 it( 'should be editable', function () {
29
30 var content2 = Math.random().toString();
31
32 // create
33 browser.call( function () {
34 return EditPage.apiEdit( name, content );
35 } );
36
37 // edit
38 EditPage.edit( name, content2 );
39
40 // check
41 assert.equal( EditPage.heading.getText(), name );
42 assert.equal( EditPage.displayedContent.getText(), content2 );
43
44 } );
45
46 it( 'should have history', function () {
47
48 // create
49 browser.call( function () {
50 return EditPage.apiEdit( name, content );
51 } );
52
53 // check
54 HistoryPage.open( name );
55 assert.equal( HistoryPage.comment.getText(), `(Created page with "${content}")` );
56
57 } );
58
59 } );