Support for phantomjs 2.5

This commit is contained in:
LinguaFrancaTranslator
2017-04-12 00:43:36 +00:00
parent f98632eb31
commit a3137b0d49
9 changed files with 545 additions and 532 deletions
+4 -1
View File
@@ -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
+14 -1
View File
@@ -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
+4 -1
View File
@@ -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