Implemented retries for failed scenarios

This commit is contained in:
Godwin
2017-06-05 17:21:41 -07:00
parent 71745f9deb
commit f1c5aca087
5 changed files with 31 additions and 56 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ Feature: Conference Schedule
When I click on 'Reaching New Immigrants' link
Then I should see 'The Shop'
And see '1027 Flatbush Ave'
And see 'More info'
And see 'Details'
And see 'Close'
When I click on the 'Close' button
+11 -9
View File
@@ -6,18 +6,20 @@ Then /^(.*) should get (.+) '(.+)' emails?$/i do |to, amount, subject|
address = email_address(to)
attempt_to do
emails = emails_to(address, subject)
attempt_to do
emails = emails_to(address, subject)
unless emails.length == (str_to_num(amount))
email_log = []
ActionMailer::Base.deliveries.each do |mail|
email_log << "\t#{mail.to.join(', ')}: #{mail.subject}"
unless emails.length == (str_to_num(amount))
email_log = []
ActionMailer::Base.deliveries.each do |mail|
email_log << "\t#{mail.to.join(', ')}: #{mail.subject}"
end
total_emails = ActionMailer::Base.deliveries.length
fail "Failed to find #{amount} email#{amount == 1 ? '' : 's'} to #{address} with #{subject} in the subject amoung #{total_emails} total email#{total_emails == 1 ? '' : 's'}:\n#{email_log.join("\n")}"
end
total_emails = ActionMailer::Base.deliveries.length
fail "Failed to find #{amount} email#{amount == 1 ? '' : 's'} to #{address} with #{subject} in the subject amoung #{total_emails} total email#{total_emails == 1 ? '' : 's'}:\n#{email_log.join("\n")}"
end
TestState.last_email = emails.first
TestState.last_email = emails.first
end
end
end
@@ -35,7 +35,6 @@ Then /^(?:I )?click (?:on )?(?:the )?(a )?'(.+?)'( button| link)?(?: beside '(.+
end
element.click
rescue Exception => e
puts text
raise e
end
sleep(1) # let any aimations or page loads to complete