Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 48b2a97

Browse files
committed
refactor(browser): Remove protractor.wrapDriver()
This is a **breaking change**. Before: Users could create their own selenium driver instance and enable Protractor on it like so: ```js let capabilities = webdriver.Capabilities.chrome(); let driver = new webdriver.Builder().usingServer(seleniumAddress) .withCapabilities(capabilities).build(); let browser = protractor.wrapDriver(driver); ``` Over the years, wrapDriver() has become increasingly broken as Protractor needs extra configuration options that wrapDriver() doesn't set. After: This method is removed. If users need a new browser instance, they can use `browser.forkNewDriverInstance()`.
1 parent 329c32e commit 48b2a97

File tree

6 files changed

+1
-33
lines changed

6 files changed

+1
-33
lines changed

lib/browser.ts

-17
Original file line numberDiff line numberDiff line change
@@ -955,21 +955,4 @@ export class ProtractorBrowser extends Webdriver {
955955
};
956956
this.debugHelper.init(debuggerClientPath, onStartFn, opt_debugPort);
957957
}
958-
959-
/**
960-
* Create a new instance of Browser by wrapping a webdriver instance.
961-
*
962-
* @param {webdriver.WebDriver} webdriver The configured webdriver instance.
963-
* @param {string=} baseUrl A URL to prepend to relative gets.
964-
* @param {string=} rootElement The css selector for the element which is the
965-
* root of the Angular app.
966-
* @param {boolean=} untrackOutstandingTimeouts Whether Browser should
967-
* stop tracking outstanding $timeouts.
968-
* @returns {Browser} a new Browser instance
969-
*/
970-
static wrapDriver(
971-
webdriver: WebDriver, baseUrl?: string, rootElement?: string,
972-
untrackOutstandingTimeouts?: boolean): ProtractorBrowser {
973-
return new ProtractorBrowser(webdriver, baseUrl, rootElement, untrackOutstandingTimeouts);
974-
}
975958
}

lib/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ export {ProtractorExpectedConditions} from './expectedConditions';
1515
export {ProtractorBy} from './locators';
1616
export {Ptor} from './ptor';
1717

18-
export let wrapDriver = ProtractorBrowser.wrapDriver;
19-
2018
export let utils = {
2119
firefox: require('selenium-webdriver/firefox'),
2220
http: require('selenium-webdriver/http'),

lib/runner.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ export class Runner extends EventEmitter {
166166
protractor.$$ = browser_.$$;
167167
protractor.element = browser_.element;
168168
protractor.by = protractor.By = ProtractorBrowser.By;
169-
protractor.wrapDriver = ProtractorBrowser.wrapDriver;
170169
protractor.ExpectedConditions = browser_.ExpectedConditions;
171170

172171
if (!this.config_.noGlobals) {
@@ -207,7 +206,7 @@ export class Runner extends EventEmitter {
207206
var config = this.config_;
208207
var driver = this.driverprovider_.getNewDriver();
209208

210-
var browser_ = ProtractorBrowser.wrapDriver(
209+
var browser_ = new ProtractorBrowser(
211210
driver, config.baseUrl, config.rootElement, config.untrackOutstandingTimeouts);
212211

213212
browser_.params = config.params;

spec/basic/lib_spec.js

-6
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@ describe('protractor library', function() {
110110
toEqual('repeater');
111111
});
112112

113-
it('should allow self-wrapped webdriver instances', function() {
114-
var driver = protractor.wrapDriver(browser.driver);
115-
var url = require('url').resolve(browser.baseUrl, 'index.html');
116-
driver.get(url);
117-
});
118-
119113
describe('helper functions', function() {
120114
it('should get the absolute URL', function() {
121115
browser.get('index.html');

spec/dependencyTest/protractor_spec.js

-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ describe('require(\'protractor\')', () => {
3636
});
3737

3838
describe('browser class', () => {
39-
it('should have static method defined', () => {
40-
var staticMethod = 'wrapDriver';
41-
expect(typeof protractor.ProtractorBrowser['wrapDriver']).toEqual('function');
42-
});
43-
4439
it('should have static variables defined', () => {
4540
var staticVariables = ['By'];
4641
for (var pos in staticVariables) {

spec/install/typescript_spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ describe('typescript imports', () => {
88
expect(protractor.$ === $).toBeTruthy();
99
expect(protractor.$$ === $$).toBeTruthy();
1010
expect(protractor.ExpectedConditions === ExpectedConditions).toBeTruthy();
11-
expect(typeof protractor.wrapDriver).toEqual('function');
1211
});
1312
it('should have selenium-webdriver components for the protractor namespace', () => {
1413
expect(typeof protractor.promise.all).toEqual('function');

0 commit comments

Comments
 (0)