Files
grecia/spec/system/dashboard/poster_spec.rb
Javi Martín 92ddcb7aef Use JavaScript in system tests by default
JavaScript is used by about 98% of web users, so by testing without it
enabled, we're only testing that the application works for a very
reduced number of users.

We proceeded this way in the past because CONSUL started using Rails 4.2
and truncating the database between JavaScript tests with database
cleaner, which made these tests terribly slow.

When we upgraded to Rails 5.1 and introduced system tests, we started
using database transactions in JavaScript tests, making these tests much
faster. So now we can use JavaScript tests everywhere without critically
slowing down our test suite.
2021-04-07 14:41:06 +02:00

42 lines
1.0 KiB
Ruby

require "rails_helper"
describe "Poster" do
let!(:proposal) { create(:proposal, :draft) }
before do
login_as(proposal.author)
visit new_proposal_dashboard_poster_path(proposal)
end
scenario "Has a link to preview the poster" do
expect(page).to have_link("Preview")
end
scenario "Has a link to download the poster" do
expect(page).to have_link("Download")
end
scenario "Preview contains the proposal details" do
click_link "Preview"
expect(page).to have_content(proposal.title)
expect(page).to have_content(proposal.code)
end
scenario "Preview page can download the poster as well" do
click_link "Preview"
expect(page).not_to have_link("Preview")
expect(page).to have_link("Download")
end
scenario "PDF contains the proposal details" do
click_link "Download"
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.code)
end
end
end