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.
This commit is contained in:
Javi Martín
2021-04-01 17:55:31 +02:00
parent 424fe7f5d2
commit 92ddcb7aef
153 changed files with 859 additions and 862 deletions

View File

@@ -23,7 +23,7 @@ describe "Proposal's dashboard" do
expect(page).not_to have_link("Publish proposal")
end
scenario "Dashboard progress shows current goal", js: true do
scenario "Dashboard progress shows current goal" do
goal = create(:dashboard_action, :resource, :active,
required_supports: proposal.votes_for.size + 1_000)
future_goal = create(:dashboard_action, :resource, :active,
@@ -71,7 +71,7 @@ describe "Proposal's dashboard" do
expect(page).to have_button("Show description")
end
scenario "Dashboard progress do not display from the fourth proposed actions", js: true do
scenario "Dashboard progress do not display from the fourth proposed actions" do
create_list(:dashboard_action, 4, :proposed_action, :active)
action_5 = create(:dashboard_action, :proposed_action, :active)
@@ -81,7 +81,7 @@ describe "Proposal's dashboard" do
end
scenario "Dashboard progress display link to new page for proposed actions when
there are more than four proposed actions", js: true do
there are more than four proposed actions" do
create_list(:dashboard_action, 4, :proposed_action, :active)
create(:dashboard_action, :proposed_action, :active)
@@ -91,7 +91,7 @@ describe "Proposal's dashboard" do
end
scenario "Dashboard progress do not display link to new page for proposed actions
when there are less than five proposed actions", js: true do
when there are less than five proposed actions" do
create_list(:dashboard_action, 4, :proposed_action, :active)
visit progress_proposal_dashboard_path(proposal)
@@ -262,7 +262,7 @@ describe "Proposal's dashboard" do
expect(page).to have_link(feature.title)
end
scenario "Request resource with admin request", js: true do
scenario "Request resource with admin request" do
feature = create(:dashboard_action, :resource, :active, :admin_request)
visit proposal_dashboard_path(proposal)
@@ -273,7 +273,7 @@ describe "Proposal's dashboard" do
"as soon as possible to inform you about it.")
end
scenario "Request already requested resource with admin request", js: true do
scenario "Request already requested resource with admin request" do
feature = create(:dashboard_action, :resource, :active, :admin_request)
visit proposal_dashboard_path(proposal)
@@ -298,7 +298,7 @@ describe "Proposal's dashboard" do
"as soon as possible to inform you about it.")
end
scenario "Resource without admin request do not have a request link", js: true do
scenario "Resource without admin request do not have a request link" do
feature = create(:dashboard_action, :resource, :active)
visit proposal_dashboard_path(proposal)
@@ -323,9 +323,10 @@ describe "Proposal's dashboard" do
expect(page).to have_content("This proposal is archived and can not request resources.")
end
scenario "Dashboard has a link to dashboard community", js: true do
scenario "Dashboard has a link to dashboard community" do
visit proposal_dashboard_path(proposal)
expect(page).to have_link("Community")
click_link "Community"
expect(page).to have_content("Participants")
@@ -334,7 +335,7 @@ describe "Proposal's dashboard" do
expect(page).to have_link("Access the community")
end
scenario "Dashboard has a link to recommended_actions if there is any", js: true do
scenario "Dashboard has a link to recommended_actions if there is any" do
expect(page).not_to have_link("Recommended actions")
create_list(:dashboard_action, 3, :proposed_action, :active)
@@ -379,7 +380,7 @@ describe "Proposal's dashboard" do
anchor: "tab-notifications"))
end
scenario "Dashboard has a related content section", :js do
scenario "Dashboard has a related content section" do
related_debate = create(:debate)
related_proposal = create(:proposal)
@@ -407,7 +408,7 @@ describe "Proposal's dashboard" do
end
scenario "On recommended actions section display from the fourth proposed actions
when click see_proposed_actions_link", js: true do
when click see_proposed_actions_link" do
create_list(:dashboard_action, 4, :proposed_action, :active)
action_5 = create(:dashboard_action, :proposed_action, :active)
@@ -421,7 +422,7 @@ describe "Proposal's dashboard" do
expect(page).not_to have_content(action_5.title)
end
scenario "On recommended actions section display four proposed actions", js: true do
scenario "On recommended actions section display four proposed actions" do
create_list(:dashboard_action, 4, :proposed_action, :active)
action_5 = create(:dashboard_action, :proposed_action, :active)
@@ -431,7 +432,7 @@ describe "Proposal's dashboard" do
end
scenario "On recommended actions section display link for toggle when there are
more than four proposed actions", js: true do
more than four proposed actions" do
create_list(:dashboard_action, 4, :proposed_action, :active)
create(:dashboard_action, :proposed_action, :active)
@@ -441,7 +442,7 @@ describe "Proposal's dashboard" do
end
scenario "On recommended actions section do not display link for toggle when
there are less than five proposed actions", js: true do
there are less than five proposed actions" do
create_list(:dashboard_action, 4, :proposed_action, :active)
visit recommended_actions_proposal_dashboard_path(proposal.to_param)