Skip to content

Instantly share code, notes, and snippets.

@mmichaelis
Created November 1, 2011 21:37
Show Gist options
  • Select an option

  • Save mmichaelis/1332000 to your computer and use it in GitHub Desktop.

Select an option

Save mmichaelis/1332000 to your computer and use it in GitHub Desktop.
Examples of JBehave Stories
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
Scenario: Waiting
!--
Given I log in
When I wait for 3 seconds
Then I see the main page
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
@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