From cfef5aa41a39cd50292a7175de3ae0837676fb53 Mon Sep 17 00:00:00 2001 From: Trey Pendragon Date: Mon, 25 Jul 2022 13:16:41 -0700 Subject: [PATCH] Test multiple field entry/saving. Co-authored-by: Anna Headley --- spec/features/simple_resource_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spec/features/simple_resource_spec.rb b/spec/features/simple_resource_spec.rb index 476789ac96..9ca94e9801 100644 --- a/spec/features/simple_resource_spec.rb +++ b/spec/features/simple_resource_spec.rb @@ -29,7 +29,7 @@ expect(page).to have_css("title", text: "#{simple_resource.title.first} - Figgy", visible: false) end - scenario "creating a new resource" do + scenario "creating a new resource", js: true do visit new_simple_scanned_resources_path expect(page).to have_field "Title" @@ -66,11 +66,22 @@ # expect(page).to have_field "Subject" expect(page.find("#scanned_resource_change_set", visible: false).value).to eq "simple" + click_button "Add another Title" + expect(page).to have_content "cannot add another" fill_in "Title", with: "Test Title" + click_button "Add another Title" + input = find_all("*[name='scanned_resource[title][]']").last + input.fill_in(with: "Second Title") + click_button "Add another Title" + input = find_all("*[name='scanned_resource[title][]']").last + input.fill_in(with: "Third Title") + find_all("button.btn-link.remove").last.click # fill_in "Contributor", with: "Test Contributor" click_button "Save" expect(page).to have_content "Test Title" + expect(page).to have_content "Second Title" + expect(page).not_to have_content "Third Title" end scenario "creating an invalid resource" do