mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Pass in :report_type parameter correctly to bulk coop report so different report types are generated
Also add tests for each of the different report types. I didn't make these JavaScript tests because not sure that is necessary and they would be slower.
This commit is contained in:
@@ -46,8 +46,8 @@ module OrderManagement
|
||||
completed_at_gt: params[:report][:start_at],
|
||||
completed_at_lt: params[:report][:end_at],
|
||||
distributor_id_in: params[:report][:distributor_ids],
|
||||
report_type: params[:report][:report_type]
|
||||
}
|
||||
},
|
||||
report_type: params[:report][:report_type]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -6,11 +6,70 @@ feature "bulk coop" do
|
||||
include AuthenticationHelper
|
||||
include WebHelper
|
||||
|
||||
scenario "bulk co-op report" do
|
||||
login_as_admin_and_visit spree.admin_reports_path
|
||||
click_link 'Bulk Co-Op'
|
||||
scenario "generating Bulk Coop Supplier Report" do
|
||||
login_as_admin_and_visit new_order_management_reports_bulk_coop_path
|
||||
select "Bulk Coop Supplier Report", from: "report_report_type"
|
||||
click_button 'Generate Report'
|
||||
|
||||
expect(page).to have_content 'Supplier'
|
||||
expect(page).to have_table_row [
|
||||
"Supplier",
|
||||
"Product",
|
||||
"Bulk Unit Size",
|
||||
"Variant",
|
||||
"Variant Value",
|
||||
"Variant Unit",
|
||||
"Weight",
|
||||
"Sum Total",
|
||||
"Units Required",
|
||||
"Unallocated",
|
||||
"Max Quantity Excess"
|
||||
]
|
||||
end
|
||||
|
||||
scenario "generating Bulk Co-op Allocation report" do
|
||||
login_as_admin_and_visit new_order_management_reports_bulk_coop_path
|
||||
select "Bulk Coop Allocation", from: "report_report_type"
|
||||
click_button 'Generate Report'
|
||||
|
||||
expect(page).to have_table_row [
|
||||
"Customer",
|
||||
"Product",
|
||||
"Bulk Unit Size",
|
||||
"Variant",
|
||||
"Variant Value",
|
||||
"Variant Unit",
|
||||
"Weight",
|
||||
"Sum Total",
|
||||
"Total available",
|
||||
"Unallocated",
|
||||
"Max Quantity Excess"
|
||||
]
|
||||
end
|
||||
|
||||
scenario "generating Bulk Co-op Packing Sheets report" do
|
||||
login_as_admin_and_visit new_order_management_reports_bulk_coop_path
|
||||
select "Bulk Coop Packing Sheets", from: "report_report_type"
|
||||
click_button 'Generate Report'
|
||||
|
||||
expect(page).to have_table_row [
|
||||
"Customer",
|
||||
"Product",
|
||||
"Variant",
|
||||
"Sum Total"
|
||||
]
|
||||
end
|
||||
|
||||
scenario "generating Bulk Co-op Customer Payments report" do
|
||||
login_as_admin_and_visit new_order_management_reports_bulk_coop_path
|
||||
select "Bulk Coop Customer Payments", from: "report_report_type"
|
||||
click_button 'Generate Report'
|
||||
|
||||
expect(page).to have_table_row [
|
||||
"Customer",
|
||||
"Date of Order",
|
||||
"Total Cost",
|
||||
"Amount Owing",
|
||||
"Amount Paid"
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user