The word "budget" in the "Preview budget" link is redundant. On the other hand, the words "Manage", Edit" and "Admin" are not really necessary in my humble opinion. Just like in the admin navigation menu we use "Participatory budgets" instead of "Manage Participatory budgets", the fact that we're going to manage or admin or edit something can be deduced from the fact that we're in the admin section. Besides, it isn't clear to me why we use "Manage" for projects, "Edit" for heading groups and "Admin" for ballots. The differences between these three concepts might be too subtle for me. The previous paragraphs haven't been corroborated with real users, though, so I might be mistaken and we might need to revisit these links in the future. These actions still take quite a lot of space. Maybe in the future we could remove the "delete" icon, at least on budgets which cannot be deleted.
149 lines
4.5 KiB
Ruby
149 lines
4.5 KiB
Ruby
require "rails_helper"
|
|
|
|
describe "Budgets creation wizard", :admin do
|
|
scenario "Creation of a single-heading budget by steps" do
|
|
visit admin_budgets_path
|
|
click_button "Create new budget"
|
|
click_link "Create single heading budget"
|
|
|
|
fill_in "Name", with: "Single heading budget"
|
|
click_button "Continue to groups"
|
|
|
|
expect(page).to have_content "New participatory budget created successfully!"
|
|
expect(page).to have_field "Group name", with: "Single heading budget"
|
|
|
|
click_button "Continue to headings"
|
|
|
|
expect(page).to have_content "Group created successfully"
|
|
|
|
fill_in "Heading name", with: "One and only heading"
|
|
fill_in "Money amount", with: "1000000"
|
|
click_button "Continue to phases"
|
|
|
|
expect(page).to have_css ".budget-phases-table"
|
|
|
|
click_button "Finish"
|
|
|
|
expect(page).to have_content "Phases configured successfully"
|
|
|
|
within "tr", text: "Single heading budget" do
|
|
click_link "Heading groups"
|
|
end
|
|
|
|
expect(page).to have_content "There is 1 group"
|
|
|
|
within "tr", text: "Single heading budget" do
|
|
click_link "Headings"
|
|
end
|
|
|
|
expect(page).to have_content "There is 1 heading"
|
|
|
|
within "tbody" do
|
|
expect(page).to have_content "One and only heading"
|
|
end
|
|
end
|
|
|
|
scenario "Creation of a multiple-headings budget by steps" do
|
|
visit admin_budgets_path
|
|
click_button "Create new budget"
|
|
click_link "Create multiple headings budget"
|
|
|
|
fill_in "Name", with: "Multiple headings budget"
|
|
click_button "Continue to groups"
|
|
|
|
expect(page).to have_content "New participatory budget created successfully!"
|
|
expect(page).to have_content "There are no groups."
|
|
|
|
click_button "Add new group"
|
|
fill_in "Group name", with: "All city"
|
|
click_button "Create new group"
|
|
|
|
expect(page).to have_content "Group created successfully!"
|
|
within("table") { expect(page).to have_content "All city" }
|
|
expect(page).not_to have_content "There are no groups."
|
|
|
|
click_button "Add new group"
|
|
fill_in "Group name", with: "Districts"
|
|
click_button "Create new group"
|
|
|
|
expect(page).to have_content "Group created successfully!"
|
|
within("table") { expect(page).to have_content "Districts" }
|
|
|
|
click_link "Continue to headings"
|
|
|
|
expect(page).to have_content "Showing headings from the All city group"
|
|
expect(page).to have_content "There are no headings."
|
|
|
|
click_button "Add new heading"
|
|
fill_in "Heading name", with: "All city"
|
|
fill_in "Money amount", with: "1000000"
|
|
click_button "Create new heading"
|
|
|
|
expect(page).to have_content "Heading created successfully!"
|
|
within("table") { expect(page).to have_content "All city" }
|
|
expect(page).not_to have_content "There are no headings."
|
|
|
|
click_link "Manage headings from the Districts group."
|
|
expect(page).to have_content "There are no headings."
|
|
|
|
click_button "Add new heading"
|
|
fill_in "Heading name", with: "North"
|
|
fill_in "Money amount", with: "500000"
|
|
click_button "Create new heading"
|
|
|
|
expect(page).to have_content "Heading created successfully!"
|
|
within("table") { expect(page).to have_content "North" }
|
|
expect(page).not_to have_content "There are no headings."
|
|
|
|
click_button "Add new heading"
|
|
fill_in "Heading name", with: "South"
|
|
fill_in "Money amount", with: "500000"
|
|
click_button "Create new heading"
|
|
|
|
expect(page).to have_content "Heading created successfully!"
|
|
within("table") { expect(page).to have_content "South" }
|
|
|
|
click_link "Continue to phases"
|
|
|
|
expect(page).to have_css ".budget-phases-table"
|
|
|
|
within("tr", text: "Voting projects") { click_link "Edit" }
|
|
fill_in "Name", with: "Custom phase name"
|
|
uncheck "Phase enabled"
|
|
click_button "Save changes"
|
|
|
|
expect(page).to have_content "Changes saved"
|
|
|
|
within "table" do
|
|
expect(page).to have_content "Custom phase name"
|
|
expect(page).not_to have_content "Voting projects"
|
|
end
|
|
|
|
click_button "Finish"
|
|
|
|
expect(page).to have_content "Phases configured successfully"
|
|
|
|
within "tr", text: "Multiple headings budget" do
|
|
click_link "Heading groups"
|
|
end
|
|
|
|
expect(page).to have_content "There are 2 groups"
|
|
|
|
within "tbody" do
|
|
expect(page).to have_content "All city"
|
|
expect(page).to have_content "Districts"
|
|
end
|
|
|
|
within "tr", text: "Districts" do
|
|
click_link "Headings"
|
|
end
|
|
|
|
expect(page).to have_content "There are 2 headings"
|
|
|
|
within "tbody" do
|
|
expect(page).to have_content "North"
|
|
expect(page).to have_content "South"
|
|
end
|
|
end
|
|
end
|