I have experienced a lot of issues with UI testing with Vaadin and Selenium. The test cases might seem to run OK initially but turn out very easily to be unstable, especially if the machine running tests is much faster/slower than the machine the tests have been written. The setups I have used contains some version of selenium, Robot framework, jBehave or CasperJS and PhantomJS, Chrome or Firefox. I haven't used the Vaadin Testbench. Here are my five cents to create stable Vaadin UI tests.
- Don't use the in-built "is page loaded" methods, those rarely apply to single page JS apps.
- Use the JS object "vaadin" and its properties isActive() and initialized to determine when it is OK to modify the UI.
- Run in production mode, I have had a lot fewer issues like this.
- Capture the browser logs, filter out there all info category messages and see if there are errors.
- Use xpaths to find the correct elements. I have noticed that it helps if you wait first for some upper element and after that check that if the target element has appeared, so something like waitVisibity(//root-of-target) and then waitAndManipulate(//root-of-target/.../target) .
- Sometimes the client<->server communication just breaks, especially with PhantomJS. I have no good solution for this, I just usually just refresh the page.
- If you update the UI multiple times after the view has initially loaded and use WebSockets, doing manipulations during that time will most probably cause random issues. Wait until all data is pushed to the UI. The isActive() method may help but usually is too slow to keep up.
Comments
Post a Comment