2018-04-10 21:19:08 +00:00
|
|
|
const { defineSupportCode } = require( 'cucumber' ),
|
|
|
|
{ iClickOnTheCategoryButton,
|
|
|
|
iShouldSeeTheCategoriesOverlay, iShouldSeeAListOfCategories
|
|
|
|
} = require( './category_steps' ),
|
2018-04-10 21:35:50 +00:00
|
|
|
{ iAmInAWikiThatHasCategories,
|
2019-04-05 21:09:47 +00:00
|
|
|
iAmOnAPageThatHasTheFollowingEdits,
|
2019-10-17 22:46:07 +00:00
|
|
|
iAmOnATalkPageWithNoTalkTopics,
|
2019-04-08 23:45:11 +00:00
|
|
|
iAmViewingAWatchedPage, iAmViewingAnUnwatchedPage,
|
2019-04-05 21:09:47 +00:00
|
|
|
iGoToAPageThatHasLanguages } = require( './create_page_api_steps' ),
|
2018-04-10 21:19:08 +00:00
|
|
|
{
|
2019-04-05 21:09:47 +00:00
|
|
|
pageExists, iAmOnAPageThatDoesNotExist, iShouldSeeAToastNotification,
|
2019-04-08 23:45:11 +00:00
|
|
|
iShouldSeeAToastNotificationWithMessage, iAmUsingMobileScreenResolution,
|
2019-04-08 21:11:33 +00:00
|
|
|
iAmUsingTheMobileSite, iClickTheBrowserBackButton,
|
2019-04-08 23:45:11 +00:00
|
|
|
iClickTheOverlayCloseButton, iDoNotSeeAnOverlay,
|
2018-04-10 21:19:08 +00:00
|
|
|
iAmLoggedIntoTheMobileWebsite,
|
|
|
|
iAmOnPage, iAmInBetaMode
|
|
|
|
} = require( './common_steps' ),
|
|
|
|
{
|
2018-04-10 21:35:50 +00:00
|
|
|
iShouldSeeAddedContent, iShouldSeeRemovedContent
|
|
|
|
} = require( './diff_steps' ),
|
|
|
|
{
|
|
|
|
iOpenTheLatestDiff,
|
2019-04-05 21:09:47 +00:00
|
|
|
iClickTheEditButton, iSeeTheWikitextEditorOverlay, iClearTheEditor,
|
|
|
|
iDoNotSeeTheWikitextEditorOverlay,
|
|
|
|
iTypeIntoTheEditor, iClickContinue, iClickSubmit, iSayOkayInTheConfirmDialog,
|
|
|
|
theTextOfTheFirstHeadingShouldBe, thereShouldBeARedLinkWithText
|
|
|
|
} = require( './editor_steps' ),
|
2019-04-08 23:45:11 +00:00
|
|
|
{
|
|
|
|
theWatchstarShouldNotBeSelected, theWatchstarShouldBeSelected,
|
|
|
|
iClickTheWatchstar, iClickTheUnwatchStar } = require( './watch_steps' ),
|
2019-10-01 01:19:38 +00:00
|
|
|
{ iVisitMyUserPage, iShouldBeOnMyUserPage, thereShouldBeALinkToMyContributions,
|
|
|
|
thereShouldBeALinkToMyTalkPage
|
2019-04-08 23:45:11 +00:00
|
|
|
} = require( './user_page_steps' ),
|
|
|
|
{
|
|
|
|
iClickTheSearchIcon,
|
|
|
|
iTypeIntoTheSearchBox,
|
|
|
|
iClickASearchWatchstar,
|
|
|
|
iSeeTheSearchOverlay
|
|
|
|
} = require( './search_steps' ),
|
|
|
|
{
|
2019-10-17 22:46:07 +00:00
|
|
|
iClickTheAddTalkButton,
|
2019-04-08 23:45:11 +00:00
|
|
|
iAddATopic,
|
|
|
|
iSeeTheTalkOverlay,
|
|
|
|
thereShouldBeASaveDiscussionButton,
|
|
|
|
noTopicIsPresent,
|
|
|
|
thereShouldBeAnAddDiscussionButton,
|
2019-10-17 22:46:07 +00:00
|
|
|
thereShouldBeATalkButton,
|
2019-04-08 23:45:11 +00:00
|
|
|
thereShouldBeNoTalkButton,
|
|
|
|
iShouldSeeTheTopicInTheListOfTopics
|
|
|
|
} = require( './talk_steps' ),
|
|
|
|
{ iSeeALinkToAboutPage, iShouldSeeAUserPageLinkInMenu,
|
|
|
|
iClickOnTheMainNavigationButton,
|
|
|
|
iShouldSeeALinkInMenu, iShouldSeeALinkToDisclaimer
|
|
|
|
} = require( './menu_steps' ),
|
2019-04-08 21:11:33 +00:00
|
|
|
{ iHaveNoNotifications, iClickOnTheNotificationIcon,
|
|
|
|
iShouldSeeTheNotificationsOverlay, iClickTheNotificationsOverlayCloseButton,
|
|
|
|
iShouldNotSeeTheNotificationsOverlay
|
|
|
|
} = require( './notification_steps' ),
|
2019-04-05 21:09:47 +00:00
|
|
|
{
|
2018-04-10 21:19:08 +00:00
|
|
|
iClickOnTheHistoryLinkInTheLastModifiedBar
|
|
|
|
} = require( './history_steps' );
|
|
|
|
|
|
|
|
defineSupportCode( function ( { Then, When, Given } ) {
|
|
|
|
|
2019-04-05 21:09:47 +00:00
|
|
|
// Editor steps
|
|
|
|
Given( /^I click the edit button$/, iClickTheEditButton );
|
|
|
|
Then( /^I see the wikitext editor overlay$/, iSeeTheWikitextEditorOverlay );
|
|
|
|
When( /^I clear the editor$/, iClearTheEditor );
|
|
|
|
When( /^I type "(.+)" into the editor$/, iTypeIntoTheEditor );
|
|
|
|
When( /^I click continue$/, iClickContinue );
|
|
|
|
When( /^I click submit$/, iClickSubmit );
|
|
|
|
When( /^I say OK in the confirm dialog$/, iSayOkayInTheConfirmDialog );
|
2019-04-08 23:45:11 +00:00
|
|
|
When( /^I click the wikitext editor overlay close button$/, iClickTheOverlayCloseButton );
|
2019-04-05 21:09:47 +00:00
|
|
|
Then( /^I do not see the wikitext editor overlay$/, iDoNotSeeTheWikitextEditorOverlay );
|
|
|
|
Then( /^the text of the first heading should be "(.+)"$/, theTextOfTheFirstHeadingShouldBe );
|
|
|
|
Then( /^there should be a red link with text "(.+)"$/, thereShouldBeARedLinkWithText );
|
2019-04-08 23:45:11 +00:00
|
|
|
Then( /^I should not see the wikitext editor overlay$/, iDoNotSeeAnOverlay );
|
2019-04-05 21:09:47 +00:00
|
|
|
|
2018-04-10 21:19:08 +00:00
|
|
|
// common steps
|
|
|
|
Given( /^I am using the mobile site$/, iAmUsingTheMobileSite );
|
2019-04-08 23:45:11 +00:00
|
|
|
When( /^I am viewing the site in mobile mode$/, iAmUsingMobileScreenResolution );
|
2018-04-10 21:19:08 +00:00
|
|
|
|
|
|
|
Given( /^I am in beta mode$/, iAmInBetaMode );
|
|
|
|
|
|
|
|
Given( /^I am on the "(.+)" page$/, iAmOnPage );
|
|
|
|
|
|
|
|
Given( /^I am logged into the mobile website$/, iAmLoggedIntoTheMobileWebsite );
|
2019-04-05 21:09:47 +00:00
|
|
|
Then( /^I should see a toast notification$/, iShouldSeeAToastNotification );
|
2019-04-08 23:45:11 +00:00
|
|
|
Then( /^I should see a toast with message "(.+)"$/, iShouldSeeAToastNotificationWithMessage );
|
2019-04-08 21:11:33 +00:00
|
|
|
When( /I click the browser back button/, iClickTheBrowserBackButton );
|
2018-04-10 21:19:08 +00:00
|
|
|
|
|
|
|
// Page steps
|
2019-10-17 22:46:07 +00:00
|
|
|
Given( /^I am on a talk page with no talk topics$/, iAmOnATalkPageWithNoTalkTopics );
|
2018-04-10 21:19:08 +00:00
|
|
|
Given( /^I am in a wiki that has categories$/, () => {
|
|
|
|
iAmInAWikiThatHasCategories( 'Selenium categories test page' );
|
|
|
|
} );
|
2018-04-10 21:35:50 +00:00
|
|
|
Given( /^I am on a page that has the following edits:$/, iAmOnAPageThatHasTheFollowingEdits );
|
2019-04-05 21:09:47 +00:00
|
|
|
Given( /^I am on a page that does not exist$/, iAmOnAPageThatDoesNotExist );
|
|
|
|
Given( /^I go to a page that has languages$/, iGoToAPageThatHasLanguages );
|
|
|
|
Given( /^the page "(.+)" exists$/, pageExists );
|
2019-04-08 23:45:11 +00:00
|
|
|
Given( /^I am viewing a watched page$/, iAmViewingAWatchedPage );
|
|
|
|
Given( /^I am viewing an unwatched page$/, iAmViewingAnUnwatchedPage );
|
2018-04-10 21:19:08 +00:00
|
|
|
|
|
|
|
// history steps
|
2018-04-10 21:35:50 +00:00
|
|
|
When( /^I open the latest diff$/, iOpenTheLatestDiff );
|
2018-04-10 21:19:08 +00:00
|
|
|
When( /^I click on the history link in the last modified bar$/,
|
|
|
|
iClickOnTheHistoryLinkInTheLastModifiedBar );
|
|
|
|
|
2018-04-10 21:35:50 +00:00
|
|
|
// diff steps
|
|
|
|
Then( /^I should see "(.*?)" as added content$/, iShouldSeeAddedContent );
|
|
|
|
Then( /^I should see "(.*?)" as removed content$/, iShouldSeeRemovedContent );
|
|
|
|
|
2019-04-08 21:11:33 +00:00
|
|
|
// notifications
|
|
|
|
Then( /I have no notifications/, iHaveNoNotifications );
|
|
|
|
When( /I click on the notification icon/, iClickOnTheNotificationIcon );
|
|
|
|
When( /I click the notifications overlay close button/, iClickTheNotificationsOverlayCloseButton );
|
|
|
|
Then( /after 1 seconds I should not see the notifications overlay/, iShouldNotSeeTheNotificationsOverlay );
|
|
|
|
Then( /I should see the notifications overlay/, iShouldSeeTheNotificationsOverlay );
|
|
|
|
|
2019-04-08 23:45:11 +00:00
|
|
|
// talk
|
2019-10-17 22:46:07 +00:00
|
|
|
When( /^I click the add talk button$/, iClickTheAddTalkButton );
|
2019-04-08 23:45:11 +00:00
|
|
|
When( /^I add a topic called "(.+)"$/, iAddATopic );
|
|
|
|
Then( /^I see the talk overlay$/, iSeeTheTalkOverlay );
|
|
|
|
Then( /^I should see the talk overlay$/, iSeeTheTalkOverlay );
|
|
|
|
Then( /^there should be a save discussion button$/, thereShouldBeASaveDiscussionButton );
|
|
|
|
Then( /^no topic is present$/, noTopicIsPresent );
|
|
|
|
Then( /^there should be an add discussion button$/, thereShouldBeAnAddDiscussionButton );
|
2019-10-17 22:46:07 +00:00
|
|
|
Then( /^there should be a talk button/, thereShouldBeATalkButton );
|
2019-04-08 23:45:11 +00:00
|
|
|
Then( /^there should be no talk button$/, thereShouldBeNoTalkButton );
|
|
|
|
Then( /^I should see the topic called "(.+)" in the list of topics$/, iShouldSeeTheTopicInTheListOfTopics );
|
|
|
|
|
|
|
|
// user page
|
|
|
|
Given( /^I visit my user page$/, iVisitMyUserPage );
|
|
|
|
When( /^I should be on my user page$/, iShouldBeOnMyUserPage );
|
|
|
|
Then( /^there should be a link to my contributions$/, thereShouldBeALinkToMyContributions );
|
|
|
|
Then( /^there should be a link to my talk page$/, thereShouldBeALinkToMyTalkPage );
|
|
|
|
|
|
|
|
// search
|
|
|
|
When( /^I click the search icon$/, iClickTheSearchIcon );
|
|
|
|
When( /^I type into search box "(.+)"$/, iTypeIntoTheSearchBox );
|
|
|
|
When( /^I click a search watch star$/, iClickASearchWatchstar );
|
|
|
|
Then( /^I see the search overlay$/, iSeeTheSearchOverlay );
|
|
|
|
|
|
|
|
// main menu
|
|
|
|
When( /^I click on the main navigation button$/, iClickOnTheMainNavigationButton );
|
|
|
|
When( /^I should see a link to the about page$/, iSeeALinkToAboutPage );
|
|
|
|
Then( /^I should see a link to my user page in the main navigation menu$/, iShouldSeeAUserPageLinkInMenu );
|
|
|
|
Then( /^I should see a link to "(.+)" in the main navigation menu$/, iShouldSeeALinkInMenu );
|
|
|
|
Then( /^I should see a link to the disclaimer$/, iShouldSeeALinkToDisclaimer );
|
|
|
|
|
|
|
|
// watchstar
|
|
|
|
When( /^I click the watch star$/, iClickTheWatchstar );
|
|
|
|
When( /^I click the unwatch star$/, iClickTheUnwatchStar );
|
|
|
|
Then( /^the watch star should not be selected$/, theWatchstarShouldNotBeSelected );
|
|
|
|
Then( /^the watch star should be selected$/, theWatchstarShouldBeSelected );
|
|
|
|
|
2018-04-10 21:19:08 +00:00
|
|
|
// Category steps
|
|
|
|
When( /^I click on the category button$/, iClickOnTheCategoryButton );
|
|
|
|
|
|
|
|
Then( /^I should see the categories overlay$/, iShouldSeeTheCategoriesOverlay );
|
|
|
|
|
|
|
|
Then( /^I should see a list of categories$/, iShouldSeeAListOfCategories );
|
|
|
|
} );
|