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(protractor/runner): allow multiple browser in test
- Loading branch information
Showing
21 changed files
with
504 additions
and
239 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* This is a base driver provider class. | ||
* It is responsible for setting up the account object, tearing | ||
* it down, and setting up the driver correctly. | ||
*/ | ||
|
||
var webdriver = require('selenium-webdriver'), | ||
q = require('q'); | ||
|
||
var DriverProvider = function(config) { | ||
this.config_ = config; | ||
this.drivers_ = []; | ||
}; | ||
|
||
/** | ||
* Teardown and destroy the environment and do any associated cleanup. | ||
* Shuts down the drivers. | ||
* | ||
* @public | ||
* @return {q.promise} A promise which will resolve when the environment | ||
* is down. | ||
*/ | ||
DriverProvider.prototype.teardownEnv = function() { | ||
var deferredArray = this.drivers_.map(function(driver) { | ||
var deferred = q.defer(); | ||
driver.getSession().then(function(session_) { | ||
if (session_) { | ||
driver.quit().then(function() { | ||
deferred.resolve(); | ||
}); | ||
} else { | ||
deferred.resolve(); | ||
} | ||
}); | ||
return deferred.promise; | ||
}); | ||
return q.all(deferredArray); | ||
}; | ||
|
||
/** | ||
* Create a new driver. | ||
* | ||
* @public | ||
* @return webdriver instance | ||
*/ | ||
DriverProvider.prototype.getNewDriver = function() { | ||
var newDriver = new webdriver.Builder(). | ||
usingServer(this.config_.seleniumAddress). | ||
withCapabilities(this.config_.capabilities). | ||
build(); | ||
this.drivers_.push(newDriver); | ||
return newDriver; | ||
}; | ||
|
||
module.exports = DriverProvider; |
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
Oops, something went wrong.