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

Commit 681b54a

Browse files
heathkitjuliemr
authored andcommitted
refactor(browser): Remove protractor.wrapDriver() **breaking change** (#3827)
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 d2d2a71 commit 681b54a

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
@@ -977,21 +977,4 @@ export class ProtractorBrowser extends Webdriver {
977977
};
978978
this.debugHelper.init(debuggerClientPath, onStartFn, opt_debugPort);
979979
}
980-
981-
/**
982-
* Create a new instance of Browser by wrapping a webdriver instance.
983-
*
984-
* @param {webdriver.WebDriver} webdriver The configured webdriver instance.
985-
* @param {string=} baseUrl A URL to prepend to relative gets.
986-
* @param {string=} rootElement The css selector for the element which is the
987-
* root of the Angular app.
988-
* @param {boolean=} untrackOutstandingTimeouts Whether Browser should
989-
* stop tracking outstanding $timeouts.
990-
* @returns {Browser} a new Browser instance
991-
*/
992-
static wrapDriver(
993-
webdriver: WebDriver, baseUrl?: string, rootElement?: string,
994-
untrackOutstandingTimeouts?: boolean): ProtractorBrowser {
995-
return new ProtractorBrowser(webdriver, baseUrl, rootElement, untrackOutstandingTimeouts);
996-
}
997980
}

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
@@ -146,7 +146,6 @@ export class Runner extends EventEmitter {
146146
protractor.$$ = browser_.$$;
147147
protractor.element = browser_.element;
148148
protractor.by = protractor.By = ProtractorBrowser.By;
149-
protractor.wrapDriver = ProtractorBrowser.wrapDriver;
150149
protractor.ExpectedConditions = browser_.ExpectedConditions;
151150

152151
if (!this.config_.noGlobals) {
@@ -187,7 +186,7 @@ export class Runner extends EventEmitter {
187186
let config = this.config_;
188187
let driver = this.driverprovider_.getNewDriver();
189188

190-
let browser_ = ProtractorBrowser.wrapDriver(
189+
let browser_ = new ProtractorBrowser(
191190
driver, config.baseUrl, config.rootElement, config.untrackOutstandingTimeouts);
192191

193192
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)