Fix errors count when user submit the form

Since https://github.com/openfoodfoundation/openfoodnetwork/pull/10317 we are displaying the error message also in the flash message. For unknown reason, build didn't fail for that PR, but, as the PR adds some error message, we need to change the spec to reflect that change.

This PR separates error in checkout page itself, and errors in flash message banner.
This commit is contained in:
Jean-Baptiste Bellet
2023-01-26 11:05:55 +01:00
parent 1ea7304549
commit 999440da0a

View File

@@ -489,7 +489,12 @@ describe "As a consumer, I want to checkout my order" do
expect(page).to have_field("Address", with: "")
expect(page).to have_field("City", with: "")
expect(page).to have_field("Postcode", with: "")
expect(page).to have_content("can't be blank", count: 3)
within "checkout" do
expect(page).to have_content("can't be blank", count: 3)
end
within ".flash[type='error']" do
expect(page).to have_content("can't be blank", count: 3)
end
end
it "fills in shipping details and redirects the user to the Payment Method step,
@@ -541,7 +546,13 @@ describe "As a consumer, I want to checkout my order" do
expect(page).to have_field("Address", with: "")
expect(page).to have_field("City", with: "")
expect(page).to have_field("Postcode", with: "")
expect(page).to have_content("can't be blank", count: 7)
within "checkout" do
expect(page).to have_content("can't be blank", count: 7)
end
within ".flash[type='error']" do
expect(page).to have_content("can't be blank", count: 13)
expect(page).to have_content("is invalid", count: 1)
end
expect(page).to have_content("Select a shipping method")
end
end