Fixed tests for PhantomJS 2.5
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user