This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a 'debug' function to protractor. This schedules a debugger pause
within the webdriver control flow.
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Examples of tests to show how debugging works with Protractor. Tests | ||
// should be run against the testapp. | ||
|
||
exports.config = { | ||
seleniumAddress: 'http://localhost:4444/wd/hub', | ||
|
||
// Spec patterns are relative to the current working directly when | ||
// protractor is called. | ||
specs: [ | ||
'debugging/failure_spec.js', | ||
], | ||
|
||
capabilities: { | ||
'browserName': 'chrome' | ||
}, | ||
|
||
baseUrl: 'http://localhost:8000', | ||
|
||
// ----- Options to be passed to minijasminenode. | ||
jasmineNodeOpts: { | ||
onComplete: null, | ||
isVerbose: false, | ||
showColors: true, | ||
includeStackTrace: true | ||
} | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var webdriver = require('selenium-webdriver'); | ||
|
||
|
||
describe('modes of failure', function() { | ||
ptor = protractor.getInstance(); | ||
|
||
it('should fail to find a non-existent element', function() { | ||
ptor.get('app/index.html#/form'); | ||
|
||
// Run this statement before the line which fails. If protractor is run | ||
// with the debugger (protractor debug debugging/conf.js), the test | ||
// will pause after loading the webpage but before trying to find the | ||
// element. | ||
ptor.debugger(); | ||
|
||
// This element doesn't exist, so this fails. | ||
var nonExistant = ptor.findElement(protractor.By.binding('nopenopenope')); | ||
}); | ||
|
||
it('should fail to use protractor on a non-Angular site', function() { | ||
ptor.get('http://www.google.com'); | ||
}); | ||
|
||
it('should fail an assertion', function() { | ||
ptor.get('app/index.html#/form'); | ||
|
||
var greeting = ptor.findElement(protractor.By.binding('{{greeting}}')); | ||
|
||
expect(greeting.getText()).toEqual('This is not what it equals'); | ||
}); | ||
}); |
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