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.
feat(runner): allow onPrepare functions to return a promise
If onPrepare is a function which returns a promise (or a file which exports a promise), the test runner will now wait for that promise to be fulfilled before starting tests.
- Loading branch information
Showing
8 changed files
with
64 additions
and
13 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
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
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
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
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
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,5 @@ | ||
var q = require('q'); | ||
|
||
module.exports = q.fcall(function() { | ||
browser.params.password = '12345'; | ||
}).delay(1000); |
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,23 @@ | ||
// Configuration using a function in onPrepare to set a parameter before | ||
// testing. | ||
var env = require('./environment.js'); | ||
var q = require('q'); | ||
|
||
// The main suite of Protractor tests. | ||
exports.config = { | ||
seleniumAddress: env.seleniumAddress, | ||
|
||
specs: [ | ||
'onPrepare/*_spec.js' | ||
], | ||
|
||
capabilities: env.capabilities, | ||
|
||
baseUrl: env.baseUrl, | ||
|
||
onPrepare: function() { | ||
return q.fcall(function() { | ||
browser.params.password = '12345'; | ||
}).delay(1000); | ||
} | ||
}; |
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,18 @@ | ||
var env = require('./environment.js'); | ||
|
||
// Configuration using a string in onPrepare to load a file with code to | ||
// execute once before tests. | ||
exports.config = { | ||
seleniumAddress: env.seleniumAddress, | ||
|
||
// Spec patterns are relative to this directory. | ||
specs: [ | ||
'onPrepare/*_spec.js' | ||
], | ||
|
||
capabilities: env.capabilities, | ||
|
||
baseUrl: env.baseUrl, | ||
|
||
onPrepare: 'onPrepare/asyncstartup.js' | ||
}; |
953faf7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!! i got rid of an ugly hack thanks to this!!!