From 652f85cba3447c2ef4c1a70dfd7b3f7e5ae63b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= Date: Tue, 16 Nov 2021 16:11:11 +0100 Subject: [PATCH] Update spec expectations to avoid flake specs The last expectation we were using in this test is satisfied before going back to the admin stats page, as the campaing2 name is not present before clicking the `Go back` link. Because of this, the test could end while the request thrown by the `Go back` link is not completed yet, which can collide with the following test and cause a flake spec. --- spec/system/campaigns_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/system/campaigns_spec.rb b/spec/system/campaigns_spec.rb index 60befbc3b..744fa941e 100644 --- a/spec/system/campaigns_spec.rb +++ b/spec/system/campaigns_spec.rb @@ -24,12 +24,12 @@ describe "Email campaigns", :admin do visit root_path(track_id: Campaign.last.id + 1) visit admin_stats_path + + expect(page).to have_content campaign1.name + expect(page).not_to have_content campaign2.name + click_link campaign1.name expect(page).to have_content "#{campaign1.name} (1)" - - click_link "Go back" - - expect(page).not_to have_content campaign2.name.to_s end end