Simplify tests switching to a new window
This commit is contained in:
@@ -256,11 +256,7 @@ describe "Polls" do
|
|||||||
|
|
||||||
visit proposal_dashboard_polls_path(proposal)
|
visit proposal_dashboard_polls_path(proposal)
|
||||||
|
|
||||||
within "div#poll_#{poll.id}" do
|
within_window(window_opened_by { click_link "View results" }) do
|
||||||
click_link "View results"
|
|
||||||
end
|
|
||||||
|
|
||||||
page.driver.browser.switch_to.window page.driver.browser.window_handles.last do
|
|
||||||
expect(page).to have_current_path(results_proposal_poll_path(proposal, poll))
|
expect(page).to have_current_path(results_proposal_poll_path(proposal, poll))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,9 +31,7 @@ describe "Poster" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "PDF contains the proposal details" do
|
scenario "PDF contains the proposal details" do
|
||||||
click_link "Download"
|
within_window(window_opened_by { click_link "Download" }) do
|
||||||
|
|
||||||
page.driver.browser.switch_to.window page.driver.browser.window_handles.last do
|
|
||||||
expect(page).to have_content(proposal.title)
|
expect(page).to have_content(proposal.title)
|
||||||
expect(page).to have_content(proposal.code)
|
expect(page).to have_content(proposal.code)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user