From fcd5b38a288be1e77ce36c2004887f0ec08fdb1a Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 1 Feb 2023 14:37:50 +0100 Subject: [PATCH] fix spec broken because new line in html table --- .../instructeurs/procedure_sort_spec.rb | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/system/instructeurs/procedure_sort_spec.rb b/spec/system/instructeurs/procedure_sort_spec.rb index 14c018f78..f4f1eb9df 100644 --- a/spec/system/instructeurs/procedure_sort_spec.rb +++ b/spec/system/instructeurs/procedure_sort_spec.rb @@ -16,19 +16,19 @@ describe "procedure sort", js: true do scenario "should be able to sort with header" do # sorted by notifications (updated_at desc) by default, filtered by followed - expect(all(".dossiers-table tbody tr").count).to eq(2) - expect(find(".dossiers-table tbody tr:nth-child(1) .number-col a").text).to eq(followed_dossier.id.to_s) - expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier_2.id.to_s) + expect(all(".dossiers-table tbody tr").count).to eq(3) + expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(3) .number-col a").text).to eq(followed_dossier_2.id.to_s) find("thead .number-col a").click # sort by id asc - expect(find(".dossiers-table tbody tr:nth-child(1) .number-col a").text).to eq(followed_dossier.id.to_s) - expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier_2.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(3) .number-col a").text).to eq(followed_dossier_2.id.to_s) find("thead .number-col a").click # reverse order - sort by id desc - expect(find(".dossiers-table tbody tr:nth-child(1) .number-col a").text).to eq(followed_dossier_2.id.to_s) - expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier_2.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(3) .number-col a").text).to eq(followed_dossier.id.to_s) end scenario "should be able to sort with direct link to notification sort" do @@ -39,14 +39,14 @@ describe "procedure sort", js: true do find("label", text: "Remonter les dossiers avec une notification").click # reverse order - sort by updated_at asc expect(page).not_to have_checked_field("Remonter les dossiers avec une notification") - expect(find(".dossiers-table tbody tr:nth-child(1) .number-col a").text).to eq(followed_dossier_2.id.to_s) - expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier_2.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(3) .number-col a").text).to eq(followed_dossier.id.to_s) find("label", text: "Remonter les dossiers avec une notification").click # set order back - sort by updated_at desc expect(page).to have_checked_field("Remonter les dossiers avec une notification") - expect(find(".dossiers-table tbody tr:nth-child(1) .number-col a").text).to eq(followed_dossier.id.to_s) - expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier_2.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(3) .number-col a").text).to eq(followed_dossier_2.id.to_s) end scenario "should be able to sort back by notification filter after any other sort" do @@ -57,7 +57,7 @@ describe "procedure sort", js: true do find("label", text: "Remonter les dossiers avec une notification").click # sort by updated_at desc expect(page).to have_checked_field("Remonter les dossiers avec une notification") - expect(find(".dossiers-table tbody tr:nth-child(1) .number-col a").text).to eq(followed_dossier.id.to_s) - expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier_2.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(2) .number-col a").text).to eq(followed_dossier.id.to_s) + expect(find(".dossiers-table tbody tr:nth-child(3) .number-col a").text).to eq(followed_dossier_2.id.to_s) end end