Use labels to find fields in dashboard actions tests

In the tests for the edit/update action, we were using field names, but
using labels is a better approach because it tests that the label is
correctly associated with the field.

We aren't changing the tests for the new/create action because we were
already using labels there.
This commit is contained in:
Javi Martín
2025-02-23 23:12:30 +01:00
parent 5b5571bb54
commit f3fcee430e

View File

@@ -73,14 +73,14 @@ describe "Admin dashboard actions", :admin do
end
scenario "Updates the action" do
fill_in "dashboard_action_title", with: "Great action!"
fill_in "Title", with: "Great action!"
click_button "Save"
expect(page).to have_content "Great action!"
end
scenario "Renders edit form in case data is invalid" do
fill_in "dashboard_action_title", with: "x"
fill_in "Title", with: "x"
click_button "Save"
expect(page).to have_content("error prevented this Dashboard/Action from being saved.")
end