wiki.techinc.nl/tests/selenium/specs/specialrecentchanges.js
Adam Wight bc4d631c08 Wait until the recent changes are updated
There may be a race condition when running against a multithreaded
server, in which the Special:RecentChanges request arrives before the
deferred job has updated history.  The API call ensures that the
recentchanges table has been updated, within a 5-second grace period.

Bug: T225218
Change-Id: I0882a5624c62b94f8c6e6056ea3396d9e2904d48
2021-01-05 16:49:27 +01:00

40 lines
910 B
JavaScript

'use strict';
const assert = require( 'assert' );
const Api = require( 'wdio-mediawiki/Api' );
const RecentChangesPage = require( '../pageobjects/recentchanges.page' );
const Util = require( 'wdio-mediawiki/Util' );
describe( 'Special:RecentChanges', function () {
let content, name, bot;
before( async () => {
bot = await Api.bot();
} );
beforeEach( function () {
browser.deleteAllCookies();
content = Util.getTestString();
name = Util.getTestString();
} );
it( 'shows page creation', function () {
browser.call( async () => {
await bot.edit( name, content );
} );
browser.waitUntil( async () => {
const result = await bot.request( {
action: 'query',
list: 'recentchanges',
rctitle: name
} );
return result.query.recentchanges.length > 0;
} );
RecentChangesPage.open();
assert.strictEqual( RecentChangesPage.titles[ 0 ].getText(), name );
} );
} );