Requested changes

This commit is contained in:
cyrillefr
2025-04-02 14:46:22 +02:00
parent f0a5c76b45
commit 6666896fa3
2 changed files with 18 additions and 14 deletions

View File

@@ -13,19 +13,6 @@ module ReportsHelper
expect(page).to have_button "Go", disabled: false
end
def run_failed_report(report)
click_on "Go"
allow(report).to receive(:new).and_raise(StandardError, 'Provoked error for testing')
perform_enqueued_jobs(only: ReportJob)
expect(page).not_to have_selector ".loading"
expect(page).to have_button "Go", disabled: false
expect(page).to have_content 'This report failed. It may be too big to process. ' \
'We will look into it but please let us know ' \
'if the problem persists.'
end
def generate_report
run_report
click_on "Download Report"

View File

@@ -352,7 +352,24 @@ RSpec.describe '
visit admin_reports_path
click_link 'All products'
run_failed_report(Reporting::Reports::ProductsAndInventory::AllProducts)
report = Reporting::Reports::ProductsAndInventory::AllProducts
click_on "Go"
allow(report).to receive(:new).and_raise(StandardError, 'Provoked error for testing')
perform_enqueued_jobs(only: ReportJob)
expect(page).not_to have_selector ".loading"
expect(page).to have_button "Go", disabled: false
expect(page).to have_content 'This report failed. It may be too big to process. ' \
'We will look into it but please let us know ' \
'if the problem persists.'
# Admin shoulb be able to make some changes and retry
sleep(1)
allow(report).to receive(:new).and_call_original
run_report
end
it "shows products and inventory report" do