Skip to content

Commit

Permalink
Improve integration test reliability (#3944)
Browse files Browse the repository at this point in the history
  • Loading branch information
martyn-w authored Apr 11, 2024
1 parent ca0ebbb commit 3131b89
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/integration/mailing_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ def sign_up(first_name, last_name, email)
def sign_up_if_not_qualified(first_name, last_name, email)
submit_personal_details(first_name, last_name, email)

if page.body.include?("There is a problem") && page.body.include?("Enter your last name")
# very rarely, for reasons unknown, the test returns an error indicating the last_name is empty. In this case, try and fill it in again.
Rails.logger.warn("Integration test failed to set last_name correctly; re-setting with: #{last_name}")
fill_in "Last name", with: last_name
click_on "Next step"
end

expect(page).to have_text "Are you already qualified to teach?"
find("label", text: "No").click
click_on "Next step"
Expand Down

0 comments on commit 3131b89

Please sign in to comment.