Created
September 12, 2015 19:37
-
-
Save newswim/7551b175946a63f47293 to your computer and use it in GitHub Desktop.
The insanity of Cucumber
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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