diff --git a/spec/support/common_actions/emails.rb b/spec/support/common_actions/emails.rb index 015be69a0..e713cdfdc 100644 --- a/spec/support/common_actions/emails.rb +++ b/spec/support/common_actions/emails.rb @@ -17,9 +17,10 @@ module Emails end def fill_in_newsletter_form(options = {}) - fill_in "newsletter_subject", with: (options[:subject] || "This is a different subject") - select (options[:segment_recipient] || "All users"), from: "newsletter_segment_recipient" - fill_in "newsletter_from", with: (options[:from] || "no-reply@consul.dev") - fill_in "newsletter_body", with: (options[:body] || "This is a different body") + select (options[:segment_recipient] || "All users"), from: "Recipients" + fill_in "Subject", with: (options[:subject] || "This is a different subject") + fill_in "E-mail address that will appear as sending the newsletter", + with: (options[:from] || "no-reply@consul.dev") + fill_in "Email content", with: (options[:body] || "This is a different body") end end diff --git a/spec/system/admin/banners_spec.rb b/spec/system/admin/banners_spec.rb index 234b7e296..a1e1b0db3 100644 --- a/spec/system/admin/banners_spec.rb +++ b/spec/system/admin/banners_spec.rb @@ -69,8 +69,6 @@ describe "Admin banners magement", :admin do end scenario "Publish a banner" do - section = WebSection.find_by(name: "proposals") - visit admin_root_path within("#side_menu") do @@ -81,12 +79,12 @@ describe "Admin banners magement", :admin do fill_in "Title", with: "Such banner" fill_in "Description", with: "many text wow link" - fill_in "banner_target_url", with: "https://www.url.com" - fill_in "post_started_at", with: Date.current - 7.days - fill_in "post_ended_at", with: Date.current + 7.days - fill_in "banner_background_color", with: "#850000" - fill_in "banner_font_color", with: "#ffb2b2" - check section.name.titleize + fill_in "Link", with: "https://www.url.com" + fill_in "Post started at", with: Date.current - 7.days + fill_in "Post ended at", with: Date.current + 7.days + fill_in "Background color", with: "#850000" + fill_in "Font color", with: "#ffb2b2" + within_fieldset("Sections where it will appear") { check "Proposals" } click_button "Save changes" diff --git a/spec/system/admin/dashboard/actions_spec.rb b/spec/system/admin/dashboard/actions_spec.rb index 4e7a8e78a..e6d6e175e 100644 --- a/spec/system/admin/dashboard/actions_spec.rb +++ b/spec/system/admin/dashboard/actions_spec.rb @@ -47,8 +47,8 @@ describe "Admin dashboard actions", :admin do end scenario "Creates a new action" do - fill_in "dashboard_action_title", with: action.title - fill_in "dashboard_action_description", with: action.description + fill_in "Title", with: action.title + fill_in "Description", with: action.description click_button "Save" diff --git a/spec/system/admin/settings_spec.rb b/spec/system/admin/settings_spec.rb index 558bf41d0..0a45ad892 100644 --- a/spec/system/admin/settings_spec.rb +++ b/spec/system/admin/settings_spec.rb @@ -40,7 +40,7 @@ describe "Admin settings", :admin do scenario "When `Map settings` tab content is shown map should be initialized" do visit admin_settings_path - find("#map-tab").click + click_link "Map configuration" expect(page).to have_css("#admin-map.leaflet-container") end @@ -51,7 +51,7 @@ describe "Admin settings", :admin do Setting["feature.map"] = false visit admin_settings_path - find("#map-tab").click + click_link "Map configuration" expect(page).to have_content "To show the map to users you must enable " \ '"Proposals and budget investments geolocation" ' \ @@ -63,7 +63,7 @@ describe "Admin settings", :admin do Setting["feature.map"] = true visit admin_settings_path - find("#map-tab").click + click_link "Map configuration" expect(page).to have_css("#admin-map") expect(page).not_to have_content "To show the map to users you must enable " \ @@ -96,7 +96,7 @@ describe "Admin settings", :admin do Setting["feature.map"] = true visit admin_settings_path - find("#map-tab").click + click_link "Map configuration" find("#admin-map").click within "#map-form" do click_on "Update" @@ -211,7 +211,7 @@ describe "Admin settings", :admin do map_setting = Setting.create!(key: "map.whatever") visit admin_settings_path - find("#map-tab").click + click_link "Map configuration" within("#edit_setting_#{map_setting.id}") do fill_in "setting_#{map_setting.id}", with: "New value" diff --git a/spec/system/emails_spec.rb b/spec/system/emails_spec.rb index 1b2f1c1e8..537e4b6d0 100644 --- a/spec/system/emails_spec.rb +++ b/spec/system/emails_spec.rb @@ -373,9 +373,9 @@ describe "Emails" do login_as(valuator.user) visit edit_valuation_budget_budget_investment_path(budget, investment) - choose "budget_investment_feasibility_unfeasible" - fill_in "budget_investment_unfeasibility_explanation", with: "This is not legal as stated in Article 34.9" - find_field("budget_investment[valuation_finished]").click + within_fieldset("Feasibility") { choose "Unfeasible" } + fill_in "Feasibility explanation", with: "This is not legal as stated in Article 34.9" + check "Valuation finished" click_button "Save changes" expect(page).to have_content "Dossier updated" diff --git a/spec/system/valuation/budget_investments_spec.rb b/spec/system/valuation/budget_investments_spec.rb index 6c80467e4..b685ef346 100644 --- a/spec/system/valuation/budget_investments_spec.rb +++ b/spec/system/valuation/budget_investments_spec.rb @@ -415,10 +415,14 @@ describe "Valuation budget investments" do login_as(admin.user) visit edit_valuation_budget_budget_investment_path(budget, investment) - expect(page).to have_selector("input[id='budget_investment_feasibility_undecided']") - expect(page).to have_selector("textarea[id='budget_investment_unfeasibility_explanation']") - expect(page).to have_selector("input[name='budget_investment[valuation_finished]']") - expect(page).to have_button("Save changes") + within_fieldset "Feasibility" do + expect(page).to have_field "Undefined", type: :radio + expect(page).to have_field "Feasible", type: :radio + end + + expect(page).to have_field "Feasibility explanation", type: :textarea + expect(page).to have_field "Valuation finished", type: :checkbox + expect(page).to have_button "Save changes" end scenario "Valuators that are not admins cannot reopen or modify a finished valuation" do