Skip to content

Commit

Permalink
Extract row helpers form promotions and products
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Nov 27, 2023
1 parent 6f6f44c commit b013fdc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion admin/spec/features/products_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
create(:product, name: "Another product", price: 29.99)

visit "/admin/products"
find('main tbody tr:nth-child(2)').find('input').check
select_row("Just a product")
click_button "Delete"

expect(page).to have_content("Products were successfully removed.", wait: 5)
Expand Down
12 changes: 12 additions & 0 deletions admin/spec/support/solidus_admin/feature_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,17 @@ def stub_authorization!(user)
allow_any_instance_of(SolidusAdmin::BaseController).to receive(:current_ability).and_return(ability)
allow_any_instance_of(Spree::Admin::BaseController).to receive(:current_ability).and_return(ability)
end

def find_row(text)
find('table tbody tr', text: text)
end

def find_row_checkbox(text)
find_row(text).find('td:first-child input[type="checkbox"]')
end

def select_row(text)
find_row_checkbox(text).check
end
end
end

0 comments on commit b013fdc

Please sign in to comment.