Add missing expectations to confirm the page has changed
After a `visit`, we were checking for content or filling in fields that
were already there before the `visit`, so we weren't 100% sure that the
request had finished before the test continued.
In the case of the verification tests, we were clicking the submit
buttons over and over without and then checking or interacting with
elements that were already there. Even though the button was disabled
between requests, meaning there wouldn't be simultaneous requests, it
was possible to interact with a form field before waiting for the
request to finish.
Some of these tests have recently failed on our CI, and it might be
because of that:
```
1) Admin budgets Edit Changing name for current locale will update the
slug if budget is in draft phase
Failure/Error: raise ex, cause: cause
Selenium::WebDriver::Error::UnknownError:
unknown error: unhandled inspector error: {"code":-32000,
"message":"Node with given id does not belong to the document"}
(Session info: chrome=134.0.6998.35)
1) Budgets creation wizard Creation of a multiple-headings budget by
steps
Failure/Error: expect(page).to have_content "Heading created
successfully!"
Selenium::WebDriver::Error::UnknownError:
unknown error: unhandled inspector error: {"code":-32000,
"message":"Node with given id does not belong to the document"}
(Session info: chrome=134.0.6998.35)
1) Custom information texts Show custom texts instead of default ones
Failure/Error: raise ex, cause: cause
Selenium::WebDriver::Error::UnknownError:
unknown error: unhandled inspector error: {"code":-32000,
"message":"Node with given id does not belong to the document"}
(Session info: chrome=134.0.6998.35)
1) Users Regular authentication Sign in Avoid username-email collisions
Failure/Error: raise ex, cause: cause
Selenium::WebDriver::Error::UnknownError:
unknown error: unhandled inspector error: {"code":-32000,
"message":"Node with given id does not belong to the document"}
(Session info: chrome=134.0.6998.35)
2) Verify Letter Code verification 6 tries allowed
Failure/Error: raise ex, cause: cause
Selenium::WebDriver::Error::UnknownError:
unknown error: unhandled inspector error: {"code":-32000,
"message":"Node with given id does not belong to the document"}
(Session info: chrome=134.0.6998.35)
2) Valuation budget investments Valuate Finish valuation
Failure/Error: raise ex, cause: cause
Selenium::WebDriver::Error::UnknownError:
unknown error: unhandled inspector error: {"code":-32000,
"message":"Node with given id does not belong to the document"}
(Session info: chrome=134.0.6998.35)
1) Users Delete a level 2 user account from document verification page
Failure/Error: raise ex, cause: cause
Selenium::WebDriver::Error::UnknownError:
unknown error: unhandled inspector error: {"code":-32000,
"message":"Node with given id does not belong to the document"}
(Session info: chrome=134.0.6998.35)
```
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user