2016-12-19 16:39:29 +00:00
|
|
|
'use strict';
|
|
|
|
|
const assert = require( 'assert' ),
|
2017-05-08 10:10:18 +00:00
|
|
|
EditPage = require( '../pageobjects/edit.page' ),
|
|
|
|
|
HistoryPage = require( '../pageobjects/history.page' );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
describe( 'Page', function () {
|
|
|
|
|
|
|
|
|
|
var content,
|
|
|
|
|
name;
|
|
|
|
|
|
|
|
|
|
beforeEach( function () {
|
2017-05-08 10:10:18 +00:00
|
|
|
browser.deleteCookie();
|
2016-12-19 16:39:29 +00:00
|
|
|
content = Math.random().toString();
|
|
|
|
|
name = Math.random().toString();
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
it( 'should be creatable', function () {
|
|
|
|
|
|
|
|
|
|
// create
|
|
|
|
|
EditPage.edit( name, content );
|
|
|
|
|
|
|
|
|
|
// check
|
|
|
|
|
assert.equal( EditPage.heading.getText(), name );
|
|
|
|
|
assert.equal( EditPage.displayedContent.getText(), content );
|
|
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
it( 'should be editable', function () {
|
|
|
|
|
|
|
|
|
|
var content2 = Math.random().toString();
|
|
|
|
|
|
|
|
|
|
// create
|
2017-05-08 10:10:18 +00:00
|
|
|
browser.call( function () {
|
|
|
|
|
return EditPage.apiEdit( name, content );
|
|
|
|
|
} );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
// edit
|
|
|
|
|
EditPage.edit( name, content2 );
|
|
|
|
|
|
2017-05-08 10:10:18 +00:00
|
|
|
// check
|
2016-12-19 16:39:29 +00:00
|
|
|
assert.equal( EditPage.heading.getText(), name );
|
|
|
|
|
assert.equal( EditPage.displayedContent.getText(), content2 );
|
|
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
it( 'should have history', function () {
|
|
|
|
|
|
|
|
|
|
// create
|
2017-05-08 10:10:18 +00:00
|
|
|
browser.call( function () {
|
|
|
|
|
return EditPage.apiEdit( name, content );
|
|
|
|
|
} );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
// check
|
|
|
|
|
HistoryPage.open( name );
|
|
|
|
|
assert.equal( HistoryPage.comment.getText(), `(Created page with "${content}")` );
|
|
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
} );
|