--- /dev/null
+const Page = require( 'wdio-mediawiki/Page' );
+
+class WatchablePage extends Page {
+
+ get confirmWatch() { return browser.element( '#mw-content-text button[type="submit"]' ); }
+
+ watch( title ) {
+ super.openTitle( title, { action: 'watch' } );
+ this.confirmWatch.click();
+ }
+}
+
+module.exports = new WatchablePage();
--- /dev/null
+const Page = require( 'wdio-mediawiki/Page' );
+
+class WatchlistPage extends Page {
+ get titles() {
+ return browser.element( '.mw-changeslist' )
+ .$$( '.mw-changeslist-line .mw-title' );
+ }
+
+ open() {
+ super.openTitle( 'Special:Watchlist' );
+ }
+
+}
+
+module.exports = new WatchlistPage();
--- /dev/null
+const assert = require( 'assert' ),
+ Api = require( 'wdio-mediawiki/Api' ),
+ WatchlistPage = require( '../pageobjects/watchlist.page' ),
+ WatchablePage = require( '../pageobjects/watchable.page' ),
+ LoginPage = require( 'wdio-mediawiki/LoginPage' );
+
+describe( 'Special:Watchlist', function () {
+ let username, password;
+
+ function getTestString( prefix = '' ) {
+ return prefix + Math.random().toString() + '-öäü-♠♣♥♦';
+ }
+
+ before( function () {
+ username = getTestString( 'user-' );
+ password = getTestString( 'password-' );
+
+ browser.call( function () {
+ return Api.createAccount( username, password );
+ } );
+ } );
+
+ beforeEach( function () {
+ browser.deleteCookie();
+ LoginPage.login( username, password );
+ } );
+
+ it( 'should show page with new edit', function () {
+ const title = getTestString( 'Title-' );
+
+ browser.call( function () {
+ return Api.edit( title, getTestString() ); // create
+ } );
+ WatchablePage.watch( title );
+ browser.call( function () {
+ return Api.edit( title, getTestString() ); // edit
+ } );
+
+ WatchlistPage.open();
+
+ assert.strictEqual( WatchlistPage.titles[ 0 ].getText(), title );
+ } );
+
+} );