Skip to content

Instantly share code, notes, and snippets.

@newswim
Created September 12, 2015 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save newswim/7551b175946a63f47293 to your computer and use it in GitHub Desktop.
Save newswim/7551b175946a63f47293 to your computer and use it in GitHub Desktop.
The insanity of Cucumber
module.exports = function () {
this.Given(/^I have created a landing page with this markdown$/, function (markdown, callback) {
this.server.call(
‘page/create’, {
path: ‘/‘,
markdown: markdown
}).then(function() {
setTimeout(callback, 3000);
});
});
this.When(/a user navigates to the landing page$/, function (callback) {
this.client.
url(process.env.ROOT_URL).
waitForExist('body *').
waitForVisible('body *').
call(callback)
});
this.Then(/^they see the heading "([^"]*)"$/, function (heading, callback) {
this.client.
getText('h1').should.become(heading).and.notify(callback);
});
this.Then(/^they see the cover image from "([^"]*)"$/, function (source, callback) {
this.client.
getAttribute('img', 'src').should.eventually.contain(source).and.notify(callback);
});
this.Then(^/they can navigate to "([^"]*)" at "([^"]*)"$/, function (location, source, callback) {
this.client.
getAttribute('a[title="' + location + '"]', 'href').should.eventually.contain(source).and.notify(callback);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment