Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #59 from alphagov/wait-for-publishing
Browse files Browse the repository at this point in the history
Wait for travel advice to be published before asserting
  • Loading branch information
RyanMacG authored Nov 10, 2017
2 parents dd687ee + ae7954e commit 29b9328
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions spec/support/travel_advice_publisher_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ def visit_travel_advice_publisher(path = "/")
visit(Plek.find("travel-advice-publisher") + path)
end

def reload_until_travel_advice_summary_displayed(url, summary)
reload_url_until_status_code(url, 200)
reload_url_until_match(url, :has_text?, ignore_quotes_regex(summary))
end

def self.included(base)
if SignonHelpers::use_signon?
default_permissions = %w[gds_editor]
Expand Down
3 changes: 1 addition & 2 deletions spec/travel_advice_publisher/creating_draft_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def when_i_create_a_draft_of_chad

def then_i_can_preview_it_on_draft_gov_uk
url = find_link("Preview saved version")[:href]
reload_url_until_status_code(url, 200)
reload_url_until_match(url, :has_text?, ignore_quotes_regex(summary))
reload_until_travel_advice_summary_displayed(url, summary)

@window = window_opened_by { click_link("Preview saved version") }
within_window(@window) do
Expand Down
3 changes: 1 addition & 2 deletions spec/travel_advice_publisher/creating_live_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def when_i_create_a_live_edition_of_malta

def then_i_can_view_it_on_gov_uk
url = find_link("view")[:href]
reload_url_until_status_code(url, 200)
reload_url_until_match(url, :has_text?, ignore_quotes_regex(summary))
reload_until_travel_advice_summary_displayed(url, summary)

@window = window_opened_by { click_link("view") }
within_window(@window) do
Expand Down
2 changes: 1 addition & 1 deletion spec/travel_advice_publisher/upload_attachments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def and_i_upload_files_to_it

def then_i_can_view_these_files_on_draft_gov_uk
url = find_link("Preview saved version")[:href]
reload_url_until_status_code(url, 200)
reload_until_travel_advice_summary_displayed(url, summary)

window = window_opened_by { click_link("Preview saved version") }
within_window(window) do
Expand Down

0 comments on commit 29b9328

Please sign in to comment.