I'm working with someone else's acceptance tests and I don't quite understand how they work. On the page I have two buttons with the value 'Update' so I'm getting an ambiguity error.
Scenario: Update
When I fill in "line_items__quantity" with "3"
And I click "Update"
Then page should have content "Your cart has been updated"
And "Example Product" should have quantity "3"
I'd like to make it so that the logic goes
And I click "Update" within :some_div
or
And I click "update-with-coupon-code"
update-with-coupon-code being the button's id.
I just can't figure out the proper syntax to do this. Do I need to do something inside of the steps to make this work? I haven't worked with acceptance tests before. Are there any tutorials that anyone recommends for me to get a better understanding of how they work?
Thanks!
Edit: Code for button (Slim)
First Update button: div.cart-buttons - [:update, :empty].each do |button| = order_form.button value: button = t button
Second Update button:
section.coupon
h3 = t(:cart_coupon_code)
- if @order.has_coupon_code?
= order_form.text_field :coupon_code, disabled: true
- else
= order_form.text_field :coupon_code, placeholder: t(:coupon_code)
= order_form.button value: :update_with_coupon_code
= t :update