Fixed tests for PhantomJS 2.5

This commit is contained in:
Godwin
2017-04-11 21:42:29 -07:00
parent a3137b0d49
commit 5d20630ed6
10 changed files with 1157 additions and 34 deletions
+6 -3
View File
@@ -24,7 +24,7 @@ Capybara.register_driver :bb_poltergeist do |app|
end
opts = {
timeout: 60,
timeout: 10,
window_size: [1200, 800]
}
Capybara::Poltergeist::Driver.new(app, opts)
@@ -50,9 +50,12 @@ Before do
end
After do |scenario|
sleep 1
log_result scenario
LinguaFranca.screenshot_mail
if LinguaFranca.recording?
sleep 1
LinguaFranca.screenshot_mail
end
if scenario.failed?
if @exception
+3 -4
View File
@@ -53,7 +53,7 @@ def capture_html(distance_from_root = 3)
html.gsub(/(=\"|\(['"]?)(?:#{host})?\/(assets|uploads)/, "\\1#{public_dir}\\2")
end
def attempt_to(&block)
def attempt_to(refresh_on_fail = false, &block)
begin
retries ||= 0
timeout ||= 0
@@ -61,8 +61,7 @@ def attempt_to(&block)
yield
rescue Exception => e
raise e unless (retries += 1) <= 4
# puts "Failed: #{e}"
# puts "Retry ##{retries}"
visit TestState.last_page if TestState.last_page && refresh_on_fail
sleep(timeout * timeout)
retry
end
@@ -84,7 +83,7 @@ end
def emails_to(email_address, subject = nil)
ActionMailer::Base.deliveries.select do |mail|
mail.to.include?(email_address) &&
(subject.nil? || mail.subject.downcase =~ /#{Regexp.escape(subject.downcase)}/)
(subject.nil? || mail.subject.downcase.include?(subject.downcase))
end
end
+3
View File
@@ -10,6 +10,9 @@ module NavigationHelpers
path = :view_workshop
args << TestState.last_conference.slug
args << TestState.last_workshop.id
when /^delete_workshop$/i
args << TestState.last_conference.slug
args << TestState.last_workshop.id
when /^registration$/i
path = :register
args << TestState.last_conference.slug
+1
View File
@@ -6,6 +6,7 @@ module TestState
attr_accessor :last_organization
attr_accessor :last_email
attr_accessor :it
attr_accessor :last_page
def my_account=(user)
@my_account = user