Debian Codegraph @

tests/selenium/specs/recentchanges.js

raw symbols SCIP
1 'use strict';
2
3 const Api = require( 'wdio-mediawiki/Api' );
4 const BlankPage = require( 'wdio-mediawiki/BlankPage' );
5 const RecentChangesPage = require( '../pageobjects/recentchanges.page' );
6 const Util = require( 'wdio-mediawiki/Util' );
7
8 describe( 'Special:RecentChanges', () => {
9 let content, name, bot;
10
11 before( async () => {
12 bot = await Api.bot();
13 } );
14
15 beforeEach( async () => {
16 await browser.deleteAllCookies();
17 content = Util.getTestString();
18 name = Util.getTestString();
19 } );
20
21 it( 'shows page creation', async function () {
22
23 // First try to load a blank page, so the next command works.
24 await BlankPage.open();
25 // Don't try to run wikitext-specific tests if the test namespace isn't wikitext by default.
26 if ( await Util.isTargetNotWikitext( name ) ) {
27 this.skip();
28 }
29
30 await bot.edit( name, content );
31 await browser.waitUntil( async () => {
32 const result = await bot.request( {
33 action: 'query',
34 list: 'recentchanges',
35 rctitle: name
36 } );
37 return result.query.recentchanges.length > 0;
38 } );
39
40 await RecentChangesPage.open();
41 await RecentChangesPage.liveUpdates.click();
42 await browser.waitUntil(
43 async () => ( await RecentChangesPage.titles[ 0 ].getText() ) === name,
44 { timeout: 10000 }
45 );
46 await expect( RecentChangesPage.titles[ 0 ] ).toHaveText( name );
47 } );
48
49 } );