Protractor seems to be the buzzword these days for automating Web pages built with Angular JS. Are there any other frameworks other than Protractor specifically built for testing Angular web apps?
3 Answers
I suppose you can look at tools that were not created specifically for Angular but convenient for Angular web apps testing. I've tried to use TestCafe for testing Angular web apps to compare it with Protractor and it was comfortable. TestCafe api has Selectors, it helps to create useful page model for Angular web apps tests.
For example, you call replace this code in Protractor test
var user = element(by.model("user"));
user.getAttribute('value').then(function (value) {
console.log(value);
});
with this TestCafe test code
const user = Selector('[ng-model=user]');
console.log(await user.value);
Or create angular-specific page model object:
const byModel = model => Selector(`[ng-model=${model}]`);
const page = {
user: byModel('user')
}
console.log(await page.user.value);
I've posted this example just to show that not Angular-based testing tools can be useful for testing Angular apps.
UPDATE: Now TestCafe Team provides Selector extensions that make it easier to test Angular applications with TestCafe. These extensions allow you to create a Selector to find elements on the page in a way that is native to Angular applications.
Technically, NO. Protractor specific is, that protractor is synchronizing with the Angular app, so you do not need to implement waiting for each command and Protractor uses some of the Angular features.
On the other hand, you can test Angular apps by any testing framework as Angular app is yet another one web application. So whatever tool for web will succeed. You then would need to implement functions like waitTillElementIsPresent()
.