| 1 |
'use strict'; |
| 2 |
|
| 3 |
const { defineSupportCode } = require( '@cucumber/cucumber' ), |
| 4 |
{ iAmInAWikiThatHasCategories, |
| 5 |
iAmOnAPageThatHasTheFollowingEdits, |
| 6 |
iAmOnATalkPageWithNoTalkTopics, |
| 7 |
iAmViewingAWatchedPage, iAmViewingAnUnwatchedPage, |
| 8 |
iGoToAPageThatHasLanguages } = require( './create_page_api_steps' ), |
| 9 |
{ |
| 10 |
pageExists, iAmOnAPageThatDoesNotExist, iShouldSeeAToastNotification, |
| 11 |
iShouldSeeAToastNotificationWithMessage, iAmUsingMobileScreenResolution, |
| 12 |
iAmUsingTheMobileSite, iClickTheBrowserBackButton, |
| 13 |
iClickTheOverlayCloseButton, iDoNotSeeAnOverlay, |
| 14 |
iAmLoggedIntoTheMobileWebsite, |
| 15 |
iAmOnPage, iAmInBetaMode |
| 16 |
} = require( './common_steps' ), |
| 17 |
{ |
| 18 |
iClickTheEditButton, iSeeTheWikitextEditorOverlay, iClearTheEditor, |
| 19 |
iDoNotSeeTheWikitextEditorOverlay, |
| 20 |
iTypeIntoTheEditor, iClickContinue, iClickSubmit, iSayOkayInTheConfirmDialog, |
| 21 |
theTextOfTheFirstHeadingShouldBe, thereShouldBeARedLinkWithText |
| 22 |
} = require( './editor_steps' ), |
| 23 |
{ |
| 24 |
theWatchstarShouldNotBeSelected, theWatchstarShouldBeSelected, |
| 25 |
iClickTheWatchstar, iClickTheUnwatchStar } = require( './watch_steps' ), |
| 26 |
{ iVisitMyUserPage, iShouldBeOnMyUserPage, thereShouldBeALinkToMyContributions, |
| 27 |
thereShouldBeALinkToMyTalkPage |
| 28 |
} = require( './user_page_steps' ), |
| 29 |
{ |
| 30 |
iClickTheSearchIcon, |
| 31 |
iTypeIntoTheSearchBox, |
| 32 |
iClickASearchWatchstar, |
| 33 |
iSeeTheSearchOverlay |
| 34 |
} = require( './search_steps' ), |
| 35 |
{ iSeeALinkToAboutPage, iShouldSeeAUserPageLinkInMenu, |
| 36 |
iClickOnTheMainNavigationButton, |
| 37 |
iShouldSeeALinkInMenu, iShouldSeeALinkToDisclaimer |
| 38 |
} = require( './menu_steps' ), |
| 39 |
{ iHaveNoNotifications, iClickOnTheNotificationIcon, |
| 40 |
iShouldSeeTheNotificationsOverlay, iClickTheNotificationsOverlayCloseButton, |
| 41 |
iShouldNotSeeTheNotificationsOverlay |
| 42 |
} = require( './notification_steps' ); |
| 43 |
|
| 44 |
defineSupportCode( ( { Then, When, Given } ) => { |
| 45 |
|
| 46 |
|
| 47 |
Given( /^I click the edit button$/, iClickTheEditButton ); |
| 48 |
Then( /^I see the wikitext editor overlay$/, iSeeTheWikitextEditorOverlay ); |
| 49 |
When( /^I clear the editor$/, iClearTheEditor ); |
| 50 |
When( /^I type "(.+)" into the editor$/, iTypeIntoTheEditor ); |
| 51 |
When( /^I click continue$/, iClickContinue ); |
| 52 |
When( /^I click submit$/, iClickSubmit ); |
| 53 |
When( /^I say OK in the confirm dialog$/, iSayOkayInTheConfirmDialog ); |
| 54 |
When( /^I click the wikitext editor overlay close button$/, iClickTheOverlayCloseButton ); |
| 55 |
Then( /^I do not see the wikitext editor overlay$/, iDoNotSeeTheWikitextEditorOverlay ); |
| 56 |
Then( /^the text of the first heading should be "(.+)"$/, theTextOfTheFirstHeadingShouldBe ); |
| 57 |
Then( /^there should be a red link with text "(.+)"$/, thereShouldBeARedLinkWithText ); |
| 58 |
Then( /^I should not see the wikitext editor overlay$/, iDoNotSeeAnOverlay ); |
| 59 |
|
| 60 |
|
| 61 |
Given( /^I am using the mobile site$/, iAmUsingTheMobileSite ); |
| 62 |
When( /^I am viewing the site in mobile mode$/, iAmUsingMobileScreenResolution ); |
| 63 |
|
| 64 |
Given( /^I am in beta mode$/, iAmInBetaMode ); |
| 65 |
|
| 66 |
Given( /^I am on the "(.+)" page$/, iAmOnPage ); |
| 67 |
|
| 68 |
Given( /^I am logged into the mobile website$/, iAmLoggedIntoTheMobileWebsite ); |
| 69 |
Then( /^I should see a toast notification$/, iShouldSeeAToastNotification ); |
| 70 |
Then( /^I should see a toast with message "(.+)"$/, iShouldSeeAToastNotificationWithMessage ); |
| 71 |
When( /I click the browser back button/, iClickTheBrowserBackButton ); |
| 72 |
|
| 73 |
|
| 74 |
Given( /^I am on a talk page with no talk topics$/, iAmOnATalkPageWithNoTalkTopics ); |
| 75 |
Given( /^I am in a wiki that has categories$/, () => { |
| 76 |
iAmInAWikiThatHasCategories( 'Selenium categories test page' ); |
| 77 |
} ); |
| 78 |
Given( /^I am on a page that has the following edits:$/, iAmOnAPageThatHasTheFollowingEdits ); |
| 79 |
Given( /^I am on a page that does not exist$/, iAmOnAPageThatDoesNotExist ); |
| 80 |
Given( /^I go to a page that has languages$/, iGoToAPageThatHasLanguages ); |
| 81 |
Given( /^the page "(.+)" exists$/, pageExists ); |
| 82 |
Given( /^I am viewing a watched page$/, iAmViewingAWatchedPage ); |
| 83 |
Given( /^I am viewing an unwatched page$/, iAmViewingAnUnwatchedPage ); |
| 84 |
|
| 85 |
|
| 86 |
Then( /I have no notifications/, iHaveNoNotifications ); |
| 87 |
When( /I click on the notification icon/, iClickOnTheNotificationIcon ); |
| 88 |
When( /I click the notifications overlay close button/, iClickTheNotificationsOverlayCloseButton ); |
| 89 |
Then( /after 1 seconds I should not see the notifications overlay/, iShouldNotSeeTheNotificationsOverlay ); |
| 90 |
Then( /I should see the notifications overlay/, iShouldSeeTheNotificationsOverlay ); |
| 91 |
|
| 92 |
|
| 93 |
Given( /^I visit my user page$/, iVisitMyUserPage ); |
| 94 |
When( /^I should be on my user page$/, iShouldBeOnMyUserPage ); |
| 95 |
Then( /^there should be a link to my contributions$/, thereShouldBeALinkToMyContributions ); |
| 96 |
Then( /^there should be a link to my talk page$/, thereShouldBeALinkToMyTalkPage ); |
| 97 |
|
| 98 |
|
| 99 |
When( /^I click the search icon$/, iClickTheSearchIcon ); |
| 100 |
When( /^I type into search box "(.+)"$/, iTypeIntoTheSearchBox ); |
| 101 |
When( /^I click a search watch star$/, iClickASearchWatchstar ); |
| 102 |
Then( /^I see the search overlay$/, iSeeTheSearchOverlay ); |
| 103 |
|
| 104 |
|
| 105 |
When( /^I click on the main navigation button$/, iClickOnTheMainNavigationButton ); |
| 106 |
When( /^I should see a link to the about page$/, iSeeALinkToAboutPage ); |
| 107 |
Then( /^I should see a link to my user page in the main navigation menu$/, iShouldSeeAUserPageLinkInMenu ); |
| 108 |
Then( /^I should see a link to "(.+)" in the main navigation menu$/, iShouldSeeALinkInMenu ); |
| 109 |
Then( /^I should see a link to the disclaimer$/, iShouldSeeALinkToDisclaimer ); |
| 110 |
|
| 111 |
|
| 112 |
When( /^I click the watch star$/, iClickTheWatchstar ); |
| 113 |
When( /^I click the unwatch star$/, iClickTheUnwatchStar ); |
| 114 |
Then( /^the watch star should not be selected$/, theWatchstarShouldNotBeSelected ); |
| 115 |
Then( /^the watch star should be selected$/, theWatchstarShouldBeSelected ); |
| 116 |
|
| 117 |
} ); |