2017-03-28 13:59:35 +00:00
|
|
|
'use strict';
|
|
|
|
const assert = require( 'assert' );
|
|
|
|
const EditPage = require( '../pageobjects/edit.page' );
|
|
|
|
const LoginPage = require( 'wdio-mediawiki/LoginPage' );
|
2021-09-14 16:32:09 +00:00
|
|
|
const Util = require( 'wdio-mediawiki/Util' );
|
2017-03-28 13:59:35 +00:00
|
|
|
|
2022-01-17 15:49:25 +00:00
|
|
|
describe( 'Content Editable', function () {
|
2017-03-28 13:59:35 +00:00
|
|
|
|
2021-09-14 16:32:09 +00:00
|
|
|
let name, content;
|
|
|
|
|
2022-06-29 14:00:54 +00:00
|
|
|
it( 'should load when an url is opened @daily', async function () {
|
2021-09-14 16:32:09 +00:00
|
|
|
content = Util.getTestString();
|
|
|
|
name = Util.getTestString();
|
|
|
|
await browser.deleteAllCookies();
|
2022-01-25 14:52:11 +00:00
|
|
|
await LoginPage.loginAdmin();
|
2017-03-28 13:59:35 +00:00
|
|
|
|
2022-01-25 14:52:11 +00:00
|
|
|
await EditPage.openForEditing( name );
|
2022-06-29 14:00:54 +00:00
|
|
|
await EditPage.toolbar.waitForDisplayed( { timeout: 20000 } );
|
2022-04-04 15:28:07 +00:00
|
|
|
|
2021-09-14 16:32:09 +00:00
|
|
|
assert( await EditPage.toolbar.isDisplayed() );
|
2022-04-04 15:28:07 +00:00
|
|
|
} );
|
|
|
|
|
2022-06-29 14:00:54 +00:00
|
|
|
it( 'should be editable', async function () {
|
2022-05-18 14:09:19 +00:00
|
|
|
content = Util.getTestString();
|
|
|
|
name = Util.getTestString();
|
|
|
|
await browser.deleteAllCookies();
|
|
|
|
await LoginPage.loginAdmin();
|
|
|
|
|
|
|
|
await EditPage.openForEditing( name );
|
2022-06-29 14:00:54 +00:00
|
|
|
await EditPage.toolbar.waitForDisplayed( { timeout: 20000 } );
|
2022-05-18 14:09:19 +00:00
|
|
|
|
2021-09-14 16:32:09 +00:00
|
|
|
await EditPage.veRootNode.setValue( content );
|
2022-04-04 15:28:07 +00:00
|
|
|
|
2021-09-14 16:32:09 +00:00
|
|
|
assert.equal( await EditPage.veRootNode.getText(), content );
|
|
|
|
|
|
|
|
// T269566: Popup with text
|
|
|
|
// 'Leave site? Changes that you made may not be saved. Cancel/Leave'
|
|
|
|
// appears after the browser tries to leave the page with the preview.
|
|
|
|
await browser.reloadSession();
|
|
|
|
} );
|
|
|
|
|
2022-06-29 14:00:54 +00:00
|
|
|
it( 'should save an edit', async function () {
|
2022-05-18 14:09:19 +00:00
|
|
|
content = Util.getTestString();
|
|
|
|
name = Util.getTestString();
|
|
|
|
await browser.deleteAllCookies();
|
|
|
|
await LoginPage.loginAdmin();
|
|
|
|
|
|
|
|
await EditPage.openForEditing( name );
|
2022-06-29 14:00:54 +00:00
|
|
|
await EditPage.toolbar.waitForDisplayed( { timeout: 20000 } );
|
2022-05-18 14:09:19 +00:00
|
|
|
|
2022-04-04 15:28:07 +00:00
|
|
|
await EditPage.veRootNode.setValue( content );
|
2021-09-14 16:32:09 +00:00
|
|
|
await EditPage.savePageDots.click();
|
2022-05-31 14:36:52 +00:00
|
|
|
await EditPage.savePage.waitForClickable();
|
2021-09-14 16:32:09 +00:00
|
|
|
await EditPage.savePage.click();
|
2022-04-04 15:28:07 +00:00
|
|
|
|
2022-06-08 14:56:24 +00:00
|
|
|
await EditPage.saveComplete();
|
2022-05-31 14:36:52 +00:00
|
|
|
assert.strictEqual( await EditPage.notification.getText(), 'The page has been created.' );
|
2017-03-28 13:59:35 +00:00
|
|
|
} );
|
|
|
|
|
|
|
|
} );
|