1

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
Mary
  • 109
  • 10
  • To the best of my knowledge, using the button's unique id should be adequate. Can you please put the code for the button in your question? – Joe Essey May 12 '15 at 18:42
  • I think I figured it out. I actually thought the acceptance test was written with Cucumber but it was actually Turnip. Everything makes a lot more sense now! Thanks. – Mary May 12 '15 at 19:36

0 Answers0