Add missing expectations after refreshing the page
This way we know for sure the page has finished refreshing. Note that, for now, we aren't adding a check after every call to the `refresh` method because sometimes the page remains identical after refreshing. Not sure what we should do in these cases.
This commit is contained in:
@@ -43,6 +43,7 @@ describe "Account" do
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).not_to have_content "Changes saved"
|
||||
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
|
||||
@@ -98,6 +99,7 @@ describe "Account" do
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).not_to have_content "Changes saved"
|
||||
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
|
||||
@@ -131,21 +133,25 @@ describe "Account" do
|
||||
expect(page).to have_content "Changes saved"
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).not_to have_content "Changes saved"
|
||||
expect(find("#account_official_position_badge")).to be_checked
|
||||
end
|
||||
|
||||
scenario "Users with official position of level 2 and above" do
|
||||
official_user2 = create(:user, official_level: 2)
|
||||
official_user3 = create(:user, official_level: 3)
|
||||
official_user2 = create(:user, official_level: 2, username: "Official 2")
|
||||
official_user3 = create(:user, official_level: 3, username: "Official 3")
|
||||
|
||||
login_as(official_user2)
|
||||
visit account_path
|
||||
|
||||
expect(page).to have_field "Username", with: "Official 2"
|
||||
expect(page).not_to have_css "#account_official_position_badge"
|
||||
|
||||
login_as(official_user3)
|
||||
refresh
|
||||
|
||||
expect(page).to have_field "Username", with: "Official 3"
|
||||
expect(page).not_to have_css "#account_official_position_badge"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1802,6 +1802,8 @@ describe "Admin budget investments", :admin do
|
||||
|
||||
click_button "Columns"
|
||||
|
||||
expect(page).to have_css "button[aria-expanded=true]", exact_text: "Columns"
|
||||
|
||||
within("#js-columns-selector-wrapper") do
|
||||
uncheck "Title"
|
||||
uncheck "Price"
|
||||
@@ -1816,6 +1818,8 @@ describe "Admin budget investments", :admin do
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).to have_css "button[aria-expanded=false]", exact_text: "Columns"
|
||||
|
||||
cookie_value = cookie_by_name("investments-columns")[:value]
|
||||
|
||||
expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," \
|
||||
|
||||
@@ -110,9 +110,12 @@ describe "Admin legislation questions", :admin do
|
||||
find("#nested_question_options input").set("Changed")
|
||||
click_button "Save changes"
|
||||
|
||||
expect(page).to have_content "Question updated successfully"
|
||||
expect(page).not_to have_css "#error_explanation"
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).not_to have_content "Question updated successfully"
|
||||
expect(page).to have_field(field_en[:id], with: "Changed")
|
||||
end
|
||||
|
||||
@@ -136,6 +139,7 @@ describe "Admin legislation questions", :admin do
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).not_to have_content "Question updated successfully"
|
||||
expect(page).not_to have_field fields_for(:en).first[:id], with: "Yes"
|
||||
expect(page).to have_field fields_for(:en).last[:id], with: "No"
|
||||
end
|
||||
|
||||
@@ -69,6 +69,8 @@ describe "Admin booths", :admin do
|
||||
expect(page).to have_content "Booth created successfully"
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).not_to have_content "Booth created successfully"
|
||||
expect(page).to have_content "Upcoming booth"
|
||||
expect(page).to have_content "39th Street, number 2, ground floor"
|
||||
end
|
||||
|
||||
@@ -66,6 +66,7 @@ describe "Poll question options", :admin do
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).not_to have_content "Changes saved"
|
||||
expect(page).not_to have_content "Answer title"
|
||||
|
||||
expect("Another title").to appear_before("New title")
|
||||
|
||||
@@ -75,6 +75,9 @@ describe "Admin custom information texts", :admin do
|
||||
expect(page).to have_content "Translation updated successfully"
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).not_to have_content "Translation updated successfully"
|
||||
|
||||
select "Français", from: "Current language"
|
||||
|
||||
expect(page).to have_content "Aide personalise sur les débats"
|
||||
|
||||
@@ -1169,6 +1169,7 @@ describe "Budget Investments" do
|
||||
|
||||
refresh
|
||||
|
||||
expect(page).not_to have_content "Investment project deleted successfully"
|
||||
expect(page).to have_content "User has no public activity"
|
||||
expect(page).not_to have_content investment1.title
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user