We are using RF + Browser library for our Angular (15) based application. Works great, but when running tests from our Azure DevOps pipeline, we experience on average 3 random tests out of 90 which fail. We can’t reproduce this when running tests from our local machines.
Based on the screenshots I think that these fails might be caused by the Javascript not having finished execution. I was wondering if there is something like ‘Wait until network is idle’, but then not for network traffic, but for javascript execution.
Other suggestions / best practices for using RF with Angular are welcome. I wouldn’t like switching to the AngularJs library however, because we like what we have with the Browser library very much.
If that doesn’t work, take note of an element that only exist after the javascript is finished and then use Wait For Elements State with a state of attached or visible on that element.
We are currently using ‘Wait until network is idle’, but I’ll add additional ones in locations that might be critical. I will also add element state validations.
I was wondering however whether there would be something like ‘Wait until Script Idle’. We have quite a complex Angular framework with a lot of nested components, observables etc. So it’s difficult I guess to find an element that we can use as a definition of ‘script has finished’.
I’ve seen this post before I created mine. However, according to the documentation this is related to the loading of the page. At least that’s how I interpreted it. I will try it anyway.
Adding the additional checks for element state and network idle unfortunately didn’t end up with success.
FYI, document is the javascript object for the current page in the browser, readyState is a property of the document which gives you the page status, when it reaches "complete" then all the javascript’s are supposed to be finished executing including all the ones that are triggered by onLoad. "loaded" is the readyState value when all the html has been loaded and parsed, this is the state that triggers all the onLoad javascript functions.
So if you waited for the page to reach "complete" and the element is not there, then it might not get loaded till you interact with the page somehow (mouse over another element?)
If the site is publicly accessable and you can tell me which element you need I can have a look for you if you like.
We’ve been trying out different ways to cope with our challenges. It boils down to that we seem to have a stability issue in the application when starting. In over 95% of the tests everything works out fine, but sometimes the application just doesn’t load when opened from a test that runs on a (Linux) build agent in a DevOps pipeline.
if it’s unstable in Browser on Linux, it will be unstable for all browsers and all OS’s, because it’s the web browser doing the page rendering not Robot Framework.