wiki.techinc.nl/tests/api-testing/action/Undo.js
Clara Andrew-Wani f07d7ba699 Move tests from api-testing repo into Core
Except for Search & Watchlist, which need fixes in gated extensions first.

Change-Id: I88d24dda4bc047868de3ff9dd4a5753b9c7b0f64
2020-02-05 16:07:54 -08:00

33 lines
939 B
JavaScript

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>/ );
} );
} );