Last active
August 29, 2015 14:17
-
-
Save MSakamaki/370181fca3e21d95cf7e to your computer and use it in GitHub Desktop.
protractor memo
##browser.pause();
でのデバッギング
画面を止めたいときに使う。
Ctrl+C
で止める。
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
describe('Protractor Demo App', function() {
it('should add one and two', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
element(by.model('first')).sendKeys(3);
element(by.model('second')).sendKeys(2);
browser.pause();
element(by.id('gobutton')).click();
expect(element(by.binding('latest')).getText()).
toEqual('5');
});
});
protractor debug conf.js
node debuggerを使い、デバッグする。
細やかなデバッグで使用する。
### protractor config.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
describe('Protractor Demo App', function() {
it('should add one and two', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
element(by.model('first')).sendKeys(3);
element(by.model('second')).sendKeys(2);
browser.debugger();
element(by.id('gobutton')).click();
expect(element(by.binding('latest')).getText()).
toEqual('5'); // This is wrong!
});
});
protractor debug conf.js
- cont, c - Continue execution
- next, n - Step next
- step, s - Step in
- out, o - Step out
- pause - Pause running code (like pause button in Developer Tools)
この状態では、Ctrl+C
で抜ける事が出来る。
##node-inspector
を使ったGUIデバッギング
webdriver-manager start
node-inspector
Access Node inspector http://127.0.0.1:8080/debug?port=5858
node --debug-brk `which protractor` conf.js
// conf.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
}
describe('Protractor Demo App', function() {
it('should add one and two', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
element(by.model('first')).sendKeys(3);
element(by.model('second')).sendKeys(2);
debugger;
element(by.id('gobutton')).click();
expect(element(by.binding('latest')).getText()).
toEqual('5');
});
});
npm -g install elementor
This file contains 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
describe('Protractor Demo App', function() { | |
it('should add one and two', function() { | |
browser.get('http://juliemr.github.io/protractor-demo/'); | |
element(by.model('first')).sendKeys(3); | |
element(by.model('second')).sendKeys(2); | |
browser.debugger(); | |
browser.pause(5859); | |
debugger; | |
element(by.id('gobutton')).click(); | |
browser.debugger(); | |
expect(element(by.binding('latest')).getText()).toEqual('5'); // This is wrong! | |
}); | |
it('non angular site', function(){ | |
browser.driver.get('http://www.yahoo.co.jp/'); | |
browser.driver.sleep(3000); | |
browser.driver.findElement(by.name('p')).sendKeys('protractor'); | |
browser.driver.findElement(by.id('srchbtn')).click(); | |
browser.driver.sleep(5000); | |
// duty huck for protractor option browser.ignoreSynchronization = true | |
// see: http://ng-learn.org/2014/02/Protractor_Testing_With_Angular_And_Non_Angular_Sites/ | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment