wiki.techinc.nl/tests/api-testing/action/Undo.js
Ed Sanders 8b720e9bd6 eslint: Update to eslint-config-wikimedia 0.16.0
* valid-jsdoc replaced with jsdoc plugin
* New /selenium config

Change-Id: I471eebac0312cb25c539c3f6a3ecfc7cfd4ed8d6
2020-06-02 21:32:56 +01:00

35 lines
954 B
JavaScript

'use strict';
const { action, assert, utils } = require( 'api-testing' );
describe( 'Testing undo functionality', function () {
const title = utils.title( 'Undo_' );
let alice, revisionID;
before( async () => {
alice = await action.alice();
} );
it( 'should create a page', async () => {
await alice.edit( title, { text: 'Undo Page\n\nFoo', createonly: true } );
} );
it( 'should edit a page, revision 2', async () => {
const edit = await alice.edit( title, { text: 'Undo Pages\n\nFoo' } );
revisionID = edit.newrevid;
} );
it( 'should edit a page, revision 3', async () => {
await alice.edit( title, { text: 'Undo Page\n\nFoo\n\nBar' } );
} );
it( 'should undo revision 2', async () => {
await alice.edit( title, { undo: revisionID } );
} );
it( 'should confirm undo action', async () => {
const html = await alice.getHtml( title );
assert.match( html, /<p>Undo Page\n<\/p><p>Foo\n<\/p><p>Bar\n<\/p>/ );
} );
} );