wiki.techinc.nl/tests/api-testing/action/RecentChanges.js
Kosta Harlan 4874825d1a api-testing: Run jobs for tests dependent on deferred updates (part II)
Follows-Up: Ia9fd617ef02de57b82c5a7250b586d37bb2687b3
Bug: T285649
Change-Id: I6860b818f2690eec0904f24da6e1bdb878a068c1
2022-01-12 11:34:22 +01:00

34 lines
1.2 KiB
JavaScript

'use strict';
const { action, assert, utils, wiki } = require( 'api-testing' );
describe( 'Recent Changes', function () {
const title = utils.title( 'Recent_Changes_' );
let alice;
before( async () => {
alice = await action.alice();
} );
it( 'should create page and get new page recent changes', async () => {
const edit = await alice.edit( title, { text: 'Recent changes testing', createonly: true } );
await wiki.runAllJobs();
const results = await alice.list( 'recentchanges', { rctype: 'new', rctitle: title } );
assert.equal( results[ 0 ].type, 'new' );
assert.sameTitle( results[ 0 ].title, title );
assert.equal( results[ 0 ].pageid, edit.pageid );
assert.equal( results[ 0 ].revid, edit.newrevid );
} );
it( 'should edit page and get most recent edit changes', async () => {
const rev1 = await alice.edit( title, { text: 'Recent changes testing..R1' } );
await wiki.runAllJobs();
const results = await alice.list( 'recentchanges', { rctype: 'edit', rctitle: title } );
assert.equal( results[ 0 ].type, 'edit' );
assert.sameTitle( results[ 0 ].title, title );
assert.equal( results[ 0 ].pageid, rev1.pageid );
assert.equal( results[ 0 ].revid, rev1.newrevid );
} );
} );