From 06ca2979ddf73d465231f54fd67bf258fd6a1c51 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 15 Sep 2023 10:40:03 +0100 Subject: [PATCH] Adds assertions on bulk invoice creation --- spec/system/admin/orders_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/system/admin/orders_spec.rb b/spec/system/admin/orders_spec.rb index d64b74eb9d..dfa94e11d1 100644 --- a/spec/system/admin/orders_spec.rb +++ b/spec/system/admin/orders_spec.rb @@ -577,13 +577,21 @@ describe ' page.find("span.icon-reorder", text: "ACTIONS").click within ".ofn-drop-down .menu" do - page.find("span", text: "Print Invoices").click + expect { + page.find("span", text: "Print Invoices").click # Prints invoices in bulk + }.to enqueue_job(BulkInvoiceJob).exactly(:once) end expect(page).to have_content "Compiling Invoices" expect(page).to have_content "Please wait until the PDF is ready " \ "before closing this modal." - # an error 422 is generated in the console + + # we don't run Sidekiq in test environment, so we need to manually run enqueued jobs + # to generate PDF files, and change the modal accordingly + perform_enqueued_jobs(only: BulkInvoiceJob) + + expect(page).to have_content "Bulk Invoice created" + expect(page).to have_content "VIEW FILE" end it "can bulk cancel 2 orders" do