Protractor intro to automate angularJS apps
These days, most of the web development uses angularJS library for it’s light weight and ease of use, protractor become popular to do end to end testing for angularJS apps.
Protractor is a node.js program built on top of WebDriverJS (selenium web driver in Java script). that simulates user actions on browser.
- Extending web driver features -Supports all features of selenium web driver and extending itself to support for angularJS.
- Auto synchronisation – no need of automatic waiting for user actions, so we need not to explicitly add waits to our test.
- Installation is quite straight forward (by use of npm command)
- Several IDEs to write protractor tests – Atom, Visual Studio code, Eclipse, Sublime text etc
- Protractor uses Jasmine or Mocha framework for syntax (popular framework used to test java script)
- can be used to test both angular and non-angular based applications
Protractor programming language
Protractor tests can be written in java script or typescript.
Promises and control flow
As we discussed, protractor is based on WebDriverJS which is using promises,
let test = element.all(by.css('.default__item')).then(elems => elems.click());
With out promise
let test = element.all(by.css('.default__item'));
For more information about protractor with jasmine model – follow protractor style guide
For more information on protractor, follow protractor api
Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!