From 215f3e97adf3ba160e28d8097b9fa6839d9ab36e Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Thu, 8 Sep 2022 12:04:27 +0100 Subject: [PATCH] Splits tests into existing/non-existing shops Sets failing tests as pending for issues #9649 and #5467 --- spec/system/consumer/shops_spec.rb | 35 +++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/spec/system/consumer/shops_spec.rb b/spec/system/consumer/shops_spec.rb index 9379024c30..5b220e39a7 100644 --- a/spec/system/consumer/shops_spec.rb +++ b/spec/system/consumer/shops_spec.rb @@ -23,9 +23,38 @@ describe 'Shops', js: true do producer.set_producer_property 'Organic', 'NASAA 12345' end - it "searches by URL" do - visit shops_path(anchor: "/?query=xyzzy") - expect(page).to have_content "Sorry, no results found for xyzzy" + context "searching enterprises" do + context "which exist" do + it "by URL" do + visit shops_path(anchor: "/?query=Enterprise") + expect(page).to have_content "Did you mean? #{distributor.name}" + end + + it "by typing in the search field" do + visit shops_path + find('input').set("Enterprise") + expect(current_url).to have_content("/shops#/?query=Enterprise") + expect(page).to have_content "Did you mean? #{distributor.name}" + end + end + + context "which do not exist" do + it "by URL" do + pending("#9649") + visit shops_path(anchor: "/?query=xyzzy") + expect(page).not_to have_content distributor.name + expect(page).to have_content "Sorry, no results found for xyzzy. Try another search?" + end + + it "by typing in the search field" do + pending("#5467") + visit shops_path + find('input').set("xyzzy") + expect(current_url).to have_content("/shops#/?query=xyzzy") + expect(page).not_to have_content distributor.name + expect(page).to have_content "Sorry, no results found for xyzzy. Try another search?" + end + end end describe "listing shops" do