wiki.techinc.nl/tests/selenium/specs/watchlist.js
Željko Filipin f4a4b07500 selenium: Run most tests targeting the beta cluster
Only creating account via the web interface does not work on the beta
cluster, because of CAPTCHA.

Bug: T323824
Change-Id: I7e9c6169f1c72450b4b620a8712629af7637f06b
2022-11-30 15:13:08 +00:00

42 lines
1.2 KiB
JavaScript

'use strict';
const assert = require( 'assert' );
const Api = require( 'wdio-mediawiki/Api' );
const WatchlistPage = require( '../pageobjects/watchlist.page' );
const WatchablePage = require( '../pageobjects/watchable.page' );
const LoginPage = require( 'wdio-mediawiki/LoginPage' );
const Util = require( 'wdio-mediawiki/Util' );
describe( 'Special:Watchlist', function () {
let bot;
before( async () => {
// Default bot is the admin that we also use for viewing via LoginPage.loginAdmin()
bot = await Api.bot();
} );
beforeEach( async function () {
await LoginPage.loginAdmin();
} );
it( 'should show page with new edit @daily', async function () {
const title = Util.getTestString( 'Title-' );
// create
await bot.edit( title, Util.getTestString() );
await WatchablePage.watch( title );
// edit
await bot.edit( title, Util.getTestString() );
await WatchlistPage.open();
// We are viewing Special:Watchlist with the same account that made the edit,
// but by default Special:Watchlist includes both seen and unseen changes, so
// it'll show up anyway. The title we just edited will be first because the edit
// was the most recent.
assert.strictEqual( await WatchlistPage.titles[ 0 ].getText(), title );
} );
} );