| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
'use strict'; |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
const baseUrl = `${ process.env.MW_SERVER }${ process.env.MW_SCRIPT_PATH }/index.php?title=`; |
| 11 |
|
| 12 |
const { remote } = require( 'webdriverio' ); |
| 13 |
|
| 14 |
( async () => { |
| 15 |
const browser = await remote( { |
| 16 |
capabilities: { |
| 17 |
browserName: 'chrome', |
| 18 |
'goog:chromeOptions': { |
| 19 |
args: [ 'headless' ] |
| 20 |
} |
| 21 |
} |
| 22 |
} ); |
| 23 |
|
| 24 |
await browser.url( `${ baseUrl }Main_Page` ); |
| 25 |
|
| 26 |
const displayed = await browser.$( 'li#pt-login-2 a' ).isDisplayed(); |
| 27 |
if ( displayed === false ) { |
| 28 |
throw new Error( 'Log in link not visible' ); |
| 29 |
} else { |
| 30 |
console.log( 'Log in link visible' ); |
| 31 |
} |
| 32 |
await browser.deleteSession(); |
| 33 |
} )(); |