Sha256: 84daf76044bc01f5e5f0b5d7c39875e8068453fddcf38781d54f8b97af49dc69

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 Bytes

Contents

def update_cart
  if Harpiya.version.to_f < 4.1
    click_button 'update-button'
  else
    page.execute_script("$('form#update-cart').submit()")
  end
end

def cart_container
  if Harpiya.version.to_f < 4.1
    find_all("#cart-detail tbody tr:first-child").first
  else
    find_all("#cart-detail .shopping-cart-item").first
  end
end

def add_to_cart(product)
  visit harpiya.product_path(product)

  expect(page).to have_selector('form#add-to-cart-form')
  expect(page).to have_selector(:button, id: 'add-to-cart-button', disabled: false)

  yield if block_given?

  click_button 'add-to-cart-button'

  if Harpiya.version.to_f < 4.1
    wait_for_condition do
      expect(page).to have_content(Harpiya.t(:cart))
    end
  else
    expect(page).to have_content(Harpiya.t(:added_to_cart))
    visit harpiya.cart_path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
harpiya_dev_tools-0.1.8 lib/harpiya_dev_tools/rspec/support/harpiya_cart.rb