From efbf1d6b8fec77212100db5a6393f4a8c3577f85 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 2 Aug 2023 13:14:28 +1000 Subject: [PATCH] Stabilise flaky assertion on PDF text The PDF reader can't always place text elements in the right place. So something that should be in one line can be in multiple lines and those lines can be in a different order. I'm asserting the moving parts separately as done in other places of this spec. --- spec/system/admin/invoice_print_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/system/admin/invoice_print_spec.rb b/spec/system/admin/invoice_print_spec.rb index 29945bf6a0..a33ab225e1 100644 --- a/spec/system/admin/invoice_print_spec.rb +++ b/spec/system/admin/invoice_print_spec.rb @@ -212,7 +212,9 @@ describe ' end it "displays $0.00 when a line item has no tax" do - expect(page).to have_content "#{Spree::Product.first.name} (1g) 1 $0.00 $12.54" + expect(page).to have_content Spree::Product.first.name + expect(page).to have_content "(1g)" + expect(page).to have_content "1 $0.00 $12.54" end it "displays the taxes correctly" do @@ -343,7 +345,9 @@ describe ' convert_pdf_to_page end it "displays $0.0 when a line item has no tax" do - expect(page).to have_content "#{Spree::Product.first.name} (1g) 1 $0.00 $12.54" + expect(page).to have_content Spree::Product.first.name + expect(page).to have_content "(1g)" + expect(page).to have_content "1 $0.00 $12.54" end it "displays the added tax on the GST colum" do