diff --git a/.rubocop.yml b/.rubocop.yml index 7d025999a..acc47b92e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -26,6 +26,9 @@ Capybara/CurrentPathExpectation: Capybara/NegationMatcher: Enabled: true +Capybara/RSpec/HaveSelector: + Enabled: true + Capybara/SpecificActions: Enabled: true diff --git a/spec/components/budgets/supports_info_component_spec.rb b/spec/components/budgets/supports_info_component_spec.rb index 1bf10f986..63b1a5115 100644 --- a/spec/components/budgets/supports_info_component_spec.rb +++ b/spec/components/budgets/supports_info_component_spec.rb @@ -10,7 +10,7 @@ describe Budgets::SupportsInfoComponent do render_inline component - expect(page).to have_selector ".supports-info" + expect(page).to have_css ".supports-info" expect(page).to have_content "It's time to support projects!" expect(page).to have_link "Keep scrolling to see all ideas" end diff --git a/spec/components/pages/help/section_component_spec.rb b/spec/components/pages/help/section_component_spec.rb index cb7aaac76..4bf8e085a 100644 --- a/spec/components/pages/help/section_component_spec.rb +++ b/spec/components/pages/help/section_component_spec.rb @@ -29,15 +29,15 @@ describe Pages::Help::SectionComponent do it "renders an image on sections with an image" do render_inline Pages::Help::SectionComponent.new("debates") - expect(page).to have_selector "img" - expect(page).to have_selector "figure" + expect(page).to have_css "img" + expect(page).to have_css "figure" end it "does not render an image tag when there is no image" do render_inline Pages::Help::SectionComponent.new("processes") - expect(page).not_to have_selector "img" - expect(page).not_to have_selector "figure" + expect(page).not_to have_css "img" + expect(page).not_to have_css "figure" end end end diff --git a/spec/components/polls/questions/answers_component_spec.rb b/spec/components/polls/questions/answers_component_spec.rb index a5460b83e..e63fa68c6 100644 --- a/spec/components/polls/questions/answers_component_spec.rb +++ b/spec/components/polls/questions/answers_component_spec.rb @@ -70,8 +70,8 @@ describe Polls::Questions::AnswersComponent do render_inline Polls::Questions::AnswersComponent.new(question) - expect(page).to have_selector "span.disabled", text: "Yes" - expect(page).to have_selector "span.disabled", text: "No" + expect(page).to have_css "span.disabled", text: "Yes" + expect(page).to have_css "span.disabled", text: "No" end it "user cannot vote when poll expired it renders disabled answers" do @@ -80,8 +80,8 @@ describe Polls::Questions::AnswersComponent do render_inline Polls::Questions::AnswersComponent.new(question) - expect(page).to have_selector "span.disabled", text: "Yes" - expect(page).to have_selector "span.disabled", text: "No" + expect(page).to have_css "span.disabled", text: "Yes" + expect(page).to have_css "span.disabled", text: "No" end describe "geozone" do @@ -95,8 +95,8 @@ describe Polls::Questions::AnswersComponent do render_inline Polls::Questions::AnswersComponent.new(question) - expect(page).to have_selector "span.disabled", text: "Yes" - expect(page).to have_selector "span.disabled", text: "No" + expect(page).to have_css "span.disabled", text: "Yes" + expect(page).to have_css "span.disabled", text: "No" end it "reading a same-geozone poll it renders buttons to vote question answers" do diff --git a/spec/components/sdg/goals/plain_tag_list_component_spec.rb b/spec/components/sdg/goals/plain_tag_list_component_spec.rb index 930192930..75e0ec1eb 100644 --- a/spec/components/sdg/goals/plain_tag_list_component_spec.rb +++ b/spec/components/sdg/goals/plain_tag_list_component_spec.rb @@ -34,7 +34,7 @@ describe SDG::Goals::PlainTagListComponent do it "renders icons for each goal" do render_inline component - expect(page).to have_selector ".sdg-goal-icon", count: 2 + expect(page).to have_css ".sdg-goal-icon", count: 2 end it "orders goals by code" do @@ -48,7 +48,7 @@ describe SDG::Goals::PlainTagListComponent do render_inline component - expect(page).to have_selector ".sdg-goal-icon" + expect(page).to have_css ".sdg-goal-icon" expect(page).to have_link "1+", title: "One more goal", href: "/debates/#{debate.to_param}" diff --git a/spec/components/sdg/goals/tag_cloud_component_spec.rb b/spec/components/sdg/goals/tag_cloud_component_spec.rb index be2d2cb1e..b8d1bd336 100644 --- a/spec/components/sdg/goals/tag_cloud_component_spec.rb +++ b/spec/components/sdg/goals/tag_cloud_component_spec.rb @@ -20,7 +20,7 @@ describe SDG::Goals::TagCloudComponent do render_inline component - expect(page).to have_selector ".sdg-goal-icon", count: 17 + expect(page).to have_css ".sdg-goal-icon", count: 17 expect(page.first("a")[:title]).to end_with "goal 1" expect(page.all("a").last[:title]).to end_with "goal 17" end diff --git a/spec/components/sdg/goals/tag_list_component_spec.rb b/spec/components/sdg/goals/tag_list_component_spec.rb index 65aec351e..ee013a40b 100644 --- a/spec/components/sdg/goals/tag_list_component_spec.rb +++ b/spec/components/sdg/goals/tag_list_component_spec.rb @@ -34,7 +34,7 @@ describe SDG::Goals::TagListComponent do it "renders links for each goal" do render_inline component - expect(page).to have_selector "a", count: 2 + expect(page).to have_css "a", count: 2 expect(page).to have_link "1. No Poverty", title: "See all Debates related to goal 1", href: "/debates?advanced_search#{CGI.escape("[goal]")}=1" @@ -54,7 +54,7 @@ describe SDG::Goals::TagListComponent do render_inline component - expect(page).to have_selector "a", count: 2 + expect(page).to have_css "a", count: 2 expect(page).to have_link "1. No Poverty" expect(page).to have_link "1+", title: "One more goal", diff --git a/spec/components/sdg/targets/plain_tag_list_component_spec.rb b/spec/components/sdg/targets/plain_tag_list_component_spec.rb index 722bfdb3f..69aec5f45 100644 --- a/spec/components/sdg/targets/plain_tag_list_component_spec.rb +++ b/spec/components/sdg/targets/plain_tag_list_component_spec.rb @@ -55,7 +55,7 @@ describe SDG::Targets::PlainTagListComponent do render_inline component expect(page).to have_css "li", text: "target 1.1" - expect(page).to have_selector "a", count: 1 + expect(page).to have_css "a", count: 1 expect(page).to have_link "2+", title: "2 more targets", href: "/debates/#{debate.to_param}" diff --git a/spec/components/sdg/targets/tag_list_component_spec.rb b/spec/components/sdg/targets/tag_list_component_spec.rb index 5ae7f7b89..0b34ed933 100644 --- a/spec/components/sdg/targets/tag_list_component_spec.rb +++ b/spec/components/sdg/targets/tag_list_component_spec.rb @@ -60,7 +60,7 @@ describe SDG::Targets::TagListComponent do render_inline component - expect(page).to have_selector "a", count: 2 + expect(page).to have_css "a", count: 2 expect(page).to have_link "target 1.1" expect(page).to have_link "2+", title: "2 more targets", diff --git a/spec/components/sdg_management/subnavigation_component_spec.rb b/spec/components/sdg_management/subnavigation_component_spec.rb index b841e779c..edb23f399 100644 --- a/spec/components/sdg_management/subnavigation_component_spec.rb +++ b/spec/components/sdg_management/subnavigation_component_spec.rb @@ -16,8 +16,8 @@ describe SDGManagement::SubnavigationComponent do it "renders tabs and links properly styled" do render_inline component - expect(page).to have_selector "a.is-active", text: "Goals" - expect(page).to have_selector "a:not(.is-active)", text: "Targets" + expect(page).to have_css "a.is-active", text: "Goals" + expect(page).to have_css "a:not(.is-active)", text: "Targets" end it "renders given block within active panel" do diff --git a/spec/components/shared/advanced_search_component_spec.rb b/spec/components/shared/advanced_search_component_spec.rb index 08523c1cf..9e24a192f 100644 --- a/spec/components/shared/advanced_search_component_spec.rb +++ b/spec/components/shared/advanced_search_component_spec.rb @@ -28,8 +28,8 @@ describe Shared::AdvancedSearchComponent do render_inline component - expect(page).not_to have_selector "#advanced_search_goal", visible: :all - expect(page).not_to have_selector "#advanced_search_target", visible: :all + expect(page).not_to have_css "#advanced_search_goal", visible: :all + expect(page).not_to have_css "#advanced_search_target", visible: :all end it "does not render when the SDG process feature is disabled" do @@ -37,15 +37,15 @@ describe Shared::AdvancedSearchComponent do render_inline component - expect(page).not_to have_selector "#advanced_search_goal", visible: :all - expect(page).not_to have_selector "#advanced_search_target", visible: :all + expect(page).not_to have_css "#advanced_search_goal", visible: :all + expect(page).not_to have_css "#advanced_search_target", visible: :all end it "renders when both features are enabled" do render_inline component - expect(page).to have_selector "#advanced_search_goal", visible: :all - expect(page).to have_selector "#advanced_search_target", visible: :all + expect(page).to have_css "#advanced_search_goal", visible: :all + expect(page).to have_css "#advanced_search_target", visible: :all end end end diff --git a/spec/components/users/public_activity_component_spec.rb b/spec/components/users/public_activity_component_spec.rb index 7f066903f..3ab092578 100644 --- a/spec/components/users/public_activity_component_spec.rb +++ b/spec/components/users/public_activity_component_spec.rb @@ -34,7 +34,7 @@ describe Users::PublicActivityComponent, controller: UsersController do with_request_url user_path(user, filter: "follows") do render_inline component - expect(page).to have_selector "li.is-active", text: "1 Following" + expect(page).to have_css "li.is-active", text: "1 Following" end end end diff --git a/spec/components/valuation/budgets/row_component_spec.rb b/spec/components/valuation/budgets/row_component_spec.rb index 212096a82..f9e77c055 100644 --- a/spec/components/valuation/budgets/row_component_spec.rb +++ b/spec/components/valuation/budgets/row_component_spec.rb @@ -14,7 +14,7 @@ describe Valuation::Budgets::RowComponent do render_inline Valuation::Budgets::RowComponent.new(budget: budget) - expect(page).to have_selector ".investments-count", text: "1" + expect(page).to have_css ".investments-count", text: "1" end it "counts investments assigned to the valuator group" do @@ -24,7 +24,7 @@ describe Valuation::Budgets::RowComponent do render_inline Valuation::Budgets::RowComponent.new(budget: budget) - expect(page).to have_selector ".investments-count", text: "1" + expect(page).to have_css ".investments-count", text: "1" end it "does not count investments with valuation finished" do @@ -36,7 +36,7 @@ describe Valuation::Budgets::RowComponent do render_inline Valuation::Budgets::RowComponent.new(budget: budget) - expect(page).to have_selector ".investments-count", text: "0" + expect(page).to have_css ".investments-count", text: "0" end it "displays zero when the budget hasn't reached the valuating phase" do @@ -45,7 +45,7 @@ describe Valuation::Budgets::RowComponent do render_inline Valuation::Budgets::RowComponent.new(budget: budget) - expect(page).to have_selector ".investments-count", text: "0" + expect(page).to have_css ".investments-count", text: "0" end it "displays zero when the valuating phase is over" do @@ -54,7 +54,7 @@ describe Valuation::Budgets::RowComponent do render_inline Valuation::Budgets::RowComponent.new(budget: budget) - expect(page).to have_selector ".investments-count", text: "0" + expect(page).to have_css ".investments-count", text: "0" end end diff --git a/spec/shared/system/documentable.rb b/spec/shared/system/documentable.rb index 6723c55a2..ad6727671 100644 --- a/spec/shared/system/documentable.rb +++ b/spec/shared/system/documentable.rb @@ -16,8 +16,8 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, within "#documents" do expect(page).to have_link text: document.title - expect(page).to have_selector "a[rel=nofollow]", text: document.title - expect(page).not_to have_selector "a[target=_blank]" + expect(page).to have_css "a[rel=nofollow]", text: document.title + expect(page).not_to have_css "a[target=_blank]" end end @@ -121,7 +121,7 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, end within "##{ActionView::RecordIdentifier.dom_id(documentable)}" do - expect(page).to have_selector "h1", text: documentable.title + expect(page).to have_css "h1", text: documentable.title end end end diff --git a/spec/shared/system/mappable.rb b/spec/shared/system/mappable.rb index 3ff5e2b0d..51a3c4305 100644 --- a/spec/shared/system/mappable.rb +++ b/spec/shared/system/mappable.rb @@ -201,8 +201,8 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name, mappable.reload expect(page).to have_css(".map-location") - expect(page).not_to have_selector(".map-location[data-marker-latitude='#{map_location.latitude}']") - expect(page).to have_selector(".map-location[data-marker-latitude='#{mappable.map_location.latitude}']") + expect(page).not_to have_css ".map-location[data-marker-latitude='#{map_location.latitude}']" + expect(page).to have_css ".map-location[data-marker-latitude='#{mappable.map_location.latitude}']" end scenario "Should edit mappable on #{mappable_factory_name} without change map" do @@ -214,8 +214,8 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name, mappable.reload expect(page).to have_css(".map-location") - expect(page).to have_selector(".map-location[data-marker-latitude='#{map_location.latitude}']") - expect(page).to have_selector(".map-location[data-marker-latitude='#{mappable.map_location.latitude}']") + expect(page).to have_css ".map-location[data-marker-latitude='#{map_location.latitude}']" + expect(page).to have_css ".map-location[data-marker-latitude='#{mappable.map_location.latitude}']" end scenario "Can not display map on #{mappable_factory_name} edit when remove map marker" do diff --git a/spec/shared/system/nested_imageable.rb b/spec/shared/system/nested_imageable.rb index f055e055c..52be887d2 100644 --- a/spec/shared/system/nested_imageable.rb +++ b/spec/shared/system/nested_imageable.rb @@ -21,7 +21,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p do_login_for user, management: management visit send(path, arguments) - expect(page).to have_selector "#new_image_link" + expect(page).to have_css "#new_image_link" end scenario "Should hide new image link after adding one image" do @@ -30,7 +30,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p click_on "Add image" - expect(page).not_to have_selector "#new_image_link" + expect(page).not_to have_css "#new_image_link" end scenario "Should update image file name after choosing any file" do @@ -40,7 +40,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p click_link "Add image" attach_file "Choose image", file_fixture("clippy.jpg") - expect(page).to have_selector ".file-name", text: "clippy.jpg" + expect(page).to have_css ".file-name", text: "clippy.jpg" end scenario "Should update image file title after choosing a file when no title is defined" do @@ -74,7 +74,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p imageable_attach_new_file(file_fixture("clippy.jpg")) - expect(page).to have_selector ".loading-bar.complete" + expect(page).to have_css ".loading-bar.complete" end scenario "Should update loading bar style after invalid file upload" do @@ -83,7 +83,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p imageable_attach_new_file(file_fixture("logo_header.png"), false) - expect(page).to have_selector ".loading-bar.errors" + expect(page).to have_css ".loading-bar.errors" end scenario "Should update image cached_attachment field after valid file upload" do @@ -147,7 +147,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p click_link "Remove image" end - expect(page).not_to have_selector("#nested-image .image-fields") + expect(page).not_to have_css "#nested-image .image-fields" end scenario "Should show successful notice when resource filled correctly without any nested images", @@ -167,7 +167,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p imageable_attach_new_file(file_fixture("clippy.jpg")) - expect(page).to have_selector ".loading-bar.complete" + expect(page).to have_css ".loading-bar.complete" click_on submit_button @@ -181,7 +181,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p imageable_attach_new_file(file_fixture("clippy.jpg")) - expect(page).to have_selector ".loading-bar.complete" + expect(page).to have_css ".loading-bar.complete" click_on submit_button @@ -189,8 +189,8 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p imageable_redirected_to_resource_show_or_navigate_to(imageable) - expect(page).to have_selector "figure img" - expect(page).to have_selector "figure figcaption" if show_caption_for?(imageable_factory_name) + expect(page).to have_css "figure img" + expect(page).to have_css "figure figcaption" if show_caption_for?(imageable_factory_name) end scenario "Different URLs for different images" do diff --git a/spec/system/account_spec.rb b/spec/system/account_spec.rb index 1e96fc6a8..6d23e854b 100644 --- a/spec/system/account_spec.rb +++ b/spec/system/account_spec.rb @@ -14,8 +14,8 @@ describe "Account" do expect(page).to have_current_path(account_path, ignore_query: true) - expect(page).to have_selector("input[value='Manuela Colau']") - expect(page).to have_selector(avatar("Manuela Colau"), count: 1) + expect(page).to have_css "input[value='Manuela Colau']" + expect(page).to have_css avatar("Manuela Colau"), count: 1 end scenario "Show organization" do @@ -23,10 +23,10 @@ describe "Account" do visit account_path - expect(page).to have_selector("input[value='Manuela Corp']") - expect(page).not_to have_selector("input[value='Manuela Colau']") + expect(page).to have_css "input[value='Manuela Corp']" + expect(page).not_to have_css "input[value='Manuela Colau']" - expect(page).to have_selector(avatar("Manuela Corp"), count: 1) + expect(page).to have_css avatar("Manuela Corp"), count: 1 end scenario "Edit" do @@ -43,7 +43,7 @@ describe "Account" do visit account_path - expect(page).to have_selector("input[value='Larry Bird']") + expect(page).to have_css "input[value='Larry Bird']" expect(find("#account_email_on_comment")).to be_checked expect(find("#account_email_on_comment_reply")).to be_checked expect(find("#account_email_digest")).not_to be_checked @@ -81,7 +81,7 @@ describe "Account" do visit account_path click_link "Change my login details" - expect(page).to have_selector("input[value='new_user_email@example.com']") + expect(page).to have_css "input[value='new_user_email@example.com']" end scenario "Edit Organization" do @@ -98,7 +98,7 @@ describe "Account" do visit account_path - expect(page).to have_selector("input[value='Google']") + expect(page).to have_css "input[value='Google']" expect(find("#account_email_on_comment")).to be_checked expect(find("#account_email_on_comment_reply")).to be_checked end diff --git a/spec/system/admin/banners_spec.rb b/spec/system/admin/banners_spec.rb index 16abaf32b..0ac2a009e 100644 --- a/spec/system/admin/banners_spec.rb +++ b/spec/system/admin/banners_spec.rb @@ -145,8 +145,8 @@ describe "Admin banners magement", :admin do page.find("body").click within(".banner") do - expect(page).to have_selector("h2", text: "Modified title") - expect(page).to have_selector("h3", text: "Edited text") + expect(page).to have_css "h2", text: "Modified title" + expect(page).to have_css "h3", text: "Edited text" end click_button "Save changes" diff --git a/spec/system/admin/budget_headings_spec.rb b/spec/system/admin/budget_headings_spec.rb index f6076f574..07763a208 100644 --- a/spec/system/admin/budget_headings_spec.rb +++ b/spec/system/admin/budget_headings_spec.rb @@ -37,7 +37,7 @@ describe "Admin budget headings", :admin do within "section", text: "Heading groups" do within "tbody" do - expect(page).to have_selector "tr", count: 3 + expect(page).to have_css "tr", count: 3 within("tr", text: "Laptops") { expect(page).to have_content "€1,000" } within("tr", text: "Tablets") { expect(page).to have_content "€2,000" } diff --git a/spec/system/admin/budgets_spec.rb b/spec/system/admin/budgets_spec.rb index e1e2a966b..06e8610b2 100644 --- a/spec/system/admin/budgets_spec.rb +++ b/spec/system/admin/budgets_spec.rb @@ -101,7 +101,7 @@ describe "Admin budgets", :admin do click_link "Create multiple headings budget" expect(page).to have_select("Final voting style", selected: "Knapsack") - expect(page).not_to have_selector("#budget_hide_money") + expect(page).not_to have_css "#budget_hide_money" fill_in "Name", with: "Budget hide money" select "Approval", from: "Final voting style" diff --git a/spec/system/admin/legislation/processes_spec.rb b/spec/system/admin/legislation/processes_spec.rb index f3b969e57..5c52b871a 100644 --- a/spec/system/admin/legislation/processes_spec.rb +++ b/spec/system/admin/legislation/processes_spec.rb @@ -214,7 +214,7 @@ describe "Admin collaborative legislation", :admin do within("tr", text: "An example legislation process") { click_link "Edit" } - expect(page).to have_selector("h2", text: "An example legislation process") + expect(page).to have_css "h2", text: "An example legislation process" expect(find("#legislation_process_debate_phase_enabled")).to be_checked expect(find("#legislation_process_published")).to be_checked diff --git a/spec/system/admin/local_census_records/imports_spec.rb b/spec/system/admin/local_census_records/imports_spec.rb index a5d39d4dd..751e958a3 100644 --- a/spec/system/admin/local_census_records/imports_spec.rb +++ b/spec/system/admin/local_census_records/imports_spec.rb @@ -52,7 +52,7 @@ describe "Imports", :admin do end expect(page).to have_content "Created records (4)" - expect(page).to have_selector("#created-local-census-records tbody tr", count: 4) + expect(page).to have_css "#created-local-census-records tbody tr", count: 4 end scenario "Should show invalid local census records at errored group" do @@ -64,7 +64,7 @@ describe "Imports", :admin do end expect(page).to have_content "Errored rows (5)" - expect(page).to have_selector("#invalid-local-census-records tbody tr", count: 5) + expect(page).to have_css "#invalid-local-census-records tbody tr", count: 5 end scenario "Should show error messages inside cells at errored group" do diff --git a/spec/system/admin/poll/booth_assigments_spec.rb b/spec/system/admin/poll/booth_assigments_spec.rb index 3ca2df05d..59edff9d6 100644 --- a/spec/system/admin/poll/booth_assigments_spec.rb +++ b/spec/system/admin/poll/booth_assigments_spec.rb @@ -222,10 +222,10 @@ describe "Admin booths assignments", :admin do expect(page).to have_content "10" end - expect(page).not_to have_selector "#total_system" + expect(page).not_to have_css "#total_system" end - expect(page).not_to have_selector "#recounts_list" + expect(page).not_to have_css "#recounts_list" end scenario "Results for a booth assignment" do diff --git a/spec/system/admin/poll/polls_spec.rb b/spec/system/admin/poll/polls_spec.rb index 88aac7ae3..2b52e2182 100644 --- a/spec/system/admin/poll/polls_spec.rb +++ b/spec/system/admin/poll/polls_spec.rb @@ -327,11 +327,11 @@ describe "Admin polls", :admin do expect(page).to have_content("10") end - expect(page).not_to have_selector "#total_system" + expect(page).not_to have_css "#total_system" end - expect(page).to have_selector "#poll_booth_assignment_#{booth_assignment.id}_recounts" - expect(page).not_to have_selector "#poll_booth_assignment_#{booth_assignment.id}_system" + expect(page).to have_css "#poll_booth_assignment_#{booth_assignment.id}_recounts" + expect(page).not_to have_css "#poll_booth_assignment_#{booth_assignment.id}_system" end end end diff --git a/spec/system/admin/poll/questions_spec.rb b/spec/system/admin/poll/questions_spec.rb index b03f63d45..b71f92db5 100644 --- a/spec/system/admin/poll/questions_spec.rb +++ b/spec/system/admin/poll/questions_spec.rb @@ -51,8 +51,8 @@ describe "Admin poll questions", :admin do click_link "Create question" expect(page).to have_content("Create question to poll Movies") - expect(page).to have_selector("input[id='poll_question_poll_id'][value='#{poll.id}']", - visible: :hidden) + expect(page).to have_css "input[id='poll_question_poll_id'][value='#{poll.id}']", + visible: :hidden fill_in "Question", with: "Star Wars: Episode IV - A New Hope" click_button "Save" diff --git a/spec/system/admin/site_customization/documents_spec.rb b/spec/system/admin/site_customization/documents_spec.rb index ae65fe484..76fff934b 100644 --- a/spec/system/admin/site_customization/documents_spec.rb +++ b/spec/system/admin/site_customization/documents_spec.rb @@ -39,7 +39,7 @@ describe "Documents", :admin do visit admin_site_customization_documents_path - expect(page).to have_selector("#documents .document-row", count: per_page) + expect(page).to have_css "#documents .document-row", count: per_page within("ul.pagination") do expect(page).to have_content("1") @@ -48,7 +48,7 @@ describe "Documents", :admin do click_link "Next", exact: false end - expect(page).to have_selector("#documents .document-row", count: 2) + expect(page).to have_css "#documents .document-row", count: 2 end scenario "Create" do diff --git a/spec/system/admin/site_customization/pages_spec.rb b/spec/system/admin/site_customization/pages_spec.rb index 50d5588e5..15c029389 100644 --- a/spec/system/admin/site_customization/pages_spec.rb +++ b/spec/system/admin/site_customization/pages_spec.rb @@ -69,8 +69,8 @@ describe "Admin custom pages", :admin do within("tr", text: "An example custom page") { click_link "Edit" } - expect(page).to have_selector("h2", text: "An example custom page") - expect(page).to have_selector("input[value='custom-example-page']") + expect(page).to have_css "h2", text: "An example custom page" + expect(page).to have_css "input[value='custom-example-page']" fill_in "Title", with: "Another example custom page" fill_in "site_customization_page_slug", with: "another-custom-example-page" diff --git a/spec/system/admin/widgets/cards_spec.rb b/spec/system/admin/widgets/cards_spec.rb index 319ab3770..881d7e0ac 100644 --- a/spec/system/admin/widgets/cards_spec.rb +++ b/spec/system/admin/widgets/cards_spec.rb @@ -199,11 +199,11 @@ describe "Cards", :admin do visit custom_page.url within("#widget_card_#{card_1.id}") do - expect(page).to have_selector("span", text: "MY LABEL") + expect(page).to have_css "span", text: "MY LABEL" end within("#widget_card_#{card_2.id}") do - expect(page).not_to have_selector("span") + expect(page).not_to have_css "span" end end diff --git a/spec/system/advanced_search_spec.rb b/spec/system/advanced_search_spec.rb index 0adf6ebba..97b378af9 100644 --- a/spec/system/advanced_search_spec.rb +++ b/spec/system/advanced_search_spec.rb @@ -235,7 +235,7 @@ describe "Advanced search" do click_button "Filter" within ".advanced-search-form" do - expect(page).to have_selector("input[name='search'][value='Schwifty']") + expect(page).to have_css "input[name='search'][value='Schwifty']" expect(page).to have_select("By SDG", selected: "7. Affordable and Clean Energy") expect(page).to have_select("advanced_search[date_min]", selected: "Last 24 hours") end @@ -255,10 +255,10 @@ describe "Advanced search" do within ".advanced-search-form" do expect(page).to have_select "advanced_search[date_min]", selected: "Customized" - expect(page).to have_selector "input[name='advanced_search[date_min]']" \ - "[value*='#{7.days.ago.strftime("%d/%m/%Y")}']" - expect(page).to have_selector "input[name='advanced_search[date_max]']" \ - "[value*='#{1.day.ago.strftime("%d/%m/%Y")}']" + expect(page).to have_css "input[name='advanced_search[date_min]']" \ + "[value*='#{7.days.ago.strftime("%d/%m/%Y")}']" + expect(page).to have_css "input[name='advanced_search[date_max]']" \ + "[value*='#{1.day.ago.strftime("%d/%m/%Y")}']" end end end diff --git a/spec/system/budgets/investments_spec.rb b/spec/system/budgets/investments_spec.rb index f0b42694a..f405847a5 100644 --- a/spec/system/budgets/investments_spec.rb +++ b/spec/system/budgets/investments_spec.rb @@ -58,7 +58,7 @@ describe "Budget Investments" do visit budget_path(budget) click_link "See all investments" - expect(page).to have_selector("#budget-investments .budget-investment", count: 3) + expect(page).to have_css "#budget-investments .budget-investment", count: 3 investments.each do |investment| within("#budget-investments") do expect(page).to have_content investment.title @@ -424,7 +424,7 @@ describe "Budget Investments" do visit budget_investments_path(budget, heading_id: heading.id) click_link "highest rated" - expect(page).to have_selector("a.is-active", text: "highest rated") + expect(page).to have_css "a.is-active", text: "highest rated" within "#budget-investments" do expect(best_proposal.title).to appear_before(medium_proposal.title) @@ -950,7 +950,7 @@ describe "Budget Investments" do visit budget_investment_path(budget, id: investment.id) - expect(page).not_to have_selector ".js-follow" + expect(page).not_to have_css ".js-follow" end scenario "Show back link contains heading id" do @@ -1414,7 +1414,7 @@ describe "Budget Investments" do visit budget_investments_path(budget, heading_id: heading.id) click_link "by price" - expect(page).to have_selector("a.is-active", text: "by price") + expect(page).to have_css "a.is-active", text: "by price" within "#budget-investments" do expect(high_investment.title).to appear_before(mid_investment.title) @@ -1448,9 +1448,9 @@ describe "Budget Investments" do login_as(user) visit budget_investment_path(budget, investment2) - expect(page).to have_selector(".participation-not-allowed", - text: "You have already voted a different heading: Heading 1", - visible: :hidden) + expect(page).to have_css ".participation-not-allowed", + text: "You have already voted a different heading: Heading 1", + visible: :hidden end scenario "Sidebar in show should display vote text" do diff --git a/spec/system/budgets/results_spec.rb b/spec/system/budgets/results_spec.rb index 777eeb74a..99bd2e4d1 100644 --- a/spec/system/budgets/results_spec.rb +++ b/spec/system/budgets/results_spec.rb @@ -50,7 +50,7 @@ describe "Results" do visit budget_path(budget) click_link "See results" - expect(page).to have_selector("a.is-active", text: heading.name) + expect(page).to have_css "a.is-active", text: heading.name within("#budget-investments-compatible") do expect(page).to have_content "First selected" @@ -110,7 +110,7 @@ describe "Results" do scenario "Loads budget and heading by slug" do visit budget_results_path(budget.slug, heading_id: heading.slug) - expect(page).to have_selector("a.is-active", text: heading.name) + expect(page).to have_css "a.is-active", text: heading.name within("#budget-investments-compatible") do expect(page).to have_content "First selected" diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index 34489bc3a..2168faf04 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -40,7 +40,7 @@ describe "Commenting Budget::Investments" do href: budget_investment_path(investment.budget, investment) within ".comment", text: "Parent" do - expect(page).to have_selector(".comment", count: 2) + expect(page).to have_css ".comment", count: 2 end end @@ -261,7 +261,7 @@ describe "Commenting Budget::Investments" do expect(page).to have_content "It will be done next week." end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "Reply update parent comment responses count" do @@ -377,7 +377,7 @@ describe "Commenting Budget::Investments" do expect(page).to have_css "img.moderator-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as an administrator" do @@ -476,7 +476,7 @@ describe "Commenting Budget::Investments" do expect(page).to have_css "img.admin-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" expect(page).to have_css "div.is-admin" end diff --git a/spec/system/comments/budget_investments_valuation_spec.rb b/spec/system/comments/budget_investments_valuation_spec.rb index ef90d67c9..baecf4433 100644 --- a/spec/system/comments/budget_investments_valuation_spec.rb +++ b/spec/system/comments/budget_investments_valuation_spec.rb @@ -211,7 +211,7 @@ describe "Internal valuation comments on Budget::Investments" do expect(page).to have_content "It will be done next week." end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" visit budget_investment_path(investment.budget, investment) expect(page).not_to have_content("It will be done next week.") @@ -329,7 +329,7 @@ describe "Internal valuation comments on Budget::Investments" do expect(page).to have_css "img.admin-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end end diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb index 5a0faf890..4b2969658 100644 --- a/spec/system/comments/debates_spec.rb +++ b/spec/system/comments/debates_spec.rb @@ -36,7 +36,7 @@ describe "Commenting debates" do expect(page).to have_link "Go back to #{debate.title}", href: debate_path(debate) within ".comment", text: "Parent" do - expect(page).to have_selector(".comment", count: 2) + expect(page).to have_css ".comment", count: 2 end end @@ -313,7 +313,7 @@ describe "Commenting debates" do expect(page).to have_content "It will be done next week." end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "Reply to reply" do @@ -477,7 +477,7 @@ describe "Commenting debates" do expect(page).to have_css "img.moderator-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as an administrator" do @@ -533,7 +533,7 @@ describe "Commenting debates" do expect(page).to have_css "img.admin-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as a moderator", :admin do diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb index 5a7c88d54..0cbfe0997 100644 --- a/spec/system/comments/legislation_annotations_spec.rb +++ b/spec/system/comments/legislation_annotations_spec.rb @@ -37,7 +37,7 @@ describe "Commenting legislation questions" do expect(page).to have_link "Go back to #{annotation.title}", href: href within ".comment", text: "Parent" do - expect(page).to have_selector(".comment", count: 2) + expect(page).to have_css ".comment", count: 2 end end @@ -275,7 +275,7 @@ describe "Commenting legislation questions" do expect(page).to have_content "It will be done next week." end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "Reply update parent comment responses count" do @@ -412,7 +412,7 @@ describe "Commenting legislation questions" do expect(page).to have_css "img.moderator-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as an administrator" do @@ -469,7 +469,7 @@ describe "Commenting legislation questions" do expect(page).to have_css "img.admin-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as a moderator", :admin do diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb index 627e7ed86..6412396fe 100644 --- a/spec/system/comments/legislation_questions_spec.rb +++ b/spec/system/comments/legislation_questions_spec.rb @@ -41,7 +41,7 @@ describe "Commenting legislation questions" do expect(page).to have_link "Go back to #{question.title}", href: href within ".comment", text: "Parent" do - expect(page).to have_selector(".comment", count: 2) + expect(page).to have_css ".comment", count: 2 end end @@ -268,7 +268,7 @@ describe "Commenting legislation questions" do expect(page).to have_content "It will be done next week." end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "Reply update parent comment responses count" do @@ -397,7 +397,7 @@ describe "Commenting legislation questions" do expect(page).to have_css "img.moderator-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as an administrator" do @@ -453,7 +453,7 @@ describe "Commenting legislation questions" do expect(page).to have_css "img.admin-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as a moderator", :admin do diff --git a/spec/system/comments/polls_spec.rb b/spec/system/comments/polls_spec.rb index 94669c512..94568a747 100644 --- a/spec/system/comments/polls_spec.rb +++ b/spec/system/comments/polls_spec.rb @@ -242,7 +242,7 @@ describe "Commenting polls" do expect(page).to have_content "It will be done next week." end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "Reply update parent comment responses count" do @@ -358,7 +358,7 @@ describe "Commenting polls" do expect(page).to have_css "img.moderator-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as an administrator" do @@ -414,7 +414,7 @@ describe "Commenting polls" do expect(page).to have_css "img.admin-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as a moderator", :admin do diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb index 269b1d885..505743a60 100644 --- a/spec/system/comments/proposals_spec.rb +++ b/spec/system/comments/proposals_spec.rb @@ -35,7 +35,7 @@ describe "Commenting proposals" do expect(page).to have_link "Go back to #{proposal.title}", href: proposal_path(proposal) within ".comment", text: "Parent" do - expect(page).to have_selector(".comment", count: 2) + expect(page).to have_css ".comment", count: 2 end end @@ -247,7 +247,7 @@ describe "Commenting proposals" do expect(page).to have_content "It will be done next week." end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "Reply update parent comment responses count" do @@ -363,7 +363,7 @@ describe "Commenting proposals" do expect(page).to have_css "img.moderator-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as an administrator" do @@ -419,7 +419,7 @@ describe "Commenting proposals" do expect(page).to have_css "img.admin-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as a moderator", :admin do diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb index 022c6bae2..b8b6852b7 100644 --- a/spec/system/comments/topics_spec.rb +++ b/spec/system/comments/topics_spec.rb @@ -270,7 +270,7 @@ describe "Commenting topics from proposals" do expect(page).to have_content "It will be done next week." end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "Reply update parent comment responses count" do @@ -400,7 +400,7 @@ describe "Commenting topics from proposals" do expect(page).to have_css "img.moderator-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as an administrator" do @@ -462,7 +462,7 @@ describe "Commenting topics from proposals" do expect(page).to have_css "img.admin-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as a moderator", :admin do @@ -819,7 +819,7 @@ describe "Commenting topics from budget investments" do expect(page).to have_content "It will be done next week." end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "Errors on reply" do @@ -913,7 +913,7 @@ describe "Commenting topics from budget investments" do expect(page).to have_css "img.moderator-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as an administrator" do @@ -975,7 +975,7 @@ describe "Commenting topics from budget investments" do expect(page).to have_css "img.admin-avatar" end - expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}") + expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}" end scenario "can not comment as a moderator", :admin do diff --git a/spec/system/dashboard/dashboard_spec.rb b/spec/system/dashboard/dashboard_spec.rb index bcd3ea8a1..0a9195c4a 100644 --- a/spec/system/dashboard/dashboard_spec.rb +++ b/spec/system/dashboard/dashboard_spec.rb @@ -67,7 +67,7 @@ describe "Proposal's dashboard" do expect(page).to have_content(action.description) expect(page).to have_content("This is a really very long description for a proposed") - expect(page).to have_selector("#truncated_description_dashboard_action_#{action_long.id}") + expect(page).to have_css "#truncated_description_dashboard_action_#{action_long.id}" expect(page).to have_button("Show description") end @@ -127,7 +127,7 @@ describe "Proposal's dashboard" do expect(page).to have_content(action.title) find(:css, "#dashboard_action_#{action.id}_execute").click - expect(page).not_to have_selector(:css, "#dashboard_action_#{action.id}_execute") + expect(page).not_to have_css "#dashboard_action_#{action.id}_execute" end scenario "Dashboard progress can unexecute proposed action" do @@ -138,7 +138,7 @@ describe "Proposal's dashboard" do expect(page).to have_content(action.title) find(:css, "#dashboard_action_#{action.id}_unexecute").click - expect(page).to have_selector(:css, "#dashboard_action_#{action.id}_execute") + expect(page).to have_css "#dashboard_action_#{action.id}_execute" end scenario "Dashboard progress dont show proposed actions with published_proposal: true" do @@ -346,7 +346,7 @@ describe "Proposal's dashboard" do visit recommended_actions_proposal_dashboard_path(proposal.to_param) expect(page).to have_link("Recommended actions") - expect(page).to have_selector("h2", text: "Recommended actions") + expect(page).to have_css "h2", text: "Recommended actions" expect(page).to have_content("Pending") expect(page).to have_content("Done") end @@ -404,9 +404,9 @@ describe "Proposal's dashboard" do within(".dashboard-related-content") do expect(page).to have_content("Related content (2)") - expect(page).to have_selector(".related-content-title", text: "PROPOSAL") + expect(page).to have_css ".related-content-title", text: "PROPOSAL" expect(page).to have_link related_proposal.title - expect(page).to have_selector(".related-content-title", text: "DEBATE") + expect(page).to have_css ".related-content-title", text: "DEBATE" expect(page).to have_link related_debate.title end end diff --git a/spec/system/debates_spec.rb b/spec/system/debates_spec.rb index aa5005b77..fa70d949f 100644 --- a/spec/system/debates_spec.rb +++ b/spec/system/debates_spec.rb @@ -14,7 +14,7 @@ describe "Debates" do visit debates_path - expect(page).to have_selector("#debates .debate", count: 3) + expect(page).to have_css "#debates .debate", count: 3 debates.each do |debate| within("#debates") do expect(page).to have_content debate.title @@ -31,7 +31,7 @@ describe "Debates" do visit debates_path - expect(page).to have_selector("#debates .debate", count: per_page) + expect(page).to have_css "#debates .debate", count: per_page within("ul.pagination") do expect(page).to have_content("1") @@ -40,7 +40,7 @@ describe "Debates" do click_link "Next", exact: false end - expect(page).to have_selector("#debates .debate", count: 2) + expect(page).to have_css "#debates .debate", count: 2 end scenario "Index view mode" do @@ -80,7 +80,7 @@ describe "Debates" do expect(page).to have_content "Debate description" expect(page).to have_content debate.author.name expect(page).to have_content I18n.l(debate.created_at.to_date) - expect(page).to have_selector(avatar(debate.author.name)) + expect(page).to have_css avatar(debate.author.name) expect(page.html).to include "