]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - tests/selenium/specs/page.js
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / tests / selenium / specs / page.js
diff --git a/tests/selenium/specs/page.js b/tests/selenium/specs/page.js
new file mode 100644 (file)
index 0000000..06d3d60
--- /dev/null
@@ -0,0 +1,66 @@
+'use strict';
+const assert = require( 'assert' ),
+       EditPage = require( '../pageobjects/edit.page' ),
+       HistoryPage = require( '../pageobjects/history.page' ),
+       UserLoginPage = require( '../pageobjects/userlogin.page' );
+
+describe( 'Page', function () {
+
+       var content,
+               name;
+
+       before( function () {
+               // disable VisualEditor welcome dialog
+               UserLoginPage.open();
+               browser.localStorage( 'POST', { key: 've-beta-welcome-dialog', value: '1' } );
+       } );
+
+       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}")` );
+
+       } );
+
+} );