A collection of useful web steps for cucumber+capybara
List of steps provided, how to use them, and what they do.
Fill out forms
When I fill in [field name] with [value] Ex: When I fill in "username" with "johndoe"
Then I should see the text [whatever text you want] Ex: Then I should see the text "Successfully logged in!" Then I should see all of the texts: | the first text | | the third text | | the fourth text | Then I should not see the text [whatever text should NOT appear] Then I should see the image [the value of the "src" attribute] Then I should see the image "test.png" Then I should see all of the images: | test.png | | about.png | | hello.png | Then I should see the HTML5 audio source "music.mp3" Then I should see all of the HTML5 audio sources: | track_01.mp3 | | track_03.mp3 | | track_04.mp3 | Then I should see a link that points to [value of the "href" attribute] Ex: Then I should see a link that points to "http://example.com" Then I should see a [tag name] tag around the text [some text] Ex: Then I should see a "code" tag around the text "printf 'Hello, world!';" Ex: Then I should see a "p" tag around the text "What a lovely bunch of coconuts!" Then I should see a [tag name] with [attribute name] of [attribute value] Ex: Then I should see a "div" with "id" of "content-container"
Test links, buttons, dialog boxes
Given I go to [path name] Ex: Given I go to the login page Then I should be on [path name] Ex: Then I should be on the new user page
Given pending Marks an entire scenario as pending. When I wait 3 seconds Pause the web driver for the specified number of seconds. For example, you want to test AJAX which fires after 500 milliseconds, have the web driver wait 1 second. Then debug Inserts a "debugger" step. You must have `ruby-debug` or a similar gem installed for this step to actually pause.