diff --git a/spec/system/admin/budget_headings_spec.rb b/spec/system/admin/budget_headings_spec.rb index 04b00a40b..eaa1a9af5 100644 --- a/spec/system/admin/budget_headings_spec.rb +++ b/spec/system/admin/budget_headings_spec.rb @@ -189,6 +189,7 @@ describe "Admin budget headings", :admin do visit budget_investments_path(budget, heading_id: "old-english-name") + expect(page).not_to have_content "Heading updated successfully" expect(page).to have_content "Old English Name" visit edit_admin_budget_group_heading_path(budget, group, heading) @@ -201,6 +202,7 @@ describe "Admin budget headings", :admin do visit budget_investments_path(budget, heading_id: "new-english-name") + expect(page).not_to have_content "Heading updated successfully" expect(page).to have_content "New English Name" end end diff --git a/spec/system/admin/budgets_spec.rb b/spec/system/admin/budgets_spec.rb index d3ede52c7..5b4518281 100644 --- a/spec/system/admin/budgets_spec.rb +++ b/spec/system/admin/budgets_spec.rb @@ -128,6 +128,9 @@ describe "Admin budgets", :admin do expect(page).to have_content "Group created successfully!" + within("#notice") { click_button "Close" } + expect(page).not_to have_content "Group created successfully!" + click_button "Add new group" fill_in "Group name", with: "District A" click_button "Create new group" @@ -315,6 +318,7 @@ describe "Admin budgets", :admin do visit budget_path(id: "old-english-name") + expect(page).not_to have_content "Participatory budget updated successfully" expect(page).to have_content "Old English Name" visit edit_admin_budget_path(budget) @@ -327,6 +331,7 @@ describe "Admin budgets", :admin do visit budget_path(id: "new-english-name") + expect(page).not_to have_content "Participatory budget updated successfully" expect(page).to have_content "New English Name" end diff --git a/spec/system/admin/budgets_wizard/budgets_spec.rb b/spec/system/admin/budgets_wizard/budgets_spec.rb index c96342bde..57a0d355e 100644 --- a/spec/system/admin/budgets_wizard/budgets_spec.rb +++ b/spec/system/admin/budgets_wizard/budgets_spec.rb @@ -48,9 +48,9 @@ describe "Budgets wizard, first step", :admin do visit new_admin_budgets_wizard_budget_path click_button "Continue to groups" - expect(page).not_to have_content "New participatory budget created successfully!" expect(page).to have_css ".is-invalid-label", text: "Name" expect(page).to have_css ".creation-timeline" + expect(page).not_to have_content "New participatory budget created successfully!" end scenario "Name should be unique" do @@ -60,9 +60,9 @@ describe "Budgets wizard, first step", :admin do fill_in "Name", with: "Existing Name" click_button "Continue to groups" - expect(page).not_to have_content "New participatory budget created successfully!" expect(page).to have_css(".is-invalid-label", text: "Name") expect(page).to have_css("small.form-error", text: "has already been taken") + expect(page).not_to have_content "New participatory budget created successfully!" end scenario "Do not show results and stats settings on new budget" do diff --git a/spec/system/admin/budgets_wizard/groups_spec.rb b/spec/system/admin/budgets_wizard/groups_spec.rb index 13d04105e..3927777db 100644 --- a/spec/system/admin/budgets_wizard/groups_spec.rb +++ b/spec/system/admin/budgets_wizard/groups_spec.rb @@ -53,12 +53,12 @@ describe "Budgets wizard, groups step", :admin do click_button "Create new group" - expect(page).not_to have_content "Group created successfully!" expect(page).to have_css ".is-invalid-label", text: "Group name" expect(page).to have_css ".creation-timeline" expect(page).to have_content "can't be blank" expect(page).to have_button "Create new group" expect(page).to have_button "Cancel" + expect(page).not_to have_content "Group created successfully!" expect(page).not_to have_button "Add new group" expect(page).not_to have_content "Continue to headings" end diff --git a/spec/system/admin/budgets_wizard/headings_spec.rb b/spec/system/admin/budgets_wizard/headings_spec.rb index de50af030..d56983fd5 100644 --- a/spec/system/admin/budgets_wizard/headings_spec.rb +++ b/spec/system/admin/budgets_wizard/headings_spec.rb @@ -74,11 +74,11 @@ describe "Budgets wizard, headings step", :admin do click_button "Create new heading" - expect(page).not_to have_content "Heading created successfully!" expect(page).to have_css(".is-invalid-label", text: "Heading name") expect(page).to have_content "can't be blank" expect(page).to have_button "Create new heading" expect(page).to have_button "Cancel" + expect(page).not_to have_content "Heading created successfully!" expect(page).not_to have_button "Add new heading" expect(page).not_to have_content "Continue to phases" diff --git a/spec/system/admin/budgets_wizard/wizard_spec.rb b/spec/system/admin/budgets_wizard/wizard_spec.rb index 85cb9c514..34a26f3ff 100644 --- a/spec/system/admin/budgets_wizard/wizard_spec.rb +++ b/spec/system/admin/budgets_wizard/wizard_spec.rb @@ -52,6 +52,9 @@ describe "Budgets creation wizard", :admin do within("table") { expect(page).to have_content "All city" } expect(page).not_to have_content "There are no groups." + within("#notice") { click_button "Close" } + expect(page).not_to have_content "Group created successfully!" + click_button "Add new group" fill_in "Group name", with: "Districts" click_button "Create new group" @@ -85,6 +88,9 @@ describe "Budgets creation wizard", :admin do within_table("Headings in Districts") { expect(page).to have_content "North" } expect(page).not_to have_content "There are no headings" + within("#notice") { click_button "Close" } + expect(page).not_to have_content "Heading created successfully!" + click_button "Add new heading" fill_in "Heading name", with: "South" fill_in "Money amount", with: "500000" diff --git a/spec/system/admin/poll/booths_spec.rb b/spec/system/admin/poll/booths_spec.rb index 7b38e46ea..5a12c77d9 100644 --- a/spec/system/admin/poll/booths_spec.rb +++ b/spec/system/admin/poll/booths_spec.rb @@ -113,17 +113,24 @@ describe "Admin booths", :admin do end scenario "Search" do - booth = create(:poll_booth) + create(:poll_booth, name: "Consulting Detective", location: "221B Baker Street") + create(:poll_booth, name: "World's Greatest Detective", location: "Gotham") visit admin_booths_path - fill_in "search", with: booth.name - click_button "Search" - expect(page).to have_css(".booth", count: 1) + expect(page).to have_css ".booth", count: 2 - fill_in "search", with: booth.location + fill_in "search", with: "Consulting" click_button "Search" - expect(page).to have_css(".booth", count: 1) + expect(page).not_to have_content "Greatest Detective" + expect(page).to have_content "Consulting Detective" + expect(page).to have_css ".booth", count: 1 + + fill_in "search", with: "Gotham" + click_button "Search" + expect(page).not_to have_content "Consulting Detective" + expect(page).to have_content "Greatest Detective" + expect(page).to have_css ".booth", count: 1 fill_in "search", with: "Wrong search criteria" click_button "Search" diff --git a/spec/system/admin/translatable_spec.rb b/spec/system/admin/translatable_spec.rb index 11080fe8a..8a8dc8128 100644 --- a/spec/system/admin/translatable_spec.rb +++ b/spec/system/admin/translatable_spec.rb @@ -87,7 +87,6 @@ describe "Admin edit translatable records", :admin do expect(page).to have_content "Draft updated successfully" - visit path click_link class: "fullscreen-toggle" expect(page).to have_field "Text", with: "Text in English" @@ -120,6 +119,9 @@ describe "Admin edit translatable records", :admin do expect(page).to have_content "Question updated successfully" visit path + + expect(page).not_to have_content "Question updated successfully" + select "Português brasileiro", from: "Language:" expect(page).to have_field "Questão", with: "Português" @@ -338,8 +340,6 @@ describe "Admin edit translatable records", :admin do expect(page).to have_content "Process updated successfully" - visit edit_admin_legislation_process_path(translatable) - expect_to_have_language_selected "Français" expect_not_to_have_language "English" end @@ -363,8 +363,8 @@ describe "Admin edit translatable records", :admin do visit path - expect(page).not_to have_select "Current language", with_options: ["Español"] expect(page).to have_select "Current language", with_options: ["English"] + expect(page).not_to have_select "Current language", with_options: ["Español"] end end diff --git a/spec/system/budgets/executions_spec.rb b/spec/system/budgets/executions_spec.rb index d6e663cb6..26c3cb5b4 100644 --- a/spec/system/budgets/executions_spec.rb +++ b/spec/system/budgets/executions_spec.rb @@ -27,14 +27,21 @@ describe "Executions" do create(:milestone, milestoneable: investment1) visit budget_path(budget) + + expect(page).not_to have_content(investment1.title) + click_link "See results" + expect(page).to have_content(investment1.title) + expect(page).to have_content(investment2.title) + expect(page).to have_content(investment4.title) + click_link "Milestones" - expect(page).to have_content(investment1.title) expect(page).not_to have_content(investment2.title) expect(page).not_to have_content(investment3.title) expect(page).not_to have_content(investment4.title) + expect(page).to have_content(investment1.title) end scenario "Do not display headings with no winning investments for selected status" do @@ -56,11 +63,12 @@ describe "Executions" do end scenario "Show message when there are no winning investments with the selected status" do - create(:milestone_status, name: I18n.t("seeds.budgets.statuses.executed")) + create(:milestone, milestoneable: investment1) + create(:milestone_status, name: "Executed") visit budget_executions_path(budget) - expect(page).to have_content("No winner investments in this state") + expect(page).not_to have_content("No winner investments in this state") select "Executed (0)", from: "Project's current state" click_button "Filter" @@ -118,8 +126,8 @@ describe "Executions" do select "Studying the project (1)", from: "Project's current state" click_button "Filter" - expect(page).to have_content(investment1.title) expect(page).not_to have_content(investment2.title) + expect(page).to have_content(investment1.title) select "Bidding (1)", from: "Project's current state" click_button "Filter" @@ -130,8 +138,8 @@ describe "Executions" do select "Executing the project (0)", from: "Project's current state" click_button "Filter" - expect(page).not_to have_content(investment1.title) expect(page).not_to have_content(investment2.title) + expect(page).not_to have_content(investment1.title) end scenario "are based on latest milestone status" do @@ -145,15 +153,17 @@ describe "Executions" do visit budget_executions_path(budget) + expect(page).to have_content investment1.title + select "Studying the project (0)", from: "Project's current state" click_button "Filter" - expect(page).not_to have_content(investment1.title) + expect(page).not_to have_content investment1.title select "Bidding (1)", from: "Project's current state" click_button "Filter" - expect(page).to have_content(investment1.title) + expect(page).to have_content investment1.title end scenario "milestones with future dates are not shown" do @@ -167,15 +177,17 @@ describe "Executions" do visit budget_executions_path(budget) - select "Studying the project (1)", from: "Project's current state" - click_button "Filter" - - expect(page).to have_content(investment1.title) + expect(page).to have_content investment1.title select "Bidding (0)", from: "Project's current state" click_button "Filter" - expect(page).not_to have_content(investment1.title) + expect(page).not_to have_content investment1.title + + select "Studying the project (1)", from: "Project's current state" + click_button "Filter" + + expect(page).to have_content investment1.title end scenario "by milestone tag, only display tags for winner investments" do @@ -198,26 +210,26 @@ describe "Executions" do select "Studying the project (1)", from: "Project's current state" click_button "Filter" - expect(page).to have_content(investment1.title) expect(page).not_to have_content(investment2.title) + expect(page).to have_content(investment1.title) select "Bidding (1)", from: "Project's current state" click_button "Filter" - expect(page).not_to have_content(investment1.title) expect(page).to have_content(investment2.title) + expect(page).not_to have_content(investment1.title) select "tag1 (1)", from: "Milestone tag" click_button "Filter" - expect(page).not_to have_content(investment1.title) expect(page).not_to have_content(investment2.title) + expect(page).not_to have_content(investment1.title) select "All (2)", from: "Milestone tag" click_button "Filter" - expect(page).not_to have_content(investment1.title) expect(page).to have_content(investment2.title) + expect(page).not_to have_content(investment1.title) end end diff --git a/spec/system/management/users_spec.rb b/spec/system/management/users_spec.rb index 817cb0078..3b183b0fa 100644 --- a/spec/system/management/users_spec.rb +++ b/spec/system/management/users_spec.rb @@ -78,15 +78,14 @@ describe "Users" do fill_in "document_verification_document_number", with: "12345678Z" click_button "Check document" - expect(page).not_to have_content "This user account is already verified." expect(page).to have_content "This user can participate in the website with the following permissions" + expect(page).not_to have_content "This user account is already verified." click_link "Delete user" accept_confirm { click_button "Delete account" } expect(page).to have_content "User account deleted." - refresh fill_in "document_verification_document_number", with: "12345678Z" click_button "Check document" diff --git a/spec/system/moderation/users_spec.rb b/spec/system/moderation/users_spec.rb index 7ea01a603..8de8df186 100644 --- a/spec/system/moderation/users_spec.rb +++ b/spec/system/moderation/users_spec.rb @@ -34,16 +34,16 @@ describe "Moderate users" do expect(page).not_to have_content(debate2.title) expect(page).to have_content(debate3.title) - visit debate_path(debate3) + click_link debate3.title + expect(page).to have_css "h1", exact_text: debate3.title expect(page).not_to have_content(comment3.body) click_link "Sign out" expect(page).to have_content "You have been signed out successfully" - visit root_path - + within("#notice") { click_button "Close" } click_link "Sign in" fill_in "user_login", with: citizen.email fill_in "user_password", with: citizen.password diff --git a/spec/system/site_customization/information_texts_spec.rb b/spec/system/site_customization/information_texts_spec.rb index 0df49f4bc..a70205f89 100644 --- a/spec/system/site_customization/information_texts_spec.rb +++ b/spec/system/site_customization/information_texts_spec.rb @@ -12,6 +12,9 @@ describe "Custom information texts", :admin do expect(page).to have_content "Translation updated successfully" visit admin_site_customization_information_texts_path(tab: "proposals") + + expect(page).not_to have_content "Translation updated successfully" + fill_in "contents[content_#{proposal_key}]values[value_en]", with: "Custom help with proposals" click_button "Save" diff --git a/spec/system/users_auth_spec.rb b/spec/system/users_auth_spec.rb index 73f01d259..cf0b1b55d 100644 --- a/spec/system/users_auth_spec.rb +++ b/spec/system/users_auth_spec.rb @@ -94,12 +94,9 @@ describe "Users" do click_button "Enter" expect(page).to have_content "You have been signed in successfully." - - visit account_path - expect(page).to have_link "My content", href: user_path(u1) - visit "/" + within("#notice") { click_button "Close" } click_link "Sign out" expect(page).to have_content "You have been signed out successfully." @@ -235,6 +232,8 @@ describe "Users" do expect(page).to have_content "You have been signed out successfully" visit "/" + + expect(page).not_to have_content "You have been signed out successfully" expect_not_to_be_signed_in end diff --git a/spec/system/valuation/budget_investments_spec.rb b/spec/system/valuation/budget_investments_spec.rb index fb3849708..43e04ead9 100644 --- a/spec/system/valuation/budget_investments_spec.rb +++ b/spec/system/valuation/budget_investments_spec.rb @@ -427,7 +427,9 @@ describe "Valuation budget investments" do expect(page).to have_content investment.title click_link investment.title - expect(page).to have_content("Valuation finished") + + expect(page).to have_content "Investment preview" + expect(page).to have_content "Valuation finished" end context "Reopen valuation" do diff --git a/spec/system/verification/letter_spec.rb b/spec/system/verification/letter_spec.rb index 5f5d61b4b..71fd9ba6e 100644 --- a/spec/system/verification/letter_spec.rb +++ b/spec/system/verification/letter_spec.rb @@ -119,13 +119,19 @@ describe "Verify Letter" do visit edit_letter_path - 6.times do - fill_in "verification_letter_email", with: user.email - fill_in "verification_letter_password", with: user.password - fill_in "verification_letter_verification_code", with: "1" + 5.times do |n| + fill_in "Email", with: user.email + fill_in "Password", with: user.password + fill_in "Code you received in letter", with: "1" click_button "Verify my account" + + expect(page).to have_field "Password", with: "" + expect(page).to have_content "Verification code incorrect" end + fill_in "Password", with: user.password + click_button "Verify my account" + expect(page).to have_content "You have reached the maximum number of attempts. Please try again later." expect(page).to have_current_path(account_path) end diff --git a/spec/system/verification/residence_spec.rb b/spec/system/verification/residence_spec.rb index fa8850730..959024cd5 100644 --- a/spec/system/verification/residence_spec.rb +++ b/spec/system/verification/residence_spec.rb @@ -128,6 +128,9 @@ describe "Residence" do click_button "Verify residence" expect(page).to have_content "The Census was unable to verify your information" + + within("#error_explanation") { click_button "Close" } + expect(page).not_to have_content "The Census was unable to verify your information" end click_button "Verify residence"