2017-03-28 13:59:35 +00:00
|
|
|
'use strict';
|
|
|
|
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
|
|
|
|
2024-06-04 03:39:48 +00:00
|
|
|
describe( 'Content Editable', () => {
|
2017-03-28 13:59:35 +00:00
|
|
|
|
2021-09-14 16:32:09 +00:00
|
|
|
let name, content;
|
|
|
|
|
2024-06-04 03:39:48 +00:00
|
|
|
beforeEach( async () => {
|
2021-09-14 16:32:09 +00:00
|
|
|
content = Util.getTestString();
|
|
|
|
name = Util.getTestString();
|
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-10-10 13:35:03 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-04 03:39:48 +00:00
|
|
|
afterEach( async () => {
|
2022-10-10 13:35:03 +00:00
|
|
|
// 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-04-04 15:28:07 +00:00
|
|
|
|
2024-06-04 03:39:48 +00:00
|
|
|
it( 'should load when an url is opened @daily', async () => {
|
2024-11-12 12:56:56 +00:00
|
|
|
await expect( await EditPage.toolbar ).toBeDisplayed();
|
2022-04-04 15:28:07 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-04 03:39:48 +00:00
|
|
|
it( 'should be editable', async () => {
|
2021-09-14 16:32:09 +00:00
|
|
|
await EditPage.veRootNode.setValue( content );
|
2022-04-04 15:28:07 +00:00
|
|
|
|
2024-11-12 12:56:56 +00:00
|
|
|
await expect( await EditPage.veRootNode ).toHaveText( content );
|
2021-09-14 16:32:09 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-04 03:39:48 +00:00
|
|
|
it( 'should save an edit', async () => {
|
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();
|
2024-11-12 12:56:56 +00:00
|
|
|
await expect( await EditPage.notification ).toHaveText( 'The page has been created.' );
|
2017-03-28 13:59:35 +00:00
|
|
|
} );
|
|
|
|
|
2024-06-04 03:39:48 +00:00
|
|
|
it( 'should insert a table', async () => {
|
2022-10-12 13:16:39 +00:00
|
|
|
await EditPage.insertTable();
|
|
|
|
|
2024-11-12 12:56:56 +00:00
|
|
|
await expect( await EditPage.insertedTable ).toBeDisplayed();
|
2022-10-12 13:16:39 +00:00
|
|
|
} );
|
|
|
|
|
2017-03-28 13:59:35 +00:00
|
|
|
} );
|