jasmine BDD framework
selenium webdriver
angular locator scripts
sugar and glue!
jasmine choreographs test execution flow
WebDriverJS API is invoked within test specs
it('should add a todo',function(){
ptor.get('http://todomvc.com').then(function(){
ptor.findElement(protractor.By.model('newTodo')).then(function(el){
el.sendKeys('first test item\n');
});
});
});
it('should open browser',function(){
ptor.get('http://todomvc.com/architecture-examples/angularjs');
});
it('should add a todo',function(){
ptor.findElement(protractor.By.model('newTodo')).then(function(el){
el.sendKeys('first test item\n');
});
});
it('should open browser',function(done){ ptor.get('http://todomvc.com/architecture-examples/angularjs')
.then(done); }); it('should add a todo',function(done){ ptor.findElement(protractor.By.model('newTodo')).then(function(el){
el.sendKeys('first test item\n') .then(done);
}); });
it('should open in a browser',function(){
browser.get('http://todomvc.com/architecture-examples/angularjs');
});
it('should add a todo',function(){
element(by.model('newTodo')).sendKeys('first test item\n');
});
enhanced by protractor to implicitly wait for execution flow to complete!
uses wrapInControlFlow() internally to wrap both it() and describe()
instantiates and wraps WebDriverJS instance for us
use this for low level browser config and interaction
accepts a locator and returns an Element Finder object
Element Finder objects allows us to lazy query the DOM
locator script that returns a Web Element by its ng-model attribute
ensures the digest cycle is complete before we query the DOM
uses waitForAngular under the covers
enhanced to accept accept WebDriverJS promises!