mediawiki-skins-MinervaNeue/tests/selenium/features/step_definitions/search_steps.js
Vaughn Walters 677ce50b24 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
2023-04-08 16:18:28 -05:00

42 lines
1.1 KiB
JavaScript

'use strict';
const { iSeeAnOverlay } = require( './common_steps' );
const { ArticlePage } = require( '../support/world.js' );
const ArticlePageWithOverlay = require( '../support/pages/article_page_with_overlay' );
const iClickTheSearchIcon = async () => {
await ArticlePage.search_icon_element.waitForDisplayed();
await ArticlePage.search_icon_element.click();
};
const iTypeIntoTheSearchBox = async ( term ) => {
const input = await ArticlePageWithOverlay.overlay_element
.$( 'input' );
await input.waitForExist();
await input.setValue( term );
};
const iSeeSearchResults = async () => {
await ArticlePageWithOverlay.overlay_element
.$( '.page-list' ).waitForExist( 5000 );
};
const iClickASearchWatchstar = async () => {
await iSeeSearchResults();
const watchThisArticle = ArticlePageWithOverlay.overlay_element
.$( '.watch-this-article' );
watchThisArticle.waitForExist( 5000 );
watchThisArticle.click();
};
const iSeeTheSearchOverlay = async () => {
await iSeeAnOverlay();
};
module.exports = {
iClickTheSearchIcon,
iTypeIntoTheSearchBox,
iClickASearchWatchstar,
iSeeTheSearchOverlay
};