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,
|
|
|
|
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,
|
2018-04-10 21:19:08 +00:00
|
|
|
iAmUsingTheMobileSite,
|
|
|
|
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' ),
|
|
|
|
{
|
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 );
|
|
|
|
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 );
|
|
|
|
|
2018-04-10 21:19:08 +00:00
|
|
|
// common steps
|
|
|
|
Given( /^I am using the mobile site$/, iAmUsingTheMobileSite );
|
|
|
|
|
|
|
|
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 );
|
2018-04-10 21:19:08 +00:00
|
|
|
|
|
|
|
// Page steps
|
|
|
|
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 );
|
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 );
|
|
|
|
|
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 );
|
|
|
|
} );
|