Created
November 1, 2011 21:37
-
-
Save mmichaelis/1332000 to your computer and use it in GitHub Desktop.
Examples of JBehave Stories
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
| Scenario: Waiting | |
| !-- | |
| Given I log in | |
| When I wait for 3 seconds because the main page needs to render first | |
| Then I see the main page |
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
| Scenario: Waiting | |
| !-- | |
| Given I log in | |
| When I wait for 3 seconds | |
| Then I see the main page |
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
| Scenario: Waiting | |
| !-- | |
| Given I log in | |
| When I wait for 3 seconds | |
| Then I see the main page | |
| Scenario: Reuse steps | |
| !-- | |
| Given I log in | |
| When ... | |
| Then ... | |
| Given I log in | |
| Then ... | |
| Scenario: Edge Cases | |
| !-- | |
| Given I add <a> to <b> | |
| Then I get <c> | |
| Examples: | |
| |a|b|c| | |
| |1|0|1| | |
| |0|1|1| | |
| |65535|1|65536| | |
| ... | |
| Scenario: Address UI Elements | |
| !-- | |
| Given I opened a document | |
| When I focus the references | |
| And I check the checkbox | |
| And I press the delete button | |
| Then the entry disappears |
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
| @Then("I see the main page") | |
| public void seeMainPage() { | |
| selenium.waitForCondition("selenium.browserbot.getCurrentWindow().someJavaScript",10000); | |
| [...] | |
| ) | |
| @Then("I see the main page") | |
| public void seeMainPage() { | |
| (new WebDriverWait(webDriver, 1000)) | |
| .until(new ExpectedCondition<Object>() { | |
| public Object apply(WebDriver d) { | |
| JavascriptExecutor js = (JavascriptExecutor) webDriver; | |
| return js.executeScript("return someJavaScript"); | |
| } | |
| }); | |
| [...] | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment