diff --git a/spec/base_spec_helper.rb b/spec/base_spec_helper.rb index aa5c315524..a2c6776ec3 100644 --- a/spec/base_spec_helper.rb +++ b/spec/base_spec_helper.rb @@ -98,7 +98,6 @@ RSpec.configure do |config| Flipper.disable(:background_reports) if example.file_path.in?( [ # rubocop:disable Layout/LineLength - "./spec/system/admin/reports/enterprise_summary_fees/enterprise_summary_fee_with_tax_report_by_order_spec.rb", "./spec/system/admin/reports/enterprise_summary_fees/enterprise_summary_fee_with_tax_report_by_producer_spec.rb", "./spec/system/admin/reports/orders_and_fulfillment_spec.rb", "./spec/system/admin/reports/packing_report_spec.rb", @@ -255,4 +254,5 @@ RSpec.configure do |config| config.include Features::DatepickerHelper, type: :system config.include Features::TrixEditorHelper, type: :system config.include DownloadsHelper, type: :system + config.include ReportsHelper, type: :system end diff --git a/spec/support/reports_helper.rb b/spec/support/reports_helper.rb new file mode 100644 index 0000000000..0145eb245e --- /dev/null +++ b/spec/support/reports_helper.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module ReportsHelper + def run_report + click_on "Go" + perform_enqueued_jobs(only: ReportJob) + end +end diff --git a/spec/system/admin/reports/enterprise_summary_fees/enterprise_summary_fee_with_tax_report_by_order_spec.rb b/spec/system/admin/reports/enterprise_summary_fees/enterprise_summary_fee_with_tax_report_by_order_spec.rb index 13eea4aa19..5831946361 100644 --- a/spec/system/admin/reports/enterprise_summary_fees/enterprise_summary_fee_with_tax_report_by_order_spec.rb +++ b/spec/system/admin/reports/enterprise_summary_fees/enterprise_summary_fee_with_tax_report_by_order_spec.rb @@ -163,8 +163,7 @@ describe "Enterprise Summary Fee with Tax Report By Order" do visit admin_reports_path click_on I18n.t("admin.reports.enterprise_fees_with_tax_report_by_order") - expect(page).to have_button("Go") - click_on "Go" + run_report expect(page.find("table.report__table thead tr").text).to have_content(table_header) @@ -242,8 +241,7 @@ describe "Enterprise Summary Fee with Tax Report By Order" do visit admin_reports_path click_on I18n.t("admin.reports.enterprise_fees_with_tax_report_by_order") - expect(page).to have_button("Go") - click_on "Go" + run_report expect(page.find("table.report__table thead tr").text).to have_content(table_header)