selenium-webdriver 3.3.0 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +273 -0
- package/NOTICE +1 -1
- package/README.md +28 -36
- package/chrome.js +221 -146
- package/edge.js +43 -118
- package/example/chrome_android.js +8 -9
- package/example/chrome_mobile_emulation.js +9 -10
- package/example/firefox_channels.js +23 -19
- package/example/google_search.js +3 -3
- package/example/google_search_test.js +39 -27
- package/example/headless.js +55 -0
- package/example/logging.js +40 -7
- package/firefox.js +769 -0
- package/http/index.js +41 -4
- package/http/util.js +11 -6
- package/ie.js +57 -98
- package/index.js +182 -115
- package/io/index.js +59 -0
- package/io/zip.js +214 -0
- package/jasmine.json +11 -0
- package/lib/actions.js +68 -63
- package/lib/atoms/get-attribute.js +9 -0
- package/lib/atoms/is-displayed.js +73 -78
- package/lib/by.js +9 -1
- package/lib/capabilities.js +303 -201
- package/lib/command.js +28 -50
- package/lib/error.js +113 -42
- package/lib/http.js +167 -135
- package/lib/input.js +1044 -8
- package/lib/promise.js +222 -3331
- package/lib/proxy.js +134 -39
- package/lib/test/bootstrap_jasmine.js +28 -0
- package/lib/test/data/actions/click.html +24 -0
- package/lib/test/data/actions/drag.html +77 -0
- package/lib/test/data/actions/record_click.html +21 -0
- package/lib/test/data/chrome/download.html +2 -0
- package/lib/test/data/click_tests/disabled_element.html +12 -0
- package/lib/test/data/content-editable.html +10 -0
- package/lib/test/data/firefox/webextension.xpi +0 -0
- package/lib/test/data/inputs.html +42 -0
- package/lib/test/data/key_logger.html +34 -0
- package/lib/test/data/nestedElements.html +10 -1
- package/lib/test/data/scrolling_tests/page_with_partially_hidden_element.html +14 -0
- package/lib/test/data/selectPage.html +12 -0
- package/lib/test/data/simpleTest.html +5 -0
- package/lib/test/data/single_text_input.html +12 -0
- package/lib/test/data/upload_invisible.html +45 -0
- package/lib/test/fileserver.js +23 -19
- package/lib/test/index.js +30 -244
- package/lib/test/resources.js +0 -1
- package/lib/webdriver.js +770 -939
- package/net/index.js +21 -25
- package/net/portprober.js +51 -68
- package/package.json +6 -4
- package/remote/index.js +18 -30
- package/safari.js +42 -129
- package/test/actions_test.js +173 -18
- package/test/builder_test.js +106 -0
- package/test/chrome/devtools_test.js +93 -0
- package/test/chrome/options_test.js +48 -154
- package/test/chrome/service_test.js +7 -7
- package/test/cookie_test.js +77 -63
- package/test/element_finding_test.js +206 -201
- package/test/execute_script_test.js +115 -114
- package/test/fingerprint_test.js +16 -15
- package/test/firefox_test.js +251 -0
- package/test/http/http_test.js +18 -1
- package/test/http/util_test.js +2 -2
- package/test/{io_test.js → io/io_test.js} +40 -1
- package/test/io/zip_test.js +127 -0
- package/test/lib/by_test.js +21 -0
- package/test/lib/error_test.js +55 -8
- package/test/lib/http_test.js +18 -130
- package/test/lib/input_test.js +1379 -0
- package/test/lib/promise_test.js +473 -908
- package/test/lib/webdriver_test.js +357 -825
- package/test/logging_test.js +37 -43
- package/test/page_loading_test.js +70 -86
- package/test/proxy_test.js +64 -72
- package/test/rect_test.js +14 -25
- package/test/remote_test.js +13 -32
- package/test/safari_test.js +7 -71
- package/test/stale_element_test.js +20 -23
- package/test/tag_name_test.js +10 -9
- package/test/upload_test.js +27 -35
- package/test/window_test.js +72 -85
- package/testing/index.js +386 -315
- package/.npmignore +0 -2
- package/example/async_await_test.js +0 -68
- package/example/google_search_generator.js +0 -50
- package/example/parallel_flows.js +0 -54
- package/firefox/binary.js +0 -344
- package/firefox/extension.js +0 -187
- package/firefox/index.js +0 -722
- package/firefox/profile.js +0 -430
- package/lib/atoms/getAttribute.js +0 -12
- package/lib/events.js +0 -210
- package/lib/firefox/webdriver.json +0 -70
- package/lib/firefox/webdriver.xpi +0 -0
- package/lib/test/data/firefox/jetpack-sample.xpi +0 -0
- package/lib/test/data/firefox/sample.xpi +0 -0
- package/lib/test/promise.js +0 -79
- package/opera.js +0 -405
- package/phantomjs.js +0 -282
- package/test/firefox/extension_test.js +0 -96
- package/test/firefox/firefox_test.js +0 -226
- package/test/firefox/profile_test.js +0 -185
- package/test/lib/events_test.js +0 -177
- package/test/lib/promise_aplus_test.js +0 -78
- package/test/lib/promise_error_test.js +0 -884
- package/test/lib/promise_flow_test.js +0 -2288
- package/test/lib/promise_generator_test.js +0 -310
- package/test/phantomjs/execute_phantomjs_test.js +0 -59
- package/test/session_test.js +0 -54
- package/test/testing/assert_test.js +0 -373
- package/test/testing/index_test.js +0 -224
- package/testing/assert.js +0 -378
|
@@ -17,226 +17,227 @@
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const assert = require('assert');
|
|
21
|
+
const {fail} = require('assert');
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
By = webdriver.By,
|
|
25
|
-
assert = require('../testing/assert'),
|
|
26
|
-
test = require('../lib/test');
|
|
23
|
+
const {Browser, By, WebElement} = require('..');
|
|
24
|
+
const {Pages, ignore, suite} = require('../lib/test');
|
|
27
25
|
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
suite(function(env) {
|
|
30
28
|
var driver;
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
driver =
|
|
30
|
+
before(async function() {
|
|
31
|
+
driver = await env.builder().build();
|
|
34
32
|
});
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
after(function() {
|
|
37
35
|
return driver.quit();
|
|
38
36
|
});
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
return driver.get(
|
|
38
|
+
beforeEach(function() {
|
|
39
|
+
return driver.get(Pages.echoPage);
|
|
42
40
|
});
|
|
43
41
|
|
|
44
42
|
describe('executeScript;', function() {
|
|
45
43
|
var shouldHaveFailed = new Error('Should have failed');
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
it('fails if script throws', function() {
|
|
48
46
|
return execute('throw new Error("boom")')
|
|
49
47
|
.then(function() { throw shouldHaveFailed; })
|
|
50
48
|
.catch(function(e) {
|
|
51
49
|
// The java WebDriver server adds a bunch of crap to error messages.
|
|
52
50
|
// Error message will just be "JavaScript error" for IE.
|
|
53
|
-
assert
|
|
51
|
+
assert.ok(
|
|
52
|
+
/.*(JavaScript error|boom).*/.test(e.message),
|
|
53
|
+
`Unexpected error: ${e.message}`);
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
it('fails if script does not parse', function() {
|
|
58
58
|
return execute('throw function\\*')
|
|
59
59
|
.then(function() { throw shouldHaveFailed; })
|
|
60
60
|
.catch(function(e) {
|
|
61
|
-
assert(e
|
|
61
|
+
assert.notEqual(e, shouldHaveFailed);
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
describe('scripts;', function() {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
it('do not pollute the global scope', async function() {
|
|
67
|
+
await execute('var x = 1;');
|
|
68
|
+
assert.equal(await execute('return typeof x;'), 'undefined');
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
it('can set global variables', async function() {
|
|
72
|
+
await execute('window.x = 1234;');
|
|
73
|
+
assert.equal(await execute('return x;'), 1234);
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
let result =
|
|
76
|
+
it('may be defined as a function expression', async function() {
|
|
77
|
+
let result = await execute(function() {
|
|
78
78
|
return 1234 + 'abc';
|
|
79
79
|
});
|
|
80
|
-
assert(result
|
|
80
|
+
assert.equal(result, '1234abc');
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
describe('return values;', function() {
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
it('returns undefined as null', async function() {
|
|
87
|
+
assert.strictEqual(await execute('var x; return x;'), null);
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
it('can return null', async function() {
|
|
91
|
+
assert.strictEqual(await execute('return null;'), null);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
it('can return numbers', async function() {
|
|
95
|
+
assert.equal(await execute('return 1234'), 1234);
|
|
96
|
+
assert.equal(await execute('return 3.1456'), 3.1456);
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
it('can return strings', async function() {
|
|
100
|
+
assert.equal(await execute('return "hello"'), 'hello');
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
it('can return booleans', async function() {
|
|
104
|
+
assert.equal(await execute('return true'), true);
|
|
105
|
+
assert.equal(await execute('return false'), false);
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
it('can return an array of primitives', function() {
|
|
109
109
|
return execute('var x; return [1, false, null, 3.14, x]')
|
|
110
110
|
.then(verifyJson([1, false, null, 3.14, null]));
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
it('can return nested arrays', function() {
|
|
114
114
|
return execute('return [[1, 2, [3]]]').then(verifyJson([[1, 2, [3]]]));
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
ignore(env.browsers(Browser.IE)).
|
|
118
118
|
it('can return empty object literal', function() {
|
|
119
119
|
return execute('return {}').then(verifyJson({}));
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
it('can return object literals', function() {
|
|
123
123
|
return execute('return {a: 1, b: false, c: null}').then(result => {
|
|
124
124
|
verifyJson(['a', 'b', 'c'])(Object.keys(result).sort());
|
|
125
|
-
assert(result.a
|
|
126
|
-
assert(result.b
|
|
127
|
-
assert(result.c)
|
|
125
|
+
assert.equal(result.a, 1);
|
|
126
|
+
assert.equal(result.b, false);
|
|
127
|
+
assert.strictEqual(result.c, null);
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
it('can return complex object literals', function() {
|
|
132
132
|
return execute('return {a:{b: "hello"}}')
|
|
133
133
|
.then(verifyJson({a:{b: 'hello'}}));
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
it('can return dom elements as web elements', async function() {
|
|
137
137
|
let result =
|
|
138
|
-
|
|
139
|
-
assert(result
|
|
138
|
+
await execute('return document.querySelector(".header.host")');
|
|
139
|
+
assert.ok(result instanceof WebElement);
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
let text = await result.getText();
|
|
142
|
+
assert.ok(text.startsWith('host: '), `got: ${text}`);
|
|
142
143
|
});
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
let result =
|
|
145
|
+
it('can return array of dom elements', async function() {
|
|
146
|
+
let result = await execute(
|
|
146
147
|
'var nodes = document.querySelectorAll(".request,.host");' +
|
|
147
148
|
'return [nodes[0], nodes[1]];');
|
|
148
|
-
assert(result.length
|
|
149
|
+
assert.equal(result.length, 2);
|
|
149
150
|
|
|
150
|
-
assert(result[0]
|
|
151
|
-
|
|
151
|
+
assert.ok(result[0] instanceof WebElement);
|
|
152
|
+
assert.ok((await result[0].getText()).startsWith('GET '));;
|
|
152
153
|
|
|
153
|
-
assert(result[1]
|
|
154
|
-
|
|
154
|
+
assert.ok(result[1] instanceof WebElement);
|
|
155
|
+
assert.ok((await result[1].getText()).startsWith('host: '));;
|
|
155
156
|
});
|
|
156
157
|
|
|
157
|
-
|
|
158
|
+
it('can return a NodeList as an array of web elements', async function() {
|
|
158
159
|
let result =
|
|
159
|
-
|
|
160
|
+
await execute('return document.querySelectorAll(".request,.host");')
|
|
160
161
|
|
|
161
|
-
assert(result.length
|
|
162
|
+
assert.equal(result.length, 2);
|
|
162
163
|
|
|
163
|
-
assert(result[0]
|
|
164
|
-
|
|
164
|
+
assert.ok(result[0] instanceof WebElement);
|
|
165
|
+
assert.ok((await result[0].getText()).startsWith('GET '));;
|
|
165
166
|
|
|
166
|
-
assert(result[1]
|
|
167
|
-
|
|
167
|
+
assert.ok(result[1] instanceof WebElement);
|
|
168
|
+
assert.ok((await result[1].getText()).startsWith('host: '));;
|
|
168
169
|
});
|
|
169
170
|
|
|
170
|
-
|
|
171
|
-
let result =
|
|
171
|
+
it('can return object literal with element property', async function() {
|
|
172
|
+
let result = await execute('return {a: document.body}');
|
|
172
173
|
|
|
173
|
-
assert(result.a
|
|
174
|
-
|
|
174
|
+
assert.ok(result.a instanceof WebElement);
|
|
175
|
+
assert.equal(await result.a.getTagName(), 'body');
|
|
175
176
|
});
|
|
176
177
|
});
|
|
177
178
|
|
|
178
179
|
describe('parameters;', function() {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
it('can pass numeric arguments', async function() {
|
|
181
|
+
assert.equal(await execute('return arguments[0]', 12), 12);
|
|
182
|
+
assert.equal(await execute('return arguments[0]', 3.14), 3.14);
|
|
182
183
|
});
|
|
183
184
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
it('can pass boolean arguments', async function() {
|
|
186
|
+
assert.equal(await execute('return arguments[0]', true), true);
|
|
187
|
+
assert.equal(await execute('return arguments[0]', false), false);
|
|
187
188
|
});
|
|
188
189
|
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
it('can pass string arguments', async function() {
|
|
191
|
+
assert.equal(await execute('return arguments[0]', 'hi'), 'hi');
|
|
191
192
|
});
|
|
192
193
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
it('can pass null arguments', async function() {
|
|
195
|
+
assert.equal(await execute('return arguments[0] === null', null), true);
|
|
196
|
+
assert.equal(await execute('return arguments[0]', null), null);
|
|
196
197
|
});
|
|
197
198
|
|
|
198
|
-
|
|
199
|
+
it('passes undefined as a null argument', async function() {
|
|
199
200
|
var x;
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
assert.equal(await execute('return arguments[0] === null', x), true);
|
|
202
|
+
assert.equal(await execute('return arguments[0]', x), null);
|
|
202
203
|
});
|
|
203
204
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
it('can pass multiple arguments', async function() {
|
|
206
|
+
assert.equal(await execute('return arguments.length'), 0);
|
|
207
|
+
assert.equal(await execute('return arguments.length', 1, 'a', false), 3);
|
|
207
208
|
});
|
|
208
209
|
|
|
209
|
-
|
|
210
|
-
it('can return arguments object as array', function
|
|
211
|
-
let val =
|
|
210
|
+
ignore(env.browsers(Browser.FIREFOX, Browser.SAFARI)).
|
|
211
|
+
it('can return arguments object as array', async function() {
|
|
212
|
+
let val = await execute('return arguments', 1, 'a', false);
|
|
212
213
|
|
|
213
|
-
assert(val.length
|
|
214
|
-
assert(val[0]
|
|
215
|
-
assert(val[1]
|
|
216
|
-
assert(val[2]
|
|
214
|
+
assert.equal(val.length, 3);
|
|
215
|
+
assert.equal(val[0], 1);
|
|
216
|
+
assert.equal(val[1], 'a');
|
|
217
|
+
assert.equal(val[2], false);
|
|
217
218
|
});
|
|
218
219
|
|
|
219
|
-
|
|
220
|
-
let result =
|
|
220
|
+
it('can pass object literal', async function() {
|
|
221
|
+
let result = await execute(
|
|
221
222
|
'return [typeof arguments[0], arguments[0].a]', {a: 'hello'})
|
|
222
|
-
assert(result[0]
|
|
223
|
-
assert(result[1]
|
|
223
|
+
assert.equal(result[0], 'object');
|
|
224
|
+
assert.equal(result[1], 'hello');
|
|
224
225
|
});
|
|
225
226
|
|
|
226
|
-
|
|
227
|
-
let el =
|
|
227
|
+
it('WebElement arguments are passed as DOM elements', async function() {
|
|
228
|
+
let el = await driver.findElement(By.tagName('div'));
|
|
228
229
|
let result =
|
|
229
|
-
|
|
230
|
-
assert(result
|
|
230
|
+
await execute('return arguments[0].tagName.toLowerCase();', el);
|
|
231
|
+
assert.equal(result, 'div');
|
|
231
232
|
});
|
|
232
233
|
|
|
233
|
-
|
|
234
|
-
let result =
|
|
235
|
-
assert(result.length
|
|
236
|
-
assert(result[0].color
|
|
234
|
+
it('can pass array containing object literals', async function() {
|
|
235
|
+
let result = await execute('return arguments[0]', [{color: "red"}]);
|
|
236
|
+
assert.equal(result.length, 1);
|
|
237
|
+
assert.equal(result[0].color, 'red');
|
|
237
238
|
});
|
|
238
239
|
|
|
239
|
-
|
|
240
|
+
it('does not modify object literal parameters', function() {
|
|
240
241
|
var input = {color: 'red'};
|
|
241
242
|
return execute('return arguments[0];', input).then(verifyJson(input));
|
|
242
243
|
});
|
|
@@ -245,7 +246,7 @@ test.suite(function(env) {
|
|
|
245
246
|
// See https://code.google.com/p/selenium/issues/detail?id=8223.
|
|
246
247
|
describe('issue 8223;', function() {
|
|
247
248
|
describe('using for..in loops;', function() {
|
|
248
|
-
|
|
249
|
+
it('can return array built from for-loop index', function() {
|
|
249
250
|
return execute(function() {
|
|
250
251
|
var ret = [];
|
|
251
252
|
for (var i = 0; i < 3; i++) {
|
|
@@ -255,7 +256,7 @@ test.suite(function(env) {
|
|
|
255
256
|
}).then(verifyJson[0, 1, 2]);
|
|
256
257
|
});
|
|
257
258
|
|
|
258
|
-
|
|
259
|
+
it('can copy input array contents', function() {
|
|
259
260
|
return execute(function(input) {
|
|
260
261
|
var ret = [];
|
|
261
262
|
for (var i in input) {
|
|
@@ -265,7 +266,7 @@ test.suite(function(env) {
|
|
|
265
266
|
}, ['fa', 'fe', 'fi']).then(verifyJson(['fa', 'fe', 'fi']));
|
|
266
267
|
});
|
|
267
268
|
|
|
268
|
-
|
|
269
|
+
it('can iterate over input object keys', function() {
|
|
269
270
|
return execute(function(thing) {
|
|
270
271
|
var ret = [];
|
|
271
272
|
for (var w in thing.words) {
|
|
@@ -277,7 +278,7 @@ test.suite(function(env) {
|
|
|
277
278
|
});
|
|
278
279
|
|
|
279
280
|
describe('recursive functions;', function() {
|
|
280
|
-
|
|
281
|
+
it('can build array from input', function() {
|
|
281
282
|
var input = ['fa', 'fe', 'fi'];
|
|
282
283
|
return execute(function(thearray) {
|
|
283
284
|
var ret = [];
|
|
@@ -290,7 +291,7 @@ test.suite(function(env) {
|
|
|
290
291
|
}, input).then(verifyJson(input));
|
|
291
292
|
});
|
|
292
293
|
|
|
293
|
-
|
|
294
|
+
it('can build array from elements in object', function() {
|
|
294
295
|
var input = {words: [{word: 'fa'}, {word: 'fe'}, {word: 'fi'}]};
|
|
295
296
|
return execute(function(thing) {
|
|
296
297
|
var ret = [];
|
|
@@ -313,19 +314,19 @@ test.suite(function(env) {
|
|
|
313
314
|
var TOO_LONG_WAIT = TIMEOUT_IN_MS * 10;
|
|
314
315
|
|
|
315
316
|
before(function() {
|
|
316
|
-
return driver.manage().
|
|
317
|
+
return driver.manage().setTimeouts({script: TIMEOUT_IN_MS});
|
|
317
318
|
});
|
|
318
319
|
|
|
319
|
-
|
|
320
|
+
it('does not fail if script execute in time', function() {
|
|
320
321
|
return executeTimeOutScript(ACCEPTABLE_WAIT);
|
|
321
322
|
});
|
|
322
323
|
|
|
323
|
-
|
|
324
|
+
it('fails if script took too long', function() {
|
|
324
325
|
return executeTimeOutScript(TOO_LONG_WAIT)
|
|
325
326
|
.then(function() {
|
|
326
327
|
fail('it should have timed out');
|
|
327
328
|
}).catch(function(e) {
|
|
328
|
-
assert(e.name
|
|
329
|
+
assert.equal(e.name, 'ScriptTimeoutError');
|
|
329
330
|
});
|
|
330
331
|
});
|
|
331
332
|
|
|
@@ -340,7 +341,7 @@ test.suite(function(env) {
|
|
|
340
341
|
|
|
341
342
|
function verifyJson(expected) {
|
|
342
343
|
return function(actual) {
|
|
343
|
-
|
|
344
|
+
assert.equal(JSON.stringify(actual), JSON.stringify(expected));
|
|
344
345
|
};
|
|
345
346
|
}
|
|
346
347
|
|
package/test/fingerprint_test.js
CHANGED
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const assert = require('assert');
|
|
21
|
+
|
|
22
|
+
const test = require('../lib/test');
|
|
23
|
+
const Pages = test.Pages;
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
test.suite(function(env) {
|
|
@@ -35,26 +36,26 @@ test.suite(function(env) {
|
|
|
35
36
|
});
|
|
36
37
|
|
|
37
38
|
describe('fingerprinting', function() {
|
|
38
|
-
test.it('it should fingerprint the navigator object', function
|
|
39
|
-
|
|
39
|
+
test.it('it should fingerprint the navigator object', async function() {
|
|
40
|
+
await driver.get(Pages.simpleTestPage);
|
|
40
41
|
|
|
41
|
-
let wd =
|
|
42
|
-
assert(wd
|
|
42
|
+
let wd = await driver.executeScript('return navigator.webdriver');
|
|
43
|
+
assert.strictEqual(wd, true);
|
|
43
44
|
});
|
|
44
45
|
|
|
45
|
-
test.it('fingerprint must not be writable', function
|
|
46
|
-
|
|
46
|
+
test.it('fingerprint must not be writable', async function() {
|
|
47
|
+
await driver.get(Pages.simpleTestPage);
|
|
47
48
|
|
|
48
|
-
let wd =
|
|
49
|
+
let wd = await driver.executeScript(
|
|
49
50
|
'navigator.webdriver = "ohai"; return navigator.webdriver');
|
|
50
|
-
assert(wd
|
|
51
|
+
assert.strictEqual(wd, true);
|
|
51
52
|
});
|
|
52
53
|
|
|
53
|
-
test.it('leaves fingerprint on svg pages', function
|
|
54
|
-
|
|
54
|
+
test.it('leaves fingerprint on svg pages', async function() {
|
|
55
|
+
await driver.get(Pages.svgPage);
|
|
55
56
|
|
|
56
|
-
let wd =
|
|
57
|
-
assert(wd
|
|
57
|
+
let wd = await driver.executeScript('return navigator.webdriver');
|
|
58
|
+
assert.strictEqual(wd, true);
|
|
58
59
|
});
|
|
59
60
|
});
|
|
60
61
|
|