4 ms·
If you're in the Ruby world, Capybara is a great addon to Cucumber and RSpec. It solves the animation problem by adding a timeout to wait for elements in the DO
by dbalatero 15y ago
If you're in the Ruby world, Capybara is a great addon to Cucumber and RSpec. It solves the animation problem by adding a timeout to wait for elements in the DOM. A step like this:
When I click the link that does a 4000ms animation
I should see "#mydiv"
Capybara will wait for #mydiv to appear for some timeout period (30 seconds). If it appears before then, it keeps going.
This way you can have complex animation and still assert final state of the page. Capybara allows Selenium, headless WebKit, and other JS drivers. It's one line to swap.
If you aren't in the Ruby world, you might at least steal some ideas from that lib to make your Selenium tests better.
Also, you might drop the folks at Pivotal Tracker an email. They have a fat one-page JS-heavy product, and I bet you anything they automatically test it. They might have cool stuff to share.
- schrieaj 15y agoCapybara works pretty well for any web based front end. I'm using it to do some basic automation of websites (scheduling tasks and the like). You write the tests in ruby but honestly it is really simple: http://pastie.org/2476405 http://pastie.org/2476405 is my script for logging in to google voice and sending a text message. If I recall it was simply gem install capybara, a gem install selenium-webdriver and that was it.
- dbalatero 15y agoGood point, I forgot that you could just use it standalone!