to use the site As a user I want to login Scenario: Login (with username) Given a user exists with username "paulbjensen" and email "[email protected]" and password "123456" And a dashboard exists with name "Your Dashboard" for user "paulbjensen" And I am on the homepage And I follow "Login" And the "login" modal should appear And I fill in "identifier" with "paulbjensen" And I fill in "password" with "123456" And I press "Login" Then the "login" modal should disappear And I should be on the dashboard page
We want to spin up the selenium server & client once browser = null World = (callback) -> if browser is null # Boot the selenium server selenium (err, selenium) => # Boot the selenium client browser = soda.createClient host: selenium.host port: selenium.port url: "http://localhost:3000" browser: "firefox"
step definitions @browser = browser callback {@browser} # Kill the selenium server when the process ends process.on 'exit', -> selenium.kill() else # Make Soda's browser object available to # the step definitions @browser = browser callback {@browser} exports.World = World
(username, callback) -> User.find {username}, (err, docs) -> if !err? and docs.length is 1 callback() else callback.fail "Expected there to be 1 user record with username #{username}, but found #{docs.length}"
@Then /^there should be an "([^"]*)" item in the Dashboards menu list$/, (item, callback) -> wrap @browser.chain.assertElementPresent("//span[contains(text(),'#{item}')]"), callback
up by people that were no smarter than you ... and you can change it, you can influence it, you can build your own things that other people can use. Once you learn that, you'll never be the same again." Steve Jobs