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-02 13:43:43 +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-02-07 15:53:17 +00:00
|
|
|
await EditPage.activationComplete();
|
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
|
|
|
} );
|
|
|
|
|
|
|
|
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 );
|
|
|
|
await EditPage.activationComplete();
|
|
|
|
|
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-05-31 14:36:52 +00:00
|
|
|
// Skipped because of T309712: Dismiss 'Try Content Translation' popup
|
|
|
|
it.skip( '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 );
|
|
|
|
await EditPage.activationComplete();
|
|
|
|
|
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
|
|
|
} );
|
|
|
|
|
|
|
|
} );
|