Created
July 7, 2013 23:39
-
-
Save vojtajina/5945394 to your computer and use it in GitHub Desktop.
Protractor proposal... I can run it with:
$ protractor my.conf.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is my TEST... | |
describe('angularjs homepage', function() { | |
beforeEach(function() { | |
navigateTo('http://angularjs.org/'); | |
}); | |
it('should greet', function() { | |
// any css selector | |
element('input[ng-model=yourName]').sendKeys('Julie'); | |
// or APIs, whatever we want | |
element.binding('yourName').click(); | |
// in the same way I can extend Jasmine's matchers (in beforeEach), | |
// I can extend - define my own element DSL | |
element('.something').myCustomClick(); | |
expect(element.binding('Hello {{yourName}}!').text()).toBe('Hello Julie!'); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PSEUDO CODE of protractor | |
// init/config webdriver instance, protractor | |
var config = loadConfigFromFileAndMergeWithCLIargs(); | |
var webdriverInstance = new WebDriverInstance(config); | |
var protractor = new ProtractorInstance(config, webdriverInstance); | |
// expose this single global instance of protractor | |
global.protractor = protractor; | |
// exposing the APIs (optional, I can disable this) | |
global.element = protractor.element; | |
global.navigateTo = protractor.navigateTo; | |
// patch/expose Jasmine APIs to work with promises | |
global.expect = patchExpect(protractor, webdriverInstance, global.expect); | |
// require all the test files and kick off Jasmine run, probably through jasmine-node |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment