2011-06-29 12:00:26 +00:00
|
|
|
When /^I follow image link "([^"]*)"$/ do |img_alt|
|
2012-03-21 23:50:34 +00:00
|
|
|
find(:xpath, "//img[@alt = '#{img_alt}']/parent::a").click()
|
2011-07-04 13:25:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Then /^I should get a download with the filename "([^\"]*)"$/ do |filename|
|
|
|
|
page.response_headers['Content-Disposition'].should include("filename=\"#{filename}\"")
|
2011-08-11 20:45:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
When /^I wait until "([^"]*)" is visible$/ do |selector|
|
|
|
|
page.has_css?("#{selector}", :visible => true)
|
|
|
|
end
|
|
|
|
|
2011-08-13 03:21:27 +00:00
|
|
|
When /^I wait until ([^"]*) is visible$/ do |locator|
|
|
|
|
page.has_css?(selector_for(locator), :visible => true)
|
|
|
|
end
|
|
|
|
|
2012-03-01 10:07:22 +00:00
|
|
|
When /^I sync my form with my backbone model because of Firefox$/ do
|
|
|
|
page.execute_script("$(':input').trigger('change')")
|
|
|
|
end
|
|
|
|
|
|
|
|
Then /^"([^"]*)" should not be visible$/ do |text|
|
|
|
|
begin
|
|
|
|
assert page.find(text).visible? != true
|
|
|
|
rescue Capybara::ElementNotFound
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-08-11 20:45:46 +00:00
|
|
|
Then /^"([^"]*)" should( not)? be an option for "([^"]*)"(?: within "([^\"]*)")?$/ do |value, negate, field, selector|
|
|
|
|
with_scope(selector) do
|
|
|
|
expectation = negate ? :should_not : :should
|
|
|
|
field_labeled(field).first(:xpath, ".//option[text() = '#{value}']").send(expectation, be_present)
|
|
|
|
end
|
2012-03-01 10:07:22 +00:00
|
|
|
end
|
2012-03-21 23:50:34 +00:00
|
|
|
|
|
|
|
Then /^"([^"]*)" should be selected for "([^"]*)"$/ do |value, field|
|
|
|
|
assert page.has_xpath?("//select[@name='#{field}' and option[@selected and contains(text(), '#{value}')]]")
|
|
|
|
end
|
|
|
|
|
|
|
|
When /^I reload the page$/ do
|
|
|
|
visit current_path
|
|
|
|
end
|