diff --git a/spec/features/admin/edit_elements_feature_spec.rb b/spec/features/admin/edit_elements_feature_spec.rb index e4c6028c35..6006048871 100644 --- a/spec/features/admin/edit_elements_feature_spec.rb +++ b/spec/features/admin/edit_elements_feature_spec.rb @@ -62,13 +62,17 @@ end end - scenario "the add button opens add element form with the clipboard tab" do + scenario "the add button opens add element form with the clipboard tab", :js do visit alchemy.admin_elements_path(page_version_id: element.page_version_id) button = page.find(".add-nestable-element-button") expect(button).to have_content "Add Slide" button.click - expect(page).to have_select("Element") - expect(page).to have_css("[panel='paste_element_tab']") + + expect(page).to have_css(".alchemy-dialog") + within ".alchemy-dialog" do + expect(page).to have_select("Element") + expect(page).to have_css("[panel='paste_element_tab']") + end end end @@ -92,8 +96,11 @@ scenario "the add button now opens add element form with the clipboard tab" do find("a.add-nestable-element-button").click - expect(page).to have_select("Element") - expect(page).to have_css("[panel='paste_element_tab']") + expect(page).to have_css(".alchemy-dialog") + within ".alchemy-dialog" do + expect(page).to have_select("Element") + expect(page).to have_css("[panel='paste_element_tab']") + end end end end @@ -112,8 +119,9 @@ button = page.find(".add-nestable-element-button") expect(button).to have_content "New element" button.click - expect(page).to have_select("Element") + expect(page).to have_css(".alchemy-dialog") within ".alchemy-dialog" do + expect(page).to have_select("Element") select2("Text", from: "Element") click_button("Add") end