Skip to content

Commit

Permalink
11058: add get_all_input_values
Browse files Browse the repository at this point in the history
  • Loading branch information
chahmedejaz committed May 9, 2024
1 parent b5fe19c commit 881da0f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions spec/system/admin/products_v3/products_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@

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

Expand All @@ -50,16 +47,12 @@
# 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
Expand Down Expand Up @@ -1199,4 +1192,8 @@ def random_tax_category
Spree::TaxCategory
.pluck(:name).sample
end

def all_input_values
page.find_all('input[type=text]').map(&:value).join
end
end

0 comments on commit 881da0f

Please sign in to comment.