mediawiki-skins-MinervaNeue/tests/selenium/features/step_definitions/menu_steps.js
Vaughn Walters dd3fb66258 selenium: Refactor WebdriverIO tests from sync to async mode
WebdriverIO has dropped support of sync mode, hence changed to async.

Update npm packages: @wdio/*, wdio-mediawiki
because async mode needs at least @wdio v7.9.

Remove npm packages: @wdio/dot-reporter and @wdio/sync.

Bug: T293084
Change-Id: I5babbdadf21e9f951f69de93bfca5213a50965aa
(cherry picked from commit 677ce50b24)
2023-08-18 12:15:47 +01:00

39 lines
1.2 KiB
JavaScript

'use strict';
const assert = require( 'assert' );
const { ArticlePage } = require( '../support/world.js' );
const iSeeALinkToAboutPage = async () => {
assert.strictEqual( await ArticlePage.menu_element.$( '*=About' ).isDisplayed(), true );
};
const iClickOnTheMainNavigationButton = async () => {
await ArticlePage.menu_button_element.waitForDisplayed();
await ArticlePage.menu_button_element.click();
};
const iShouldSeeAUserPageLinkInMenu = async () => {
await ArticlePage.menu_element.$( '.menu__item--user' );
};
const iShouldSeeLogoutLinkInMenu = async () => {
await ArticlePage.menu_element.$( '.menu__item--logout' );
};
const iShouldSeeALinkInMenu = async ( text ) => {
assert.strictEqual( await ArticlePage.menu_element.$( `span=${text}` ).isDisplayed(),
true, `Link to ${text} is visible.` );
};
const iShouldSeeALinkToDisclaimer = async () => {
await ArticlePage.menu_element.$( 'span=Disclaimers' ).waitForDisplayed();
assert.strictEqual( await ArticlePage.menu_element.$( 'span=Disclaimers' ).isDisplayed(), true );
};
module.exports = {
iClickOnTheMainNavigationButton,
iSeeALinkToAboutPage, iShouldSeeAUserPageLinkInMenu,
iShouldSeeLogoutLinkInMenu,
iShouldSeeALinkInMenu, iShouldSeeALinkToDisclaimer
};