Debian Codegraph @

tests/api-testing/action/Undo.js

raw symbols SCIP
1 'use strict';
2
3 const { action, assert, utils } = require( 'api-testing' );
4
5 describe( 'Testing undo functionality', () => {
6 const title = utils.title( 'Undo_' );
7 let alice, revisionID;
8
9 before( async () => {
10 alice = await action.alice();
11 } );
12
13 it( 'should create a page', async () => {
14 await alice.edit( title, { text: 'Undo Page\n\nFoo', createonly: true } );
15 } );
16
17 it( 'should edit a page, revision 2', async () => {
18 const edit = await alice.edit( title, { text: 'Undo Pages\n\nFoo' } );
19 revisionID = edit.newrevid;
20 } );
21
22 it( 'should edit a page, revision 3', async () => {
23 await alice.edit( title, { text: 'Undo Page\n\nFoo\n\nBar' } );
24 } );
25
26 it( 'should undo revision 2', async () => {
27 await alice.edit( title, { undo: revisionID } );
28 } );
29
30 it( 'should confirm undo action', async () => {
31 const html = await alice.getHtml( title );
32
33 assert.match( html, /<p>Undo Page\n<\/p><p>Foo\n<\/p><p>Bar\n<\/p>/ );
34 } );
35 } );