mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-24 06:13:54 +00:00
Selenium: Update WebdriverIO to version 5
Bug: T255447 Change-Id: I4cdde3070a6dc4e742ea37a78a17dfd556103dd6
This commit is contained in:
parent
e350281010
commit
c8ce9608c0
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,3 +9,4 @@
|
|||
/tests/selenium/log
|
||||
/tmp
|
||||
/.resolve-less-imports
|
||||
.vscode/launch.json
|
||||
|
|
2437
package-lock.json
generated
2437
package-lock.json
generated
File diff suppressed because it is too large
Load diff
13
package.json
13
package.json
|
@ -15,6 +15,12 @@
|
|||
"devDependencies": {
|
||||
"@babel/core": "7.7.7",
|
||||
"@storybook/html": "5.2.8",
|
||||
"@wdio/cli": "5.22.4",
|
||||
"@wdio/cucumber-framework": "5.23.0",
|
||||
"@wdio/local-runner": "5.22.4",
|
||||
"@wdio/mocha-framework": "5.18.7",
|
||||
"@wdio/spec-reporter": "5.22.4",
|
||||
"@wdio/sync": "5.20.1",
|
||||
"babel-loader": "8.0.6",
|
||||
"bundlesize": "0.18.0",
|
||||
"eslint-config-wikimedia": "0.16.0",
|
||||
|
@ -32,11 +38,8 @@
|
|||
"pre-commit": "1.2.2",
|
||||
"stylelint-config-wikimedia": "0.10.1",
|
||||
"svgo": "1.3.2",
|
||||
"wdio-cucumber-framework": "2.2.8",
|
||||
"wdio-mediawiki": "0.5.0",
|
||||
"wdio-mocha-framework": "0.6.4",
|
||||
"wdio-spec-reporter": "0.1.4",
|
||||
"webdriverio": "4.14.4"
|
||||
"wdio-mediawiki": "1.0.0",
|
||||
"webdriverio": "5.22.4"
|
||||
},
|
||||
"bundlesize": [
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ const iShouldSeeTheCategoriesOverlay = () => {
|
|||
};
|
||||
|
||||
const iShouldSeeAListOfCategories = () => {
|
||||
const el = ArticlePage.overlay_category_topic_item_element.waitForVisible();
|
||||
const el = ArticlePage.overlay_category_topic_item_element.waitForDisplayed();
|
||||
assert.strictEqual( el, true );
|
||||
};
|
||||
|
||||
|
|
|
@ -36,7 +36,10 @@ const createPages = ( pages ) => {
|
|||
};
|
||||
|
||||
const createPage = ( title, wikitext ) => {
|
||||
browser.call( () => Api.edit( title, wikitext ) );
|
||||
browser.call( async () => {
|
||||
const bot = await Api.bot();
|
||||
await bot.edit( title, wikitext );
|
||||
} );
|
||||
};
|
||||
|
||||
const iAmUsingTheMobileSite = () => {
|
||||
|
@ -85,12 +88,12 @@ const iAmOnAPageThatDoesNotExist = () => {
|
|||
};
|
||||
|
||||
const iShouldSeeAToastNotification = () => {
|
||||
ArticlePage.notification_element.waitForVisible();
|
||||
ArticlePage.notification_element.waitForDisplayed();
|
||||
};
|
||||
|
||||
const iShouldSeeAToastNotificationWithMessage = ( msg ) => {
|
||||
iShouldSeeAToastNotification();
|
||||
const notificationBody = ArticlePage.notification_element.element( '.mw-notification-content' );
|
||||
const notificationBody = ArticlePage.notification_element.$( '.mw-notification-content' );
|
||||
assert.strictEqual( notificationBody.getText().indexOf( msg ) > -1, true );
|
||||
};
|
||||
|
||||
|
@ -104,18 +107,18 @@ const iClickTheOverlayCloseButton = () => {
|
|||
};
|
||||
|
||||
const iSeeAnOverlay = () => {
|
||||
ArticlePageWithOverlay.overlay_element.waitForVisible();
|
||||
assert.strictEqual( ArticlePageWithOverlay.overlay_element.isVisible(), true );
|
||||
ArticlePageWithOverlay.overlay_element.waitForDisplayed();
|
||||
assert.strictEqual( ArticlePageWithOverlay.overlay_element.isDisplayed(), true );
|
||||
};
|
||||
|
||||
const iDoNotSeeAnOverlay = () => {
|
||||
waitForPropagation( 5000 );
|
||||
browser.waitUntil( () => !ArticlePageWithOverlay.overlay_element.isVisible() );
|
||||
assert.strictEqual( ArticlePageWithOverlay.overlay_element.isVisible(), false );
|
||||
browser.waitUntil( () => !ArticlePageWithOverlay.overlay_element.isDisplayed() );
|
||||
assert.strictEqual( ArticlePageWithOverlay.overlay_element.isDisplayed(), false );
|
||||
};
|
||||
|
||||
const iAmUsingMobileScreenResolution = () => {
|
||||
browser.setViewportSize( { width: 320, height: 480 }, true );
|
||||
browser.setWindowSize( 320, 480 );
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -31,9 +31,11 @@ const iAmInAWikiThatHasCategories = ( title ) => {
|
|||
// A pause is necessary to let the categories register with database before trying to use
|
||||
// them in an article
|
||||
waitForPropagation( 5000 );
|
||||
browser.call( () => {
|
||||
return Api.edit( title, wikitext );
|
||||
browser.call( async () => {
|
||||
const bot = await Api.bot();
|
||||
await bot.edit( title, wikitext );
|
||||
} );
|
||||
|
||||
browser.call( () => {
|
||||
// The category overlay uses the category API
|
||||
// which will only return results if the job queue has completed.
|
||||
|
@ -82,7 +84,7 @@ const watch = ( title ) => {
|
|||
// So we run the non-js workflow.
|
||||
const page = new Page();
|
||||
page.openTitle( title, { action: 'watch' } );
|
||||
browser.element( '#mw-content-text button[type="submit"]' ).click();
|
||||
$( '#mw-content-text button[type="submit"]' ).click();
|
||||
waitForPropagation( 10000 );
|
||||
page.openTitle( title );
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@ const assert = require( 'assert' ),
|
|||
{ SpecialMobileDiffPage } = require( '../support/world.js' );
|
||||
|
||||
const iShouldSeeAddedContent = ( text ) => {
|
||||
SpecialMobileDiffPage.inserted_content_element.waitForVisible();
|
||||
SpecialMobileDiffPage.inserted_content_element.waitForDisplayed();
|
||||
assert.strictEqual( SpecialMobileDiffPage.inserted_content_element.getText(), text );
|
||||
};
|
||||
const iShouldSeeRemovedContent = ( text ) => {
|
||||
|
|
|
@ -4,11 +4,11 @@ const assert = require( 'assert' );
|
|||
const { ArticlePageWithEditorOverlay, ArticlePage } = require( '../support/world.js' );
|
||||
|
||||
const iClickTheEditButton = () => {
|
||||
ArticlePage.edit_link_element.waitForVisible();
|
||||
ArticlePage.edit_link_element.waitForDisplayed();
|
||||
ArticlePage.edit_link_element.click();
|
||||
};
|
||||
const iSeeTheWikitextEditorOverlay = () => {
|
||||
ArticlePageWithEditorOverlay.editor_overlay_element.waitForVisible();
|
||||
ArticlePageWithEditorOverlay.editor_overlay_element.waitForDisplayed();
|
||||
ArticlePageWithEditorOverlay.editor_textarea_element.waitForExist();
|
||||
};
|
||||
const iClearTheEditor = () => {
|
||||
|
@ -16,13 +16,13 @@ const iClearTheEditor = () => {
|
|||
};
|
||||
const iDoNotSeeTheWikitextEditorOverlay = () => {
|
||||
browser.waitUntil( () => {
|
||||
return ArticlePageWithEditorOverlay.editor_overlay_element.isVisible() === false;
|
||||
return ArticlePageWithEditorOverlay.editor_overlay_element.isDisplayed() === false;
|
||||
}, 10000 );
|
||||
};
|
||||
const iTypeIntoTheEditor = ( text ) => {
|
||||
ArticlePageWithEditorOverlay.editor_overlay_element.waitForExist();
|
||||
ArticlePageWithEditorOverlay.editor_textarea_element.waitForExist();
|
||||
ArticlePageWithEditorOverlay.editor_textarea_element.waitForVisible();
|
||||
ArticlePageWithEditorOverlay.editor_textarea_element.waitForDisplayed();
|
||||
ArticlePageWithEditorOverlay.editor_textarea_element.addValue( text );
|
||||
browser.waitUntil( () => {
|
||||
return !ArticlePageWithEditorOverlay
|
||||
|
@ -40,16 +40,16 @@ const iClickSubmit = () => {
|
|||
const iSayOkayInTheConfirmDialog = () => {
|
||||
browser.waitUntil( () => {
|
||||
try {
|
||||
const text = browser.alertText;
|
||||
const text = browser.getAlertText();
|
||||
return text && true;
|
||||
} catch ( e ) {
|
||||
return false;
|
||||
}
|
||||
}, 2000 );
|
||||
browser.alertAccept();
|
||||
browser.acceptAlert();
|
||||
};
|
||||
const theTextOfTheFirstHeadingShouldBe = ( title ) => {
|
||||
ArticlePage.first_heading_element.waitForVisible();
|
||||
ArticlePage.first_heading_element.waitForDisplayed();
|
||||
assert.strictEqual(
|
||||
ArticlePage.first_heading_element.getText(),
|
||||
title
|
||||
|
|
|
@ -5,15 +5,15 @@ const assert = require( 'assert' ),
|
|||
SpecialMobileDiffPage } = require( '../support/world.js' );
|
||||
|
||||
const iClickOnTheHistoryLinkInTheLastModifiedBar = () => {
|
||||
ArticlePage.last_modified_bar_history_link_element.waitForVisible();
|
||||
ArticlePage.last_modified_bar_history_link_element.waitForDisplayed();
|
||||
ArticlePage.last_modified_bar_history_link_element.click();
|
||||
assert.strictEqual( SpecialHistoryPage.side_list_element.isVisible(), true );
|
||||
assert.strictEqual( SpecialHistoryPage.side_list_element.isDisplayed(), true );
|
||||
};
|
||||
|
||||
const iOpenTheLatestDiff = () => {
|
||||
SpecialHistoryPage.last_contribution_link_element.waitForExist();
|
||||
SpecialHistoryPage.last_contribution_link_element.click();
|
||||
assert.strictEqual( SpecialMobileDiffPage.user_info_element.isVisible(), true );
|
||||
assert.strictEqual( SpecialMobileDiffPage.user_info_element.isDisplayed(), true );
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const { defineSupportCode } = require( 'cucumber' ),
|
||||
const { defineSupportCode } = require( 'cucumber' ), // eslint-disable-line node/no-missing-require
|
||||
{ iClickOnTheCategoryButton,
|
||||
iShouldSeeTheCategoriesOverlay, iShouldSeeAListOfCategories
|
||||
} = require( './category_steps' ),
|
||||
|
|
|
@ -4,7 +4,7 @@ const assert = require( 'assert' );
|
|||
const { ArticlePage } = require( '../support/world.js' );
|
||||
|
||||
const iSeeALinkToAboutPage = () => {
|
||||
assert.strictEqual( ArticlePage.menu_element.element( '*=About' ).isVisible(), true );
|
||||
assert.strictEqual( ArticlePage.menu_element.$( '*=About' ).isDisplayed(), true );
|
||||
};
|
||||
|
||||
const iClickOnTheMainNavigationButton = () => {
|
||||
|
@ -12,21 +12,21 @@ const iClickOnTheMainNavigationButton = () => {
|
|||
};
|
||||
|
||||
const iShouldSeeAUserPageLinkInMenu = () => {
|
||||
ArticlePage.menu_element.element( '.primary-action' );
|
||||
ArticlePage.menu_element.$( '.primary-action' );
|
||||
};
|
||||
|
||||
const iShouldSeeLogoutLinkInMenu = () => {
|
||||
ArticlePage.menu_element.element( '.secondary-action' );
|
||||
ArticlePage.menu_element.$( '.secondary-action' );
|
||||
};
|
||||
|
||||
const iShouldSeeALinkInMenu = ( text ) => {
|
||||
assert.strictEqual( ArticlePage.menu_element.element( `span=${text}` ).isVisible(),
|
||||
assert.strictEqual( ArticlePage.menu_element.$( `span=${text}` ).isDisplayed(),
|
||||
true, `Link to ${text} is visible.` );
|
||||
};
|
||||
|
||||
const iShouldSeeALinkToDisclaimer = () => {
|
||||
ArticlePage.menu_element.element( '=Disclaimers' ).waitForVisible();
|
||||
assert.strictEqual( ArticlePage.menu_element.element( '=Disclaimers' ).isVisible(), true );
|
||||
ArticlePage.menu_element.$( '=Disclaimers' ).waitForDisplayed();
|
||||
assert.strictEqual( ArticlePage.menu_element.$( '=Disclaimers' ).isDisplayed(), true );
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -4,7 +4,7 @@ const ArticlePage = require( '../support/pages/article_page' );
|
|||
const { iClickTheOverlayCloseButton, iSeeAnOverlay, iDoNotSeeAnOverlay } = require( './common_steps' );
|
||||
|
||||
const iHaveNoNotifications = () => {
|
||||
ArticlePage.notifications_button_element.waitForVisible();
|
||||
ArticlePage.notifications_button_element.waitForDisplayed();
|
||||
// This is somewhat hacky, but we don't want this test making use of
|
||||
// Echo's APIs which may change
|
||||
browser.execute( '$( function () { $( ".notification-count span" ).hide(); } );' );
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
const { ArticlePage } = require( './../support/world' );
|
||||
|
||||
const iClickOnTheMask = () => {
|
||||
ArticlePage.drawer_mask_element.waitForVisible();
|
||||
ArticlePage.drawer_mask_element.waitForDisplayed();
|
||||
ArticlePage.drawer_mask_element.click();
|
||||
};
|
||||
|
||||
const iShouldSeeNotTheReferenceDrawer = () => {
|
||||
browser.waitUntil( () => !ArticlePage.drawer_element.isVisible() );
|
||||
browser.waitUntil( () => !ArticlePage.drawer_element.isDisplayed() );
|
||||
};
|
||||
|
||||
const iClickOnAReference = () => {
|
||||
|
@ -16,12 +16,12 @@ const iClickOnAReference = () => {
|
|||
};
|
||||
|
||||
const iClickOnANestedReference = () => {
|
||||
ArticlePage.drawer_reference_element.waitForVisible();
|
||||
ArticlePage.drawer_reference_element.waitForDisplayed();
|
||||
ArticlePage.drawer_reference_element.click();
|
||||
};
|
||||
|
||||
const iShouldSeeDrawerWithText = ( text ) => {
|
||||
ArticlePage.drawer_element.waitForVisible();
|
||||
ArticlePage.drawer_element.waitForDisplayed();
|
||||
browser.waitUntil( () => ArticlePage.drawer_element.getText().indexOf( text ) > -1 );
|
||||
};
|
||||
|
||||
|
|
|
@ -10,20 +10,20 @@ const iClickTheSearchIcon = () => {
|
|||
|
||||
const iTypeIntoTheSearchBox = ( term ) => {
|
||||
const input = ArticlePageWithOverlay.overlay_element
|
||||
.element( 'input' );
|
||||
.$( 'input' );
|
||||
input.waitForExist();
|
||||
input.setValue( term );
|
||||
};
|
||||
|
||||
const iSeeSearchResults = () => {
|
||||
ArticlePageWithOverlay.overlay_element
|
||||
.element( '.page-list' ).waitForExist( 5000 );
|
||||
.$( '.page-list' ).waitForExist( 5000 );
|
||||
};
|
||||
|
||||
const iClickASearchWatchstar = () => {
|
||||
iSeeSearchResults();
|
||||
const watchThisArticle = ArticlePageWithOverlay.overlay_element
|
||||
.element( '.watch-this-article' );
|
||||
.$( '.watch-this-article' );
|
||||
watchThisArticle.waitForExist( 5000 );
|
||||
watchThisArticle.click();
|
||||
};
|
||||
|
|
|
@ -7,15 +7,15 @@ const { ArticlePage } = require( '../support/world.js' );
|
|||
|
||||
const iClickTheAddTalkButton = () => {
|
||||
ArticlePage.waitUntilResourceLoaderModuleReady( 'skins.minerva.scripts' );
|
||||
ArticlePage.talk_add_element.waitForVisible();
|
||||
ArticlePage.talk_add_element.waitForDisplayed();
|
||||
ArticlePage.talk_add_element.click();
|
||||
};
|
||||
|
||||
const iAddATopic = ( subject ) => {
|
||||
const overlay = ArticlePageWithEditorOverlay.editor_overlay_element;
|
||||
overlay.element( '.overlay input' ).waitForExist();
|
||||
overlay.element( '.overlay input' ).setValue( subject );
|
||||
overlay.element( '.overlay textarea' ).setValue( 'Topic body is a really long text.' );
|
||||
overlay.$( '.overlay input' ).waitForExist();
|
||||
overlay.$( '.overlay input' ).setValue( subject );
|
||||
overlay.$( '.overlay textarea' ).setValue( 'Topic body is a really long text.' );
|
||||
browser.waitUntil( () =>
|
||||
!ArticlePageWithEditorOverlay.submit_element.getAttribute( 'disabled' )
|
||||
);
|
||||
|
@ -30,7 +30,7 @@ const iSeeTheTalkOverlay = () => {
|
|||
const thereShouldBeASaveDiscussionButton = () => {
|
||||
const submit = ArticlePageWithEditorOverlay.submit_element;
|
||||
submit.waitForExist();
|
||||
assert.strictEqual( submit.isVisible(), true );
|
||||
assert.strictEqual( submit.isDisplayed(), true );
|
||||
};
|
||||
|
||||
const noTopicIsPresent = () => {
|
||||
|
@ -38,15 +38,15 @@ const noTopicIsPresent = () => {
|
|||
};
|
||||
|
||||
const thereShouldBeAnAddDiscussionButton = () => {
|
||||
assert.strictEqual( ArticlePage.talk_add_element.isVisible(), true );
|
||||
assert.strictEqual( ArticlePage.talk_add_element.isDisplayed(), true );
|
||||
};
|
||||
|
||||
const thereShouldBeATalkButton = () => {
|
||||
assert.strictEqual( ArticlePage.talk_element.isVisible(), true );
|
||||
assert.strictEqual( ArticlePage.talk_element.isDisplayed(), true );
|
||||
};
|
||||
|
||||
const thereShouldBeNoTalkButton = () => {
|
||||
assert.strictEqual( ArticlePage.talk_element.isVisible(), false );
|
||||
assert.strictEqual( ArticlePage.talk_element.isDisplayed(), false );
|
||||
};
|
||||
|
||||
const iShouldSeeTheTopicInTheListOfTopics = ( subject ) => {
|
||||
|
@ -57,7 +57,7 @@ const iShouldSeeTheTopicInTheListOfTopics = ( subject ) => {
|
|||
};
|
||||
|
||||
const thereShouldBeATalkTab = () => {
|
||||
assert.strictEqual( ArticlePage.talk_tab_element.isVisible(), true );
|
||||
assert.strictEqual( ArticlePage.talk_tab_element.isDisplayed(), true );
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -5,7 +5,7 @@ const { ArticlePage } = require( '../support/world.js' );
|
|||
const { iAmOnPage } = require( './common_steps' );
|
||||
const { theTextOfTheFirstHeadingShouldBe } = require( './editor_steps' );
|
||||
|
||||
const username = browser.options.username.replace( /_/g, ' ' );
|
||||
const username = browser.config.mwUser.replace( /_/g, ' ' );
|
||||
|
||||
const iVisitMyUserPage = () => {
|
||||
iAmOnPage( `User:${username}` );
|
||||
|
@ -16,10 +16,10 @@ const iShouldBeOnMyUserPage = () => {
|
|||
};
|
||||
|
||||
const thereShouldBeALinkToMyContributions = () => {
|
||||
assert.strictEqual( ArticlePage.contributions_link_element.isVisible(), true );
|
||||
assert.strictEqual( ArticlePage.contributions_link_element.isDisplayed(), true );
|
||||
};
|
||||
const thereShouldBeALinkToMyTalkPage = () => {
|
||||
assert.strictEqual( ArticlePage.talk_tab_element.isVisible(), true );
|
||||
assert.strictEqual( ArticlePage.talk_tab_element.isDisplayed(), true );
|
||||
};
|
||||
|
||||
module.exports = { iVisitMyUserPage, iShouldBeOnMyUserPage,
|
||||
|
|
|
@ -12,7 +12,7 @@ const theWatchstarShouldNotBeSelected = () => {
|
|||
const theWatchstarShouldBeSelected = () => {
|
||||
ArticlePage.watched_element.waitForExist();
|
||||
const watchstar = ArticlePage.watched_element;
|
||||
assert.strictEqual( watchstar.isVisible(), true );
|
||||
assert.strictEqual( watchstar.isDisplayed(), true );
|
||||
};
|
||||
|
||||
const iClickTheWatchstar = () => {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const { After, Before } = require( 'cucumber' );
|
||||
const { After, Before } = require( 'cucumber' ); // eslint-disable-line node/no-missing-require
|
||||
|
||||
Before( function () {
|
||||
// This hook will be executed before ALL scenarios
|
||||
|
|
|
@ -42,10 +42,10 @@ class MinervaPage extends Page {
|
|||
this.open();
|
||||
}
|
||||
|
||||
const cookie = browser.getCookie( name );
|
||||
const cookie = browser.getCookies( [ name ] );
|
||||
|
||||
if ( !cookie || cookie.value !== value ) {
|
||||
browser.setCookie( {
|
||||
browser.setCookies( {
|
||||
name: name,
|
||||
value: value } );
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ class MinervaPage extends Page {
|
|||
const state = browser.execute( ( m ) => {
|
||||
return mw.loader.getState( m );
|
||||
}, moduleName );
|
||||
return state.value === 'ready';
|
||||
return state === 'ready';
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ exports.config = {
|
|||
// Defaults are for convenience with MediaWiki-Vagrant
|
||||
|
||||
// Wiki admin
|
||||
username: process.env.MEDIAWIKI_USER || 'Admin',
|
||||
password: process.env.MEDIAWIKI_PASSWORD || 'vagrant',
|
||||
mwUser: process.env.MEDIAWIKI_USER || 'Admin',
|
||||
mwPwd: process.env.MEDIAWIKI_PASSWORD || 'vagrant',
|
||||
|
||||
// Base for browser.url() and Page#openTitle()
|
||||
baseUrl: ( process.env.MW_SERVER || 'http://127.0.0.1:8080' ) + (
|
||||
|
@ -50,7 +50,7 @@ exports.config = {
|
|||
// https://sites.google.com/a/chromium.org/chromedriver/capabilities
|
||||
browserName: 'chrome',
|
||||
maxInstances: 1,
|
||||
chromeOptions: {
|
||||
'goog:chromeOptions': {
|
||||
// If DISPLAY is set, assume developer asked non-headless or CI with Xvfb.
|
||||
// Otherwise, use --headless (added in Chrome 59)
|
||||
// https://chromium.googlesource.com/chromium/src/+/59.0.3030.0/headless/README.md
|
||||
|
|
Loading…
Reference in a new issue