| 1 |
'use strict'; |
| 2 |
|
| 3 |
const assert = require( 'assert' ), |
| 4 |
EchoPage = require( '../pageobjects/echo.page' ), |
| 5 |
UserLoginPage = require( 'wdio-mediawiki/LoginPage' ), |
| 6 |
Util = require( 'wdio-mediawiki/Util' ), |
| 7 |
Api = require( 'wdio-mediawiki/Api' ); |
| 8 |
|
| 9 |
describe( 'Echo', () => { |
| 10 |
let bot; |
| 11 |
|
| 12 |
before( async () => { |
| 13 |
bot = await Api.bot(); |
| 14 |
} ); |
| 15 |
|
| 16 |
it( 'alerts and notices are visible after logging in @daily', async () => { |
| 17 |
|
| 18 |
await UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd ); |
| 19 |
|
| 20 |
assert( EchoPage.alerts.isExisting() ); |
| 21 |
assert( EchoPage.notices.isExisting() ); |
| 22 |
|
| 23 |
} ); |
| 24 |
|
| 25 |
it( 'flyout for alert appears when clicked @daily', async () => { |
| 26 |
|
| 27 |
await UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd ); |
| 28 |
await EchoPage.alerts.click(); |
| 29 |
EchoPage.alertsFlyout.waitForDisplayed(); |
| 30 |
|
| 31 |
assert( EchoPage.alertsFlyout.isExisting() ); |
| 32 |
|
| 33 |
} ); |
| 34 |
|
| 35 |
it( 'flyout for notices appears when clicked @daily', async () => { |
| 36 |
|
| 37 |
await UserLoginPage.login( browser.config.mwUser, browser.config.mwPwd ); |
| 38 |
await EchoPage.notices.click(); |
| 39 |
EchoPage.noticesFlyout.waitForDisplayed(); |
| 40 |
|
| 41 |
assert( EchoPage.noticesFlyout.isExisting() ); |
| 42 |
|
| 43 |
} ); |
| 44 |
|
| 45 |
|
| 46 |
it.skip( 'checks for welcome message after signup', async () => { |
| 47 |
|
| 48 |
const username = Util.getTestString( 'NewUser-' ); |
| 49 |
const password = Util.getTestString(); |
| 50 |
|
| 51 |
await Api.createAccount( bot, username, password ); |
| 52 |
|
| 53 |
await UserLoginPage.login( username, password ); |
| 54 |
|
| 55 |
await EchoPage.notices.click(); |
| 56 |
|
| 57 |
await EchoPage.alertMessage.waitForDisplayed(); |
| 58 |
const regexp = /Welcome to .*, .*! We're glad you're here./; |
| 59 |
assert( regexp.test( await EchoPage.alertMessage.getText() ) ); |
| 60 |
|
| 61 |
} ); |
| 62 |
|
| 63 |
} ); |