I have the following typical cucumber steps in a Rails 3.1 project:
...
When I follow "Remove from cart"
Then I should see "Test Product removed from cart"
The difficulty is that "Remove from cart" button is an ajax :remote call, which returns "Test Product removed from cart" to the #cart_notice element via:
$('#cart_notice').append("<%= @product.name %> removed from cart");
The function works fine in the browser, but doesn't find the "Test Product removed from cart" text in cucumber. I'm guessing this is because Cucumber is searching for the text before the AJAX returns it?
So, in short...how do I ensure cucumber waits for the ajax to return a result before searching for the desired content?