Reputation: 1039
I'm working on getting some acceptance tests to work with Capybara. The main parts of the application leverage Polymer. There are some key parts of the application that require the test to wait for the Polymer library and the application code to load. Is there a Polymer centric way to wait for Polymer and the application to load. I currently am using sleep statements, but this is really bloating the test run times.
Upvotes: 0
Views: 751
Reputation: 49890
It appears that polymers FOUC prevention uses an 'unresolved' attribute on the body, that gets removed once polymer has finished initializing the elements. If you have put that attribute on the body then
expect(page).not_to have_selector('body[unresolved]')
would wait for polymer to finish loading
Another way would be to add a listener for the WebComponentsReady event to your code that sets a data-attribute on the body element when fired and then have Capybara find for the body with that attribute.
Upvotes: 0
Reputation: 2698
I think you should listen to the WebComponentsReady
event, it's fired when all the Polymer elements are loaded.
https://github.com/webcomponents/webcomponentsjs#webcomponentsready
Upvotes: 1