https://www.mediawiki.org/wiki/Selenium/Explanation/Stack Bug: T368535 Change-Id: Ie1354c94c935551a23a937bb38012c10431c6292
33 lines
953 B
JavaScript
33 lines
953 B
JavaScript
// Example code for Selenium/Explanation/Stack
|
|
// https://www.mediawiki.org/wiki/Selenium/Explanation/Stack
|
|
|
|
'use strict';
|
|
|
|
// baseUrl is required for our continuous integration.
|
|
// If you don't have MW_SERVER and MW_SCRIPT_PATH environment variables set
|
|
// you can probably hardcode it to something like this:
|
|
// const baseUrl = 'http://localhost:8080/wiki/';
|
|
const baseUrl = `${ process.env.MW_SERVER }${ process.env.MW_SCRIPT_PATH }/index.php?title=`;
|
|
|
|
const { remote } = require( 'webdriverio' );
|
|
|
|
( async () => {
|
|
const browser = await remote( {
|
|
capabilities: {
|
|
browserName: 'chrome',
|
|
'goog:chromeOptions': {
|
|
args: [ 'headless' ]
|
|
}
|
|
}
|
|
} );
|
|
|
|
await browser.url( `${ baseUrl }/Main_Page` );
|
|
|
|
const displayed = await browser.$( 'li#pt-login-2 a' ).isDisplayed();
|
|
if ( displayed === false ) {
|
|
throw new Error( 'Log in link not visible' );
|
|
} else {
|
|
console.log( 'Log in link visible' );
|
|
}
|
|
await browser.deleteSession();
|
|
} )();
|