Support for phantomjs 2.5
This commit is contained in:
@@ -33,7 +33,10 @@ Then /^(?:I )?click (?:on )?(?:the )?(a )?'(.+?)'( button| link)?(?: beside '(.+
|
||||
else
|
||||
element = element_with_text(item, root_item)
|
||||
end
|
||||
element.click
|
||||
begin
|
||||
element.click
|
||||
rescue Capybara::Poltergeist::TimeoutError
|
||||
end
|
||||
rescue Exception => e
|
||||
puts text
|
||||
raise e
|
||||
|
||||
@@ -20,10 +20,23 @@ Given /^(?:(?:I )?am )?on an? (.+) error page$/i do |page_name|
|
||||
end
|
||||
|
||||
Then /^(?:I )?should be on (?:the |an? | my)?(.+) page$/i do |page_name|
|
||||
sleep(1)
|
||||
attempt_to do
|
||||
path = path_to(page_name)
|
||||
path = /(https?\/\/:[^\/]+)?#{Regexp.escape(path)}\/?(\?|#|$)/ unless path.is_a?(Regexp)
|
||||
current_url.should match path
|
||||
begin
|
||||
current_url.should match path
|
||||
rescue Exception => e
|
||||
# due to a bug in phantomjs 2.5-development, sometimes postbacks don't work properly, this is a workaround
|
||||
if page.driver.network_traffic.last.url =~ path && page.driver.network_traffic.last.method =~ /^get$/i && page.driver.network_traffic.last.response_parts.present? && page.driver.network_traffic.last.response_parts.first.status == 200
|
||||
attempt_to do
|
||||
visit page.driver.network_traffic.last.url
|
||||
end
|
||||
else
|
||||
puts "#{page.driver.network_traffic.last.method} #{page.driver.network_traffic.last.url} (#{page.driver.network_traffic.last.response_parts.first.status}) != #{path}"
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -14,7 +14,10 @@ Given /^(?:I )?(?:am logged|log) in(?: as '(.+)')?$/i do |email|
|
||||
end
|
||||
|
||||
first(selector_for('email')).set(TestState.my_account.email)
|
||||
first('#token + button[type="submit"]').click
|
||||
begin
|
||||
first('.flex-form button').click
|
||||
rescue Capybara::Poltergeist::TimeoutError
|
||||
end
|
||||
|
||||
begin
|
||||
expect(page).to have_link TestState.my_account.name
|
||||
|
||||
Reference in New Issue
Block a user