So I have an application which holds multiple entries that are strings of comma separated emails. The strings live in text area elements where they can be modified. The application uses JavaScript to modify these strings, I need to use Capybara to watch verify that a target string has the correct number of emails in it. To illustrate what I mean here's my Cucumber (assuming the target list starts with a 5 email string):
When I remove the 3rd email under list one
Then I should see 4 emails under list one
When I click the "Cancel" button for list one
Then I should see 5 emails under list one
I can pretty easily grab the string with Capybara like so:
expect(page).to have_css(".css-selectors textarea")
but I don't know what to do from there. I need to be able to assert that the number of emails in the string is in fact changing to the desired number. I need to split the string and count the number of emails to see if they match the target number, but everything I've tried leads to a race condition where Capybara checks the value before the JS can finish updating. I've looked into passing a filter block to the have_css call but I can't find documentation on how that would work, or if it's even the right tactic. And so I'm out of ideas here.
Aucun commentaire:
Enregistrer un commentaire