| 1 | 'use strict'; |
| 2 | |
| 3 | const { iSeeAnOverlay } = require( './common_steps' ); |
| 4 | const { ArticlePage } = require( '../support/world.js' ); |
| 5 | const ArticlePageWithOverlay = require( '../support/pages/article_page_with_overlay' ); |
| 6 | |
| 7 | const iClickTheSearchIcon = async () => { |
| 8 | await ArticlePage.search_icon_element.waitForDisplayed(); |
| 9 | await ArticlePage.search_icon_element.click(); |
| 10 | }; |
| 11 | |
| 12 | const iTypeIntoTheSearchBox = async ( term ) => { |
| 13 | const input = await ArticlePageWithOverlay.overlay_element |
| 14 | .$( 'input' ); |
| 15 | await input.waitForExist(); |
| 16 | await input.setValue( term ); |
| 17 | }; |
| 18 | |
| 19 | const iSeeSearchResults = async () => { |
| 20 | await ArticlePageWithOverlay.overlay_element |
| 21 | .$( '.page-list' ).waitForExist( 5000 ); |
| 22 | }; |
| 23 | |
| 24 | const iClickASearchWatchstar = async () => { |
| 25 | await iSeeSearchResults(); |
| 26 | const watchThisArticle = ArticlePageWithOverlay.overlay_element |
| 27 | .$( '.watch-this-article' ); |
| 28 | watchThisArticle.waitForExist( 5000 ); |
| 29 | watchThisArticle.click(); |
| 30 | }; |
| 31 | |
| 32 | const iSeeTheSearchOverlay = async () => { |
| 33 | await iSeeAnOverlay(); |
| 34 | }; |
| 35 | |
| 36 | module.exports = { |
| 37 | iClickTheSearchIcon, |
| 38 | iTypeIntoTheSearchBox, |
| 39 | iClickASearchWatchstar, |
| 40 | iSeeTheSearchOverlay |
| 41 | }; |