Created
August 4, 2010 17:52
-
-
Save albertoperdomo/508514 to your computer and use it in GitHub Desktop.
This file contains 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
Feature: Cool AJAX autocomplete | |
Scenario: Autocomplete city | |
When I fill in "City" with "Madr" | |
Then I should see "Madrid, Spain" | |
When I follow "Madrid, Spain" | |
Then the field "City" should contain "Madrid, Spain" |
This file contains 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
Feature: Cool AJAX autocomplete | |
Scenario: Autocomplete city | |
When I fill in "City" with "Madr" | |
Then I should see the following autocomplete options: | |
| Madrid, Spain | | |
| Madridejos, Spain | | |
When I click on the "Madrid, Spain" autocomplete option | |
Then the field "City" should contain "Madrid, Spain" |
This file contains 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
Feature: Cool AJAX autocomplete | |
Scenario: Autocomplete city | |
When I fill in "City" with "Madr" | |
Then I should see the following autocomplete options: | |
| Madrid, Spain | | |
| Madridejos, Spain | | |
When I follow "Madrid, Spain" | |
Then the field "City" should contain "Madrid, Spain" |
This file contains 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
Feature: Cool AJAX autocomplete | |
Scenario: Autocomplete city | |
When I fill in "City" with "Madr" | |
And I wait for 2 seconds | |
Then I should see "Madrid, Spain" | |
When I follow "Madrid, Spain" | |
Then the field "City" should contain "Madrid, Spain" |
This file contains 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
When /^I click on the "([^"]*)" autocomplete option$/ do |link_text| | |
# this should work in future versions but no in current stable | |
# page.evaluate_script %Q{ $('.ui-menu-item a:contains("#{link_text}")').trigger("mouseenter").click(); } | |
page.execute_script %Q{ $('.ui-menu-item a:contains("#{link_text}")').trigger("mouseenter").click(); } | |
end |
This file contains 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 should see the following autocomplete options:$/ do |table| | |
# table is a Cucumber::Ast::Table | |
table.raw.each do |row| | |
locate(:xpath, "//a[text()='#{row[0]}']") | |
end | |
end |
This file contains 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
When /^I wait for (\d+) seconds?$/ do |secs| | |
sleep secs.to_i | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment