I set out to write a test to check for the ‘Welcome’ message in the notifications via the Echo extension. I’m sure this will take a few drafts but here is the first attempt at writing this up. I’ve made some assumptions and simplifications so that I could get something out quicker. This first draft uses an existing new user and checks that the element “.mw-echo-ui-notificationItemWidget-content-message-header” is present. This element is what contains the ‘Welcome’ message. Test passes.
echo.page.js file:
'use strict';
const Page = require( 'wdio-mediawiki/Page' );
class EchoPage extends Page {
get alerts() { return browser.element( '#pt-notifications-alert' ); }
get notices() { return browser.element( '#pt-notifications-notice' ); }
get welcomenotice() { return browser.element('.mw-echo-ui-notificationItemWidget-content-message-header'); }
}
module.exports = new EchoPage();
notification_welcome.js
'use strict';
var assert = require ('assert'),
EchoPage = require ( '../pageobjects/echo.page' ),
UserLoginPage = require( 'wdio-mediawiki/LoginPage' );
describe ( 'Echo', function() {
it ( 'check for welcome message after signin', function() {
UserLoginPage.login( browser.options.username, browser.options.password );
UserLoginPage.open();
EchoPage.notices.click();
browser.pause(5000);
assert( EchoPage.welcomenotice.isExisting() );
} );
} );
Download the files here: echo.page.js ,notification_welcome.js