wiki.techinc.nl/tests/selenium/specs/page.js
Željko Filipin 853cba1deb Create users and pages for Selenium tests using action API
This will make tests slightly more robust.

Bug: T164721
Bug: T167502
Change-Id: I9b2fea77b28af4f7f521490a0105e7d04730bc87
2017-07-07 04:59:14 +00:00

59 lines
1.2 KiB
JavaScript

'use strict';
const assert = require( 'assert' ),
EditPage = require( '../pageobjects/edit.page' ),
HistoryPage = require( '../pageobjects/history.page' );
describe( 'Page', function () {
var content,
name;
beforeEach( function () {
browser.deleteCookie();
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
browser.call( function () {
return EditPage.apiEdit( name, content );
} );
// edit
EditPage.edit( name, content2 );
// check
assert.equal( EditPage.heading.getText(), name );
assert.equal( EditPage.displayedContent.getText(), content2 );
} );
it( 'should have history', function () {
// create
browser.call( function () {
return EditPage.apiEdit( name, content );
} );
// check
HistoryPage.open( name );
assert.equal( HistoryPage.comment.getText(), `(Created page with "${content}")` );
} );
} );