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 "#{debate.title}" end @@ -400,7 +400,7 @@ describe "Debates" do visit debates_path 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 "#debates" do expect(best_debate.title).to appear_before(medium_debate.title) @@ -419,7 +419,7 @@ describe "Debates" do visit debates_path click_link "newest" - expect(page).to have_selector("a.is-active", text: "newest") + expect(page).to have_css "a.is-active", text: "newest" within "#debates" do expect(best_debate.title).to appear_before(medium_debate.title) @@ -437,7 +437,7 @@ describe "Debates" do scenario "can't be sorted if there's no logged user" do visit debates_path - expect(page).not_to have_selector("a", text: "recommendations") + expect(page).not_to have_css "a", text: "recommendations" end scenario "are shown on index header when account setting is enabled" do @@ -486,7 +486,7 @@ describe "Debates" do click_link "recommendations" - expect(page).to have_selector("a.is-active", text: "recommendations") + expect(page).to have_css "a.is-active", text: "recommendations" within "#debates" do expect(best_debate.title).to appear_before(medium_debate.title) @@ -566,7 +566,7 @@ describe "Debates" do click_button "Search" end - expect(page).to have_selector("input[name='search'][value='Schwifty']") + expect(page).to have_css "input[name='search'][value='Schwifty']" end end @@ -579,7 +579,7 @@ describe "Debates" do fill_in "search", with: "Show you got" click_button "Search" - expect(page).to have_selector("a.is-active", text: "relevance") + expect(page).to have_css "a.is-active", text: "relevance" within("#debates") do expect(all(".debate")[0].text).to match "Show you got" @@ -598,7 +598,7 @@ describe "Debates" do fill_in "search", with: "Show you got" click_button "Search" click_link "newest" - expect(page).to have_selector("a.is-active", text: "newest") + expect(page).to have_css "a.is-active", text: "newest" within("#debates") do expect(all(".debate")[0].text).to match "Show you got" @@ -622,7 +622,7 @@ describe "Debates" do fill_in "search", with: "Show you got" click_button "Search" click_link "recommendations" - expect(page).to have_selector("a.is-active", text: "recommendations") + expect(page).to have_css "a.is-active", text: "recommendations" within("#debates") do expect(all(".debate")[0].text).to match "Show you got" @@ -642,8 +642,8 @@ describe "Debates" do click_button "Search" end - expect(page).not_to have_selector("#debates .debate-featured") - expect(page).not_to have_selector("#featured-debates") + expect(page).not_to have_css "#debates .debate-featured" + expect(page).not_to have_css "#featured-debates" end end diff --git a/spec/system/home_spec.rb b/spec/system/home_spec.rb index 0fb882e75..8e12ba1a8 100644 --- a/spec/system/home_spec.rb +++ b/spec/system/home_spec.rb @@ -81,9 +81,9 @@ describe "Home" do visit root_path - expect(page).to have_selector("li[data-slide='0']") - expect(page).to have_selector("li[data-slide='1']", visible: :hidden) - expect(page).to have_selector("li[data-slide='2']", visible: :hidden) + expect(page).to have_css "li[data-slide='0']" + expect(page).to have_css "li[data-slide='1']", visible: :hidden + expect(page).to have_css "li[data-slide='2']", visible: :hidden end scenario "Display recommended show when click on carousel" do diff --git a/spec/system/legislation/processes_spec.rb b/spec/system/legislation/processes_spec.rb index 5a3bee659..de95ae37f 100644 --- a/spec/system/legislation/processes_spec.rb +++ b/spec/system/legislation/processes_spec.rb @@ -139,7 +139,7 @@ describe "Legislation" do visit legislation_processes_path - expect(page).to have_selector "img[alt='1. No Poverty']" + expect(page).to have_css "img[alt='1. No Poverty']" expect(page).to have_content "target 1.1" end end @@ -238,7 +238,7 @@ describe "Legislation" do visit legislation_process_path(process) - expect(page).to have_selector "img[alt='1. No Poverty']" + expect(page).to have_css "img[alt='1. No Poverty']" expect(page).to have_content "target 1.1" end end diff --git a/spec/system/officing_spec.rb b/spec/system/officing_spec.rb index 78a2fe18a..9458e3a0f 100644 --- a/spec/system/officing_spec.rb +++ b/spec/system/officing_spec.rb @@ -128,7 +128,7 @@ describe "Poll Officing" do expect(page).to have_content("Here you can validate user documents and store voting results") visit new_officing_residence_path - expect(page).to have_selector("#residence_document_type") + expect(page).to have_css "#residence_document_type" select "DNI", from: "residence_document_type" fill_in "residence_document_number", with: "12345678Z" @@ -151,7 +151,7 @@ describe "Poll Officing" do expect(page).to have_content("Here you can validate user documents and store voting results") visit new_officing_residence_path - expect(page).to have_selector("#residence_document_type") + expect(page).to have_css "#residence_document_type" select "DNI", from: "residence_document_type" fill_in "residence_document_number", with: "12345678Y" diff --git a/spec/system/polls/polls_spec.rb b/spec/system/polls/polls_spec.rb index 6016c92bf..ea6cf128c 100644 --- a/spec/system/polls/polls_spec.rb +++ b/spec/system/polls/polls_spec.rb @@ -135,7 +135,7 @@ describe "Polls" do visit polls_path - expect(page).to have_selector "img[alt='1. No Poverty']" + expect(page).to have_css "img[alt='1. No Poverty']" expect(page).to have_content "target 1.1" end end @@ -213,7 +213,7 @@ describe "Polls" do scenario "Level 1 users" do visit polls_path - expect(page).not_to have_selector(".already-answer") + expect(page).not_to have_css ".already-answer" poll.update!(geozone_restricted_to: [geozone]) @@ -283,7 +283,7 @@ describe "Polls" do visit poll_path(poll) - expect(page).to have_selector "img[alt='1. No Poverty']" + expect(page).to have_css "img[alt='1. No Poverty']" expect(page).to have_content "target 1.1" end diff --git a/spec/system/polls/questions_spec.rb b/spec/system/polls/questions_spec.rb index e100b77b5..a655a2677 100644 --- a/spec/system/polls/questions_spec.rb +++ b/spec/system/polls/questions_spec.rb @@ -20,7 +20,7 @@ describe "Poll Questions" do within "#poll_more_info_answers" do expect(page).to have_content "Pedestrian road" - expect(page).to have_selector "img[alt='Trees on both sides of the road']" + expect(page).to have_css "img[alt='Trees on both sides of the road']" end end end diff --git a/spec/system/proposals_spec.rb b/spec/system/proposals_spec.rb index eff9755a4..ff45521ee 100644 --- a/spec/system/proposals_spec.rb +++ b/spec/system/proposals_spec.rb @@ -23,7 +23,7 @@ describe "Proposals" do visit proposals_path - expect(page).to have_selector("#proposals .proposal-featured", count: 3) + expect(page).to have_css "#proposals .proposal-featured", count: 3 featured_proposals.each do |featured_proposal| within("#featured-proposals") do expect(page).to have_content featured_proposal.title @@ -31,7 +31,7 @@ describe "Proposals" do end end - expect(page).to have_selector("#proposals .proposal", count: 3) + expect(page).to have_css "#proposals .proposal", count: 3 proposals.each do |proposal| within("#proposals") do expect(page).to have_content proposal.title @@ -74,7 +74,7 @@ describe "Proposals" do click_link "View selected proposals" - expect(page).not_to have_selector(".view-mode") + expect(page).not_to have_css ".view-mode" expect(page).not_to have_button("View mode") end @@ -85,7 +85,7 @@ describe "Proposals" do visit proposals_path - expect(page).to have_selector("#proposals .proposal", count: per_page) + expect(page).to have_css "#proposals .proposal", count: per_page within("ul.pagination") do expect(page).to have_content("1") @@ -94,8 +94,8 @@ describe "Proposals" do click_link "Next", exact: false end - expect(page).to have_selector("#proposals .proposal-featured", count: 3) - expect(page).to have_selector("#proposals .proposal", count: 2) + expect(page).to have_css "#proposals .proposal-featured", count: 3 + expect(page).to have_css "#proposals .proposal", count: 2 end scenario "Index should show proposal descriptive image only when is defined" do @@ -123,10 +123,10 @@ describe "Proposals" do expect(page).to have_content "Proposal description" expect(page).to have_content proposal.author.name expect(page).to have_content I18n.l(proposal.created_at.to_date) - expect(page).to have_selector(avatar(proposal.author.name)) + expect(page).to have_css avatar(proposal.author.name) expect(page.html).to include "#{proposal.title}" - expect(page).not_to have_selector ".js-flag-actions" - expect(page).not_to have_selector ".js-follow" + expect(page).not_to have_css ".js-flag-actions" + expect(page).not_to have_css ".js-follow" end describe "Social share buttons" do @@ -302,14 +302,14 @@ describe "Proposals" do scenario "Show YouTube video" do proposal = create(:proposal, video_url: "http://www.youtube.com/watch?v=a7UFm6ErMPU") visit proposal_path(proposal) - expect(page).to have_selector("div[id='js-embedded-video']") + expect(page).to have_css "div[id='js-embedded-video']" expect(page.html).to include "https://www.youtube.com/embed/a7UFm6ErMPU" end scenario "Show Vimeo video" do proposal = create(:proposal, video_url: "https://vimeo.com/7232823") visit proposal_path(proposal) - expect(page).to have_selector("div[id='js-embedded-video']") + expect(page).to have_css "div[id='js-embedded-video']" expect(page.html).to include "https://player.vimeo.com/video/7232823" end @@ -317,7 +317,7 @@ describe "Proposals" do proposal = create(:proposal, video_url: nil) visit proposal_path(proposal) - expect(page).not_to have_selector("div[id='js-embedded-video']") + expect(page).not_to have_css "div[id='js-embedded-video']" end end @@ -545,7 +545,7 @@ describe "Proposals" do scenario "When there are not gezones defined it does not show the geozone link" do visit proposal_path(create(:proposal)) - expect(page).not_to have_selector "#geozone" + expect(page).not_to have_css "#geozone" expect(page).not_to have_link "All city" end @@ -666,7 +666,7 @@ describe "Proposals" do visit proposals_path - expect(page).to have_selector("#proposals .proposal", count: 1) + expect(page).to have_css "#proposals .proposal", count: 1 within("#proposals") do expect(page).to have_content not_retired.title expect(page).not_to have_content retired.title @@ -810,7 +810,7 @@ describe "Proposals" do visit proposals_path 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 "#proposals" do expect(best_proposal.title).to appear_before(medium_proposal.title) @@ -828,7 +828,7 @@ describe "Proposals" do visit proposals_path click_link "newest" - expect(page).to have_selector("a.is-active", text: "newest") + expect(page).to have_css "a.is-active", text: "newest" within "#proposals" do expect(best_proposal.title).to appear_before(medium_proposal.title) @@ -846,7 +846,7 @@ describe "Proposals" do scenario "can't be sorted if there's no logged user" do visit proposals_path - expect(page).not_to have_selector("a", text: "recommendations") + expect(page).not_to have_css "a", text: "recommendations" end scenario "are shown on index header when account setting is enabled" do @@ -895,7 +895,7 @@ describe "Proposals" do click_link "recommendations" - expect(page).to have_selector("a.is-active", text: "recommendations") + expect(page).to have_css "a.is-active", text: "recommendations" within "#proposals-list" do expect(best_proposal.title).to appear_before(medium_proposal.title) @@ -1050,7 +1050,7 @@ describe "Proposals" do scenario "do not show in index by default" do visit proposals_path - expect(page).to have_selector("#proposals .proposal", count: 1) + expect(page).to have_css "#proposals .proposal", count: 1 expect(page).to have_content not_selected_proposal.title expect(page).not_to have_content selected_proposal.title end @@ -1059,7 +1059,7 @@ describe "Proposals" do visit proposals_path click_link "View selected proposals" - expect(page).to have_selector("#proposals .proposal", count: 1) + expect(page).to have_css "#proposals .proposal", count: 1 expect(page).to have_content selected_proposal.title expect(page).not_to have_content not_selected_proposal.title end @@ -1077,13 +1077,13 @@ describe "Proposals" do visit proposals_path - expect(page).to have_selector("#proposals .proposal-featured") - expect(page).to have_selector("#featured-proposals") + expect(page).to have_css "#proposals .proposal-featured" + expect(page).to have_css "#featured-proposals" click_link "View selected proposals" - expect(page).not_to have_selector("#proposals .proposal-featured") - expect(page).not_to have_selector("#featured-proposals") + expect(page).not_to have_css "#proposals .proposal-featured" + expect(page).not_to have_css "#featured-proposals" end scenario "do not show recommented proposal in selected proposals list" do @@ -1183,7 +1183,7 @@ describe "Proposals" do click_button "Search" end - expect(page).to have_selector("input[name='search'][value='Schwifty']") + expect(page).to have_css "input[name='search'][value='Schwifty']" end end @@ -1196,7 +1196,7 @@ describe "Proposals" do fill_in "search", with: "Title content" click_button "Search" - expect(page).to have_selector("a.is-active", text: "relevance") + expect(page).to have_css "a.is-active", text: "relevance" within("#proposals") do expect(all(".proposal")[0].text).to match "Title content" @@ -1219,7 +1219,7 @@ describe "Proposals" do click_link "newest" - expect(page).to have_selector("a.is-active", text: "newest") + expect(page).to have_css "a.is-active", text: "newest" within("#proposals") do expect(all(".proposal")[0].text).to match "Show you got" @@ -1243,7 +1243,7 @@ describe "Proposals" do fill_in "search", with: "Show you got" click_button "Search" click_link "recommendations" - expect(page).to have_selector("a.is-active", text: "recommendations") + expect(page).to have_css "a.is-active", text: "recommendations" within("#proposals") do expect(all(".proposal")[0].text).to match "Show you got" @@ -1264,8 +1264,8 @@ describe "Proposals" do click_button "Search" end - expect(page).not_to have_selector("#proposals .proposal-featured") - expect(page).not_to have_selector("#featured-proposals") + expect(page).not_to have_css "#proposals .proposal-featured" + expect(page).not_to have_css "#featured-proposals" end end diff --git a/spec/system/site_customization/custom_pages_spec.rb b/spec/system/site_customization/custom_pages_spec.rb index e7586d939..79ba0da43 100644 --- a/spec/system/site_customization/custom_pages_spec.rb +++ b/spec/system/site_customization/custom_pages_spec.rb @@ -15,7 +15,7 @@ describe "Custom Pages" do visit custom_page.url expect(page).to have_title("Custom page") - expect(page).to have_selector("h1", text: "Custom page") + expect(page).to have_css "h1", text: "Custom page" expect(page).to have_content("Text for new custom page") expect(page).not_to have_content("Print this info") end @@ -33,8 +33,8 @@ describe "Custom Pages" do visit custom_page.url expect(page).to have_title("Custom page") - expect(page).to have_selector("h1", text: "Custom page") - expect(page).to have_selector("h2", text: "This is my new custom page") + expect(page).to have_css "h1", text: "Custom page" + expect(page).to have_css "h2", text: "This is my new custom page" expect(page).to have_content("Text for new custom page with a link to https://consul.dev") expect(page).to have_link("https://consul.dev") expect(page).to have_content("Print this info") @@ -53,9 +53,9 @@ describe "Custom Pages" do visit custom_page.url expect(page).to have_title("Custom page") - expect(page).to have_selector("h1", text: "Custom page") + expect(page).to have_css "h1", text: "Custom page" expect(page).to have_content("Text for new custom page") - expect(page).not_to have_selector("h2") + expect(page).not_to have_css "h2" expect(page).not_to have_content("Print this info") end @@ -88,7 +88,7 @@ describe "Custom Pages" do visit custom_page.url expect(page).to have_title("Another custom page") - expect(page).to have_selector("h1", text: "Another custom page") + expect(page).to have_css "h1", text: "Another custom page" expect(page).to have_content("Subtitle for custom page") end diff --git a/spec/system/tags/debates_spec.rb b/spec/system/tags/debates_spec.rb index 12ed9a19b..7baf96b6a 100644 --- a/spec/system/tags/debates_spec.rb +++ b/spec/system/tags/debates_spec.rb @@ -47,8 +47,8 @@ describe "Tags" do visit debates_path(tag: "123") - expect(page).not_to have_selector("#debates .debate-featured") - expect(page).not_to have_selector("#featured-debates") + expect(page).not_to have_css "#debates .debate-featured" + expect(page).not_to have_css "#featured-debates" end scenario "Show" do @@ -123,7 +123,7 @@ describe "Tags" do login_as(debate.author) visit edit_debate_path(debate) - expect(page).to have_selector("input[value='Economía']") + expect(page).to have_css "input[value='Economía']" fill_in "debate_tag_list", with: "Economía, Hacienda" click_button "Save changes" diff --git a/spec/system/tags/proposals_spec.rb b/spec/system/tags/proposals_spec.rb index edfc25946..f87f41be3 100644 --- a/spec/system/tags/proposals_spec.rb +++ b/spec/system/tags/proposals_spec.rb @@ -32,8 +32,8 @@ describe "Tags" do visit proposals_path(tag: "123") - expect(page).not_to have_selector("#proposals .proposal-featured") - expect(page).not_to have_selector("#featured-proposals") + expect(page).not_to have_css "#proposals .proposal-featured" + expect(page).not_to have_css "#featured-proposals" end scenario "Index shows 3 tags with no plus link" do @@ -159,7 +159,7 @@ describe "Tags" do login_as(proposal.author) visit edit_proposal_path(proposal) - expect(page).to have_selector("input[value='Economía']") + expect(page).to have_css "input[value='Economía']" fill_in "Tags", with: "Economía, Hacienda" click_button "Save changes" diff --git a/spec/system/tags_spec.rb b/spec/system/tags_spec.rb index fb73b3d82..055964a8b 100644 --- a/spec/system/tags_spec.rb +++ b/spec/system/tags_spec.rb @@ -95,7 +95,7 @@ describe "Tags" do login_as(debate.author) visit edit_debate_path(debate) - expect(page).to have_selector("input[value='Economía']") + expect(page).to have_css "input[value='Economía']" fill_in "debate_tag_list", with: "Economía, Hacienda" click_button "Save changes" diff --git a/spec/system/valuation/budget_investments_spec.rb b/spec/system/valuation/budget_investments_spec.rb index 2fda09f67..3d542abb1 100644 --- a/spec/system/valuation/budget_investments_spec.rb +++ b/spec/system/valuation/budget_investments_spec.rb @@ -400,8 +400,8 @@ describe "Valuation budget investments" do within("#duration") { expect(page).to have_content("12 months") } within("#feasibility") { expect(page).to have_content("Feasible") } - expect(page).not_to have_selector "#price" - expect(page).not_to have_selector "#price_first_year" + expect(page).not_to have_css "#price" + expect(page).not_to have_css "#price_first_year" end scenario "Finish valuation" do @@ -457,9 +457,9 @@ describe "Valuation budget investments" do scenario "Valuators that are not admins cannot reopen or modify a finished valuation" do visit edit_valuation_budget_budget_investment_path(budget, investment) - expect(page).not_to have_selector("input[id='budget_investment_feasibility_undecided']") - expect(page).not_to have_selector("textarea[id='budget_investment_unfeasibility_explanation']") - expect(page).not_to have_selector("input[name='budget_investment[valuation_finished]']") + expect(page).not_to have_css "input[id='budget_investment_feasibility_undecided']" + expect(page).not_to have_css "textarea[id='budget_investment_unfeasibility_explanation']" + expect(page).not_to have_css "input[name='budget_investment[valuation_finished]']" expect(page).to have_content("Valuation finished") expect(page).to have_content("Feasibility: Feasible") expect(page).to have_content("Feasibility explanation: Explanation is explanatory") diff --git a/spec/views/welcome/index.html.erb_spec.rb b/spec/views/welcome/index.html.erb_spec.rb index 1583730d9..411c999c5 100644 --- a/spec/views/welcome/index.html.erb_spec.rb +++ b/spec/views/welcome/index.html.erb_spec.rb @@ -15,7 +15,7 @@ RSpec.describe "welcome#index" do btn_path_link: debates_path(order: "recommendations") } within 'li[data-slide="0"] .card' do - expect(page).to have_selector("img") + expect(page).to have_css "img" end end @@ -33,7 +33,7 @@ RSpec.describe "welcome#index" do btn_path_link: debates_path(order: "recommendations") } within 'li[data-slide="0"] .card' do - expect(page).not_to have_selector("img") + expect(page).not_to have_css "img" end end end