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

Wait for travel advice to be published before asserting #59

Merged
merged 1 commit into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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