Skip to content

Instantly share code, notes, and snippets.

@paulbjensen
Created June 18, 2018 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paulbjensen/4001584211bedd4c31b35a578c99cdc9 to your computer and use it in GitHub Desktop.
Save paulbjensen/4001584211bedd4c31b35a578c99cdc9 to your computer and use it in GitHub Desktop.
Step definitions, for an article on Medium
// Dependencies
const { Given, When, Then } = require('cucumber');
const {
visitHomepage,
assertUserHasPassword,
assertUserHasEmail,
userExists,
closeAccount,
pending,
clickOnItem,
takenToPage,
fillInFormField,
pressButton,
shouldBeOnPage,
acceptTerms,
shouldSeeText,
shouldNotSeeText,
checkEmailInbox,
checkEmailSubject,
clickOnLinkInEmail,
onPageForUser,
hoverOverItem,
checkCookiesAreCleared,
reloadPage,
wait
} = require('../support/actions');
Given('I am on the homepage', visitHomepage);
Given('I click on {string}', clickOnItem);
When('I am taken to the {string} page', takenToPage);
When('I fill in {string} with {string}', fillInFormField);
When('I accept the terms', acceptTerms);
Given('the user {string} then closes their account', closeAccount);
When('I press {string}', pressButton);
Then('I should be on the {string} page', shouldBeOnPage);
Given('pending', pending);
Given('a valid user {string} already exists', userExists);
Then('I should see {string}', shouldSeeText);
Then('I should not see {string}', shouldNotSeeText);
When('I check my email inbox', checkEmailInbox);
Then('I should see an email saying {string}', checkEmailSubject);
When('I click on the link inside the email', clickOnLinkInEmail);
Then('I am on the {string} page for user {string}', onPageForUser);
When('I hover over {string}', hoverOverItem);
Then('user {string} should have the email {string}', assertUserHasEmail);
Then(
'user {string} should have the password {string}',
assertUserHasPassword
);
Then(
'my token and session cookies should be cleared',
checkCookiesAreCleared
);
Then('I reload the page', reloadPage);
Then('I wait for {int} seconds', { timeout: 60 * 1000 }, wait);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment