Created
October 6, 2009 19:21
-
-
Save bigfleet/203330 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # First, you don't have to fret about the word at the beginning-- you can use | |
| # any of them at any time. Given, When or Then, it doesn't really matter. | |
| # | |
| # Second, webrat doesn't do JavaScript. If we reference AJAX interfaces | |
| # directly, we can do that, but the binding will be performed manually by Jim. | |
| # If we find ourselves constantly doing that, we should look into expanding | |
| # testing support to JavaScript as well. | |
| # | |
| # Third, you should feel free, rather than constrained, when you are writing | |
| # Cucumber. It's the development job to polish and flesh out when we don't | |
| # understand the language you're using. Use the phrases you need, we'll | |
| # figure it out | |
| # | |
| # Lastly, here's an introduction of what we get for Cucumber "out of the box" | |
| # with a supplemental technology called Webrat. | |
| # | |
| # If you feel the wording of the steps themselves is clumsy, that's fine, | |
| # we can change them for our project. Just be aware that this is what | |
| # available. You should find the metaphors accessible, I think! | |
| # Let's begin! | |
| # You can name pages instead of having to use URL's, like | |
| # Given I am on the home page | |
| # or | |
| # Given I am on the Trader Network dashboard | |
| # | |
| # You can also try naming something specific | |
| # Given I am on the blog page for the post titled "blah" from "whoever" | |
| Given I am on (.+) | |
| # Works the same as the above | |
| When I go to (.+) | |
| # This presses a button, either a submit button or just a regular button on the page. | |
| When I press "([^\"]*)" | |
| # This clicks on a link | |
| When I follow "([^\"]*)" | |
| # Webrat has the ability to search within certain portions of the page. | |
| # e.g. "the 'Trade Notes' link in the dashboard sidebar" | |
| # Otherwise it might have visited the "Trade Notes" link at the top of the | |
| # page in the global navigation. | |
| When I follow "([^\"]*)" within "([^\"]*)" | |
| # This is about filling in form data-- name the label of the field you'd like to type into and what it should contain. | |
| When I fill in "([^\"]*)" with "([^\"]*)" | |
| # This is almost the same as the above, just the words are in a different order | |
| When I fill in "([^\"]*)" for "([^\"]*)" | |
| # Use this to fill in an entire form with data from a table. Example: | |
| # | |
| # When I fill in the following: | |
| # | Account Number | 5002 | | |
| # | Expiry date | 2009-11-01 | | |
| # | Note | Nice guy | | |
| # | Wants Email? | | | |
| # | |
| When I fill in the following: | |
| # This is about selecting from dropdowns. | |
| # If you use this one, it's a good idea to have another scenario talking about | |
| # what should be in the dropdown. | |
| When I select "([^\"]*)" from "([^\"]*)" | |
| # Use this step in conjunction with Rail's datetime_select helper. For example: | |
| # When I select "December 25, 2008 10:00" as the date and time | |
| When I select "([^\"]*)" as the date and time | |
| # Use this step when using multiple datetime_select helpers on a page or | |
| # you want to specify which datetime to select. Given the following view: | |
| # <%= f.label :preferred %><br /> | |
| # <%= f.datetime_select :preferred %> | |
| # <%= f.label :alternative %><br /> | |
| # <%= f.datetime_select :alternative %> | |
| # The following steps would fill out the form: | |
| # When I select "November 23, 2004 11:20" as the "Preferred" date and time | |
| # And I select "November 25, 2004 10:30" as the "Alternative" date and time | |
| When I select "([^\"]*)" as the "([^\"]*)" date and time | |
| When I select "([^\"]*)" as the time | |
| When I select "([^\"]*)" as the "([^\"]*)" time | |
| When I select "([^\"]*)" as the date | |
| When I select "([^\"]*)" as the "([^\"]*)" date | |
| # This is for selecting checkboxes | |
| When I check "([^\"]*)" | |
| When I uncheck "([^\"]*)" | |
| # Not sure on this one, I think it does radio buttons? | |
| When I choose "([^\"]*)" | |
| When I attach the file at "([^\"]*)" to "([^\"]*)" | |
| # This one is general purpose. | |
| # As long as what you type is in the document somewhere, it'll pass. | |
| # Easy to get 'false positives' with this one, but it's also very easy to use. | |
| # We'll get the hang of it. | |
| Then I should see "([^\"]*)" | |
| # This will pass when the text is on the screen in the specified area. | |
| # It's probably a good habit to favor this step to the above. | |
| Then I should see "([^\"]*)" within "([^\"]*)" | |
| # Just as you can test for things you see, you can ensure that certain things are not visible. | |
| Then I should not see "([^\"]*)" | |
| # And you can be more specific about areas of the page with that as well. | |
| Then I should not see "([^\"]*)" within "([^\"]*)" | |
| # This is about what you should see 'pre-filled' on a particular form field on the page | |
| Then the "([^\"]*)" field should contain "([^\"]*)" | |
| Then the "([^\"]*)" field should not contain "([^\"]*)" | |
| Then the "([^\"]*)" checkbox should be checked | |
| Then the "([^\"]*)" checkbox should not be checked | |
| # This is about asserting where you end up after a request is done. | |
| # For example, after creating a new forum topic, you may want to go to the main forum page, or something. | |
| Then I should be on (.+) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment