From 881da0f9ac8665bd3e46fbbebc803276551ee1c2 Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Fri, 10 May 2024 04:05:29 +0500 Subject: [PATCH] 11058: add get_all_input_values --- spec/system/admin/products_v3/products_spec.rb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 5f332407bb..1cddd3d42c 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -34,11 +34,8 @@ describe 'As an enterprise user, I can manage my products', feature: :admin_styl it "Should sort products alphabetically by default in ascending order" do within products_table do - # Gather input values, because page.content doesn't include them. - input_content = page.find_all('input[type=text]').map(&:value).join - # Products are in correct order. - expect(input_content).to match /Apples.*Bananas/ + expect(all_input_values).to match /Apples.*Bananas/ end end @@ -50,16 +47,12 @@ describe 'As an enterprise user, I can manage my products', feature: :admin_styl # Sort in descending order name_header.click expect(page).to have_content("Name ▼") # this indicates the re-sorted content has loaded - - input_content = page.find_all('input[type=text]').map(&:value).join - expect(input_content).to match /Bananas.*Apples/ + expect(all_input_values).to match /Bananas.*Apples/ # Sort in ascending order name_header.click expect(page).to have_content("Name ▲") # this indicates the re-sorted content has loaded - - input_content = page.find_all('input[type=text]').map(&:value).join - expect(input_content).to match /Apples.*Bananas/ + expect(all_input_values).to match /Apples.*Bananas/ end end end @@ -1199,4 +1192,8 @@ describe 'As an enterprise user, I can manage my products', feature: :admin_styl Spree::TaxCategory .pluck(:name).sample end + + def all_input_values + page.find_all('input[type=text]').map(&:value).join + end end