Skip to content

Commit acbdeee

Browse files
committed
[js] Remove meaningless Safari options
Fixes #4965
1 parent 1ae127f commit acbdeee

File tree

3 files changed

+5
-97
lines changed

3 files changed

+5
-97
lines changed

javascript/node/selenium-webdriver/CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ mode.
7272
* Changes to `firefox.Options`
7373
- Removed setLoggingPreferences (was a no-op)
7474
* Changes to `safari.Options`
75+
- Removed setCleanSession (was a no-op)
7576
- Removed setLoggingPreferences (was a no-op)
77+
- Removed setProxy (was a no-op)
7678
* Changes to `lib/error`:
7779
- Added
7880
- ElementClickInterceptedError

javascript/node/selenium-webdriver/safari.js

+3-40
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ class Options {
8888
constructor() {
8989
/** @private {Object<string, *>} */
9090
this.options_ = null;
91-
92-
/** @private {?./lib/proxy.Config} */
93-
this.proxy_ = null;
9491
}
9592

9693
/**
@@ -100,49 +97,18 @@ class Options {
10097
* @return {!Options} The SafariDriver options.
10198
*/
10299
static fromCapabilities(capabilities) {
103-
var options = new Options();
104-
var o = capabilities.get(OPTIONS_CAPABILITY_KEY);
100+
let options = new Options();
101+
let o = capabilities.get(OPTIONS_CAPABILITY_KEY);
105102

106103
if (o instanceof Options) {
107104
options = o;
108105
} else if (o) {
109-
options.setCleanSession(o.cleanSession);
110106
options.setTechnologyPreview(o[TECHNOLOGY_PREVIEW_OPTIONS_KEY]);
111107
}
112108

113-
if (capabilities.has(Capability.PROXY)) {
114-
options.setProxy(capabilities.get(Capability.PROXY));
115-
}
116-
117109
return options;
118110
}
119111

120-
/**
121-
* Sets whether to force Safari to start with a clean session. Enabling this
122-
* option will cause all global browser data to be deleted.
123-
* @param {boolean} clean Whether to make sure the session has no cookies,
124-
* cache entries, local storage, or databases.
125-
* @return {!Options} A self reference.
126-
*/
127-
setCleanSession(clean) {
128-
if (!this.options_) {
129-
this.options_ = {};
130-
}
131-
this.options_['cleanSession'] = clean;
132-
return this;
133-
}
134-
135-
/**
136-
* Sets the proxy to use.
137-
*
138-
* @param {./lib/proxy.Config} proxy The proxy configuration to use.
139-
* @return {!Options} A self reference.
140-
*/
141-
setProxy(proxy) {
142-
this.proxy_ = proxy;
143-
return this;
144-
}
145-
146112
/**
147113
* Instruct the SafariDriver to use the Safari Technology Preview if true.
148114
* Otherwise, use the release version of Safari. Defaults to using the release version of Safari.
@@ -166,10 +132,7 @@ class Options {
166132
* @return {!Capabilities} The capabilities.
167133
*/
168134
toCapabilities(opt_capabilities) {
169-
var caps = opt_capabilities || Capabilities.safari();
170-
if (this.proxy_) {
171-
caps.set(Capability.PROXY, this.proxy_);
172-
}
135+
let caps = opt_capabilities || Capabilities.safari();
173136
if (this.options_) {
174137
caps.set(OPTIONS_CAPABILITY_KEY, this);
175138
}

javascript/node/selenium-webdriver/test/safari_test.js

-57
Original file line numberDiff line numberDiff line change
@@ -19,68 +19,11 @@
1919

2020
const assert = require('assert');
2121

22-
const proxy = require('../proxy');
2322
const safari = require('../safari');
2423
const test = require('../lib/test');
2524
const webdriver = require('..');
2625

2726

28-
describe('safari.Options', function() {
29-
describe('fromCapabilities', function() {
30-
it('returns a new Options instance if none were defined', function() {
31-
let options = safari.Options.fromCapabilities(
32-
new webdriver.Capabilities());
33-
assert(options instanceof safari.Options);
34-
});
35-
36-
it('returns the options instance if present', function() {
37-
let options = new safari.Options().setCleanSession(true),
38-
caps = options.toCapabilities();
39-
assert.equal(safari.Options.fromCapabilities(caps), options);
40-
});
41-
42-
it('extracts supported WebDriver capabilities', function() {
43-
let proxyPrefs = proxy.direct(),
44-
caps = webdriver.Capabilities.chrome()
45-
.set(webdriver.Capability.PROXY, proxyPrefs);
46-
47-
let options = safari.Options.fromCapabilities(caps);
48-
assert.equal(options.proxy_, proxyPrefs);
49-
});
50-
});
51-
52-
describe('toCapabilities', function() {
53-
let options;
54-
55-
before(function() {
56-
options = new safari.Options()
57-
.setCleanSession(true);
58-
});
59-
60-
it('returns a new capabilities object if one is not provided', function() {
61-
let caps = options.toCapabilities();
62-
assert(caps instanceof webdriver.Capabilities);
63-
assert.equal(caps.get('browserName'), 'safari');
64-
assert.equal(caps.get('safari.options'), options);
65-
});
66-
67-
it('adds to input capabilities object', function() {
68-
let caps = webdriver.Capabilities.safari();
69-
assert.equal(options.toCapabilities(caps), caps);
70-
assert.equal(caps.get('safari.options'), options);
71-
});
72-
73-
it('sets generic driver capabilities', function() {
74-
let proxyPrefs = proxy.direct();
75-
76-
options.setProxy(proxyPrefs);
77-
78-
let caps = options.toCapabilities();
79-
assert.equal(caps.get('proxy'), proxyPrefs);
80-
});
81-
});
82-
});
83-
8427
test.suite(function(env) {
8528
describe('safaridriver', function() {
8629
let service;

0 commit comments

Comments
 (0)