Merge pull request #3263 from Platoniq/dashboard-recommended-actions-page

Dashboard recommended actions page
This commit is contained in:
Alberto
2019-03-19 16:21:28 +01:00
committed by GitHub
16 changed files with 264 additions and 19 deletions

View File

@@ -49,6 +49,77 @@ feature "Proposal's dashboard" do
scenario 'Dashboard progress show proposed actions' do
action = create(:dashboard_action, :proposed_action, :active)
visit progress_proposal_dashboard_path(proposal)
expect(page).to have_content(action.title)
end
scenario "Dashboard progress do not display from the fourth proposed actions", js: true do
create_list(:dashboard_action, 4, :proposed_action, :active)
action_5 = create(:dashboard_action, :proposed_action, :active)
visit progress_proposal_dashboard_path(proposal)
expect(page).not_to have_content(action_5.title)
end
scenario "Dashboard progress display link to new page for proposed actions when
there are more than four proposed actions", js: true do
create_list(:dashboard_action, 4, :proposed_action, :active)
action_5 = create(:dashboard_action, :proposed_action, :active)
visit progress_proposal_dashboard_path(proposal)
expect(page).to have_link("Go to recommended actions")
end
scenario "Dashboard progress do not display link to new page for proposed actions
when there are less than five proposed actions", js: true do
create_list(:dashboard_action, 4, :proposed_action, :active)
visit progress_proposal_dashboard_path(proposal)
expect(page).not_to have_link("Check out recommended actions")
end
scenario "Dashboard progress display proposed_action pending on his section" do
action = create(:dashboard_action, :proposed_action, :active)
visit progress_proposal_dashboard_path(proposal)
within "#proposed_actions_pending" do
expect(page).to have_content(action.title)
end
end
scenario "Dashboard progress display contains no results text when there are not
proposed_actions pending" do
visit progress_proposal_dashboard_path(proposal)
expect(page).to have_content("No recommended actions pending")
end
scenario "Dashboard progress display proposed_action done on his section" do
action = create(:dashboard_action, :proposed_action, :active)
visit progress_proposal_dashboard_path(proposal)
find(:css, "#dashboard_action_#{action.id}_execute").click
within "#proposed_actions_done" do
expect(page).to have_content(action.title)
end
end
scenario "Dashboard progress display contains no results text when there are not
proposed_actions pending" do
visit progress_proposal_dashboard_path(proposal)
expect(page).to have_content("No recommended actions done")
end
scenario "Dashboard progress can execute proposed action" do
action = create(:dashboard_action, :proposed_action, :active)
visit progress_proposal_dashboard_path(proposal)
expect(page).to have_content(action.title)
@@ -229,4 +300,88 @@ feature "Proposal's dashboard" do
expect(page).to have_content('Comments')
expect(page).to have_link('Access the community')
end
scenario "Dashboard has a link to recommended_actions", js: true do
expect(page).to have_link("Recommended actions")
click_link "Recommended actions"
expect(page).to have_content("Recommended actions")
expect(page).to have_content("Pending")
expect(page).to have_content("Done")
end
scenario "On recommended actions section display from the fourth proposed actions
when click see_proposed_actions_link", js: true do
create_list(:dashboard_action, 4, :proposed_action, :active)
action_5 = create(:dashboard_action, :proposed_action, :active)
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
find(:css, "#see_proposed_actions_link_pending").click
expect(page).to have_content(action_5.title)
end
scenario "On recommended actions section do not display from the fourth proposed actions", js: true do
create_list(:dashboard_action, 4, :proposed_action, :active)
action_5 = create(:dashboard_action, :proposed_action, :active)
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
expect(page).not_to have_content(action_5.title)
end
scenario "On recommended actions section display link for toggle when there are
more than four proposed actions", js: true do
create_list(:dashboard_action, 4, :proposed_action, :active)
action_5 = create(:dashboard_action, :proposed_action, :active)
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
expect(page).to have_content("Check out recommended actions")
end
scenario "On recommended actions section do not display link for toggle when
there are less than five proposed actions", js: true do
create_list(:dashboard_action, 4, :proposed_action, :active)
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
expect(page).not_to have_link("Check out recommended actions")
end
scenario "On recommended actions section display proposed_action pending on his section" do
action = create(:dashboard_action, :proposed_action, :active)
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
within "#proposed_actions_pending" do
expect(page).to have_content(action.title)
end
end
scenario "On recommended actions section contains no_results_text when there are
not proposed_actions pending" do
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
expect(page).to have_content("No recommended actions pending")
end
scenario "On recommended actions section display proposed_action done on his section" do
action = create(:dashboard_action, :proposed_action, :active)
visit recommended_actions_proposal_dashboard_path(proposal.to_param)
find(:css, "#dashboard_action_#{action.id}_execute").click
within "#proposed_actions_done" do
expect(page).to have_content(action.title)
end
end
scenario "On recommended actions section contains no_results_text when there are
not proposed_actions pending" do
visit progress_proposal_dashboard_path(proposal)
expect(page).to have_content("No recommended actions done")
end
end