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' ),
|
2017-07-05 11:52:47 +00:00
|
|
|
HistoryPage = require( '../pageobjects/history.page' ),
|
|
|
|
|
UserLoginPage = require( '../pageobjects/userlogin.page' );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
describe( 'Page', function () {
|
|
|
|
|
|
|
|
|
|
var content,
|
|
|
|
|
name;
|
|
|
|
|
|
2018-01-13 12:19:28 +00:00
|
|
|
function getTestString() {
|
|
|
|
|
return Math.random().toString() + '-öäü-♠♣♥♦';
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-05 11:52:47 +00:00
|
|
|
before( function () {
|
|
|
|
|
// disable VisualEditor welcome dialog
|
|
|
|
|
UserLoginPage.open();
|
|
|
|
|
browser.localStorage( 'POST', { key: 've-beta-welcome-dialog', value: '1' } );
|
|
|
|
|
} );
|
|
|
|
|
|
2016-12-19 16:39:29 +00:00
|
|
|
beforeEach( function () {
|
2017-05-08 10:10:18 +00:00
|
|
|
browser.deleteCookie();
|
2018-01-13 12:19:28 +00:00
|
|
|
content = getTestString();
|
|
|
|
|
name = getTestString();
|
2016-12-19 16:39:29 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
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 () {
|
|
|
|
|
|
|
|
|
|
// 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
|
2018-01-13 12:19:28 +00:00
|
|
|
EditPage.edit( name, content );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
2017-05-08 10:10:18 +00:00
|
|
|
// check
|
2016-12-19 16:39:29 +00:00
|
|
|
assert.equal( EditPage.heading.getText(), name );
|
2018-01-13 12:19:28 +00:00
|
|
|
assert.equal( EditPage.displayedContent.getText(), content );
|
2016-12-19 16:39:29 +00:00
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
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}")` );
|
|
|
|
|
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
} );
|