1
votes

Right now I am using Robot Framework + Selenium2Library for UI Automation. We are going to migrate our UI to AngularJS 2.0 once it is released to market.

So any idea about compatibility of Robot Framework + Selenium2Library with AngularJS 2.0?

4
Have a look at github.com/Selenium2Library/robotframework-angularjs , it may solve your problem.E.Z.

4 Answers

2
votes

I had been using selenium2library with robot framework for some web applications, as soon as we started working on an application with angularJs, selenium2library presented some problems like locating elements and determining when angular has finished loading. I did some digging and found out extended selenium2library which was intended with AnugularJs support. So this library, has keywords like "Wait Until Angular Ready" and as such which made writing test cases as easy as it was before with robot framework and selenium2library keywords.

2
votes

So any idea about compatibility of Robot Framework + Selenium2Library with AngularJS 2.0?

I dare to say - you should not face any significant problems.

In my current project I use RF for a system employing React.js, which - again, "I dare to say" :), is even more extreme, does crazy stuff on the DOM with no direct feedback mechanism to WebDriver - and I haven't any real issues so far. A couple of advices from my experience so far:

  • Do rely heavily on the Selenium2Library keywords "Wait Until Element *" (is visible, contrains, etc). They poll the DOM every 200ms and will give your keywords and tests the execution pacing - will continue once the UI reacts and updates according to the operation. Plus, they are timebound and will fail the test case if the SUT does not act according to the expectations, within the time limit - and, this gives you out-of-the-box the verification your kw and/or testcase actually does what you expect of them (which naturally is a must in every automated system :)

  • I use mainly xpath as location strategy (though personally prefer css), esp. after reading some horror stories of how css fails to match elements after update, etc. The performance difference is negligible - non-existent in the basic tests I did, yet xpath gives you other benefits - go up the tree, locating elements by text value ([contains(text(), "text_placeholder")] has saved me numerous times with the messed-up <div> madness of react); others, which I can'tell recall just now :).

Hope this helps a bit - you, or anyone else, RF + SE = auto-beast :)

0
votes

Robot Framework + Selenium2Library is pretty much independent from the framework used to build your UI. It should work as long as you app is web based and provides some way to locate your elements (ids, css, xpath etc.). So, yes, you will be able to do test automation via UI with AngularJS 2.0

0
votes

I have a different strategy for Robot Framework + AngularJS, but it's only useful because our Robot Framework code runs in the background on a Linux VM, so speed isn't important. I use a custom keyword called Slow Down used as follows:

Click Element   ${THIS_ELEMENT}
    Slow Down   ${SLOW_TIME}

By putting this after every single click and text entry (before every click would work, too), I'm able to tell the entire test to slow down to match the speed of the browser with a single variable. I've found that this is even more reliable than Wait Until Element * keywords when paired with Selenium2LibraryExtended. No, I don't know why that is.