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

@@ -113,7 +113,7 @@ describe "Admin Notifications", :admin do
end
context "Destroy" do
scenario "A draft notification can be destroyed", :js do
scenario "A draft notification can be destroyed" do
notification = create(:admin_notification)
visit admin_admin_notifications_path
@@ -180,8 +180,8 @@ describe "Admin Notifications", :admin do
expect(page).to have_content error_message
end
context "Send notification", :js do
scenario "A draft Admin notification can be sent", :js do
context "Send notification" do
scenario "A draft Admin notification can be sent" do
2.times { create(:user) }
notification = create(:admin_notification, segment_recipient: :all_users)
@@ -196,7 +196,7 @@ describe "Admin Notifications", :admin do
end
end
scenario "A sent Admin notification can not be sent", :js do
scenario "A sent Admin notification can not be sent" do
notification = create(:admin_notification, :sent)
visit admin_admin_notification_path(notification)
@@ -204,7 +204,7 @@ describe "Admin Notifications", :admin do
expect(page).not_to have_link("Send")
end
scenario "Admin notification with invalid segment recipient cannot be sent", :js do
scenario "Admin notification with invalid segment recipient cannot be sent" do
invalid_notification = create(:admin_notification)
invalid_notification.update_column(:segment_recipient, "invalid_segment")
visit admin_admin_notification_path(invalid_notification)