Merge pull request #5950 from consuldemocracy/more_missing_expectations
Reduce the number of flaky tests
This commit is contained in:
@@ -81,8 +81,11 @@ describe "Admin hidden budget investments", :admin do
|
||||
|
||||
visit admin_hidden_budget_investments_path(filter: "with_confirmed_hide", page: 2)
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 2
|
||||
|
||||
accept_confirm { click_button "Restore", match: :first, exact: true }
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 1
|
||||
expect(page).to have_current_path(/filter=with_confirmed_hide/)
|
||||
expect(page).to have_current_path(/page=2/)
|
||||
end
|
||||
|
||||
@@ -130,8 +130,11 @@ describe "Admin hidden comments", :admin do
|
||||
|
||||
visit admin_hidden_comments_path(filter: "with_confirmed_hide", page: 2)
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 2
|
||||
|
||||
accept_confirm("Are you sure? Restore") { click_button "Restore", match: :first, exact: true }
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 1
|
||||
expect(page).to have_current_path(/filter=with_confirmed_hide/)
|
||||
expect(page).to have_current_path(/page=2/)
|
||||
end
|
||||
|
||||
@@ -70,8 +70,11 @@ describe "Admin hidden debates", :admin do
|
||||
|
||||
visit admin_hidden_debates_path(filter: "with_confirmed_hide", page: 2)
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 2
|
||||
|
||||
accept_confirm("Are you sure? Restore") { click_button "Restore", match: :first, exact: true }
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 1
|
||||
expect(page).to have_current_path(/filter=with_confirmed_hide/)
|
||||
expect(page).to have_current_path(/page=2/)
|
||||
end
|
||||
|
||||
@@ -83,8 +83,11 @@ describe "Admin hidden proposals", :admin do
|
||||
|
||||
visit admin_hidden_proposals_path(filter: "with_confirmed_hide", page: 2)
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 2
|
||||
|
||||
accept_confirm("Are you sure? Restore") { click_button "Restore", match: :first, exact: true }
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 1
|
||||
expect(page).to have_current_path(/filter=with_confirmed_hide/)
|
||||
expect(page).to have_current_path(/page=2/)
|
||||
end
|
||||
|
||||
@@ -85,10 +85,13 @@ describe "Admin hidden users", :admin do
|
||||
|
||||
visit admin_hidden_users_path(filter: "with_confirmed_hide", page: 2)
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 2
|
||||
|
||||
accept_confirm("Are you sure? Restore \"#{users[-3].name}\"") do
|
||||
click_button "Restore", match: :first, exact: true
|
||||
end
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 1
|
||||
expect(page).to have_current_path(/filter=with_confirmed_hide/)
|
||||
expect(page).to have_current_path(/page=2/)
|
||||
end
|
||||
|
||||
@@ -80,8 +80,11 @@ describe "Admin proposal notifications", :admin do
|
||||
|
||||
visit admin_hidden_proposal_notifications_path(filter: "with_confirmed_hide", page: 2)
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 2
|
||||
|
||||
accept_confirm("Are you sure? Restore") { click_button "Restore", match: :first, exact: true }
|
||||
|
||||
expect(page).to have_css "tbody tr", count: 1
|
||||
expect(page).to have_current_path(/filter=with_confirmed_hide/)
|
||||
expect(page).to have_current_path(/page=2/)
|
||||
end
|
||||
|
||||
@@ -52,6 +52,7 @@ describe "Moderate proposal notifications" do
|
||||
describe "moderate in bulk" do
|
||||
describe "When a proposal has been selected for moderation" do
|
||||
let!(:proposal_notification) { create(:proposal_notification, created_at: Date.current - 4.days) }
|
||||
let!(:email) { proposal_notification.author.email }
|
||||
|
||||
before do
|
||||
visit moderation_proposal_notifications_path
|
||||
@@ -66,7 +67,7 @@ describe "Moderate proposal notifications" do
|
||||
expect(page).not_to have_css("#proposal_notification_#{proposal_notification.id}")
|
||||
|
||||
click_link "Block users"
|
||||
fill_in "email or name of user", with: proposal_notification.author.email
|
||||
fill_in "email or name of user", with: email
|
||||
click_button "Search"
|
||||
|
||||
within "tr", text: proposal_notification.author.name do
|
||||
@@ -75,15 +76,12 @@ describe "Moderate proposal notifications" do
|
||||
end
|
||||
|
||||
scenario "Block the author" do
|
||||
author = create(:user)
|
||||
proposal_notification.update!(author: author)
|
||||
|
||||
accept_confirm("Are you sure? Block authors") { click_button "Block authors" }
|
||||
|
||||
expect(page).not_to have_css("#proposal_notification_#{proposal_notification.id}")
|
||||
|
||||
click_link "Block users"
|
||||
fill_in "email or name of user", with: proposal_notification.author.email
|
||||
fill_in "email or name of user", with: email
|
||||
click_button "Search"
|
||||
|
||||
within "tr", text: proposal_notification.author.name do
|
||||
|
||||
Reference in New Issue
Block a user