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

@@ -18,7 +18,7 @@ describe "Admin administrators" do
expect(page).not_to have_content user.name
end
scenario "Create Administrator", :js do
scenario "Create Administrator" do
fill_in "search", with: user.email
click_button "Search"
@@ -29,7 +29,7 @@ describe "Admin administrators" do
end
end
scenario "Delete Administrator", :js do
scenario "Delete Administrator" do
within "#administrator_#{user_administrator.id}" do
accept_confirm { click_link "Delete" }
end
@@ -39,7 +39,7 @@ describe "Admin administrators" do
end
end
scenario "Delete Administrator when its the current user", :js do
scenario "Delete Administrator when its the current user" do
within "#administrator_#{admin.id}" do
accept_confirm { click_link "Delete" }
end
@@ -101,7 +101,7 @@ describe "Admin administrators" do
expect(page).not_to have_content(administrator1.email)
end
scenario "Delete after searching", :js do
scenario "Delete after searching" do
fill_in "Search user by name or email", with: administrator2.email
click_button "Search"