selenium-webdriver 3.0.0-beta-1 → 3.0.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 +109 -0
- package/LICENSE +1 -1
- package/README.md +7 -6
- package/chrome.js +31 -128
- package/edge.js +13 -91
- package/example/chrome_android.js +18 -13
- package/example/chrome_mobile_emulation.js +19 -15
- package/example/google_search.js +11 -11
- package/example/google_search_generator.js +23 -18
- package/example/google_search_test.js +31 -17
- package/example/logging.js +9 -17
- package/example/parallel_flows.js +3 -0
- package/firefox/binary.js +17 -0
- package/firefox/index.js +198 -101
- package/firefox/profile.js +24 -3
- package/http/util.js +95 -59
- package/ie.js +6 -10
- package/index.js +636 -2
- package/lib/actions.js +18 -10
- package/lib/atoms/getAttribute.js +11 -0
- package/lib/atoms/isDisplayed.js +106 -0
- package/lib/firefox/amd64/libnoblur64.so +0 -0
- package/lib/firefox/i386/libnoblur.so +0 -0
- package/lib/firefox/webdriver.xpi +0 -0
- package/lib/http.js +159 -46
- package/lib/logging.js +7 -1
- package/lib/promise.js +602 -358
- package/lib/proxy.js +28 -0
- package/lib/session.js +1 -1
- package/lib/test/build.js +26 -28
- package/lib/test/data/formPage.html +1 -0
- package/lib/test/fileserver.js +12 -10
- package/lib/test/httpserver.js +4 -6
- package/lib/test/index.js +18 -11
- package/lib/test/promise.js +79 -0
- package/lib/webdriver.js +587 -479
- package/opera.js +12 -88
- package/package.json +13 -14
- package/phantomjs.js +7 -14
- package/remote/index.js +201 -30
- package/safari.js +62 -416
- package/test/actions_test.js +9 -11
- package/test/chrome/options_test.js +8 -8
- package/test/chrome/service_test.js +2 -2
- package/test/cookie_test.js +57 -57
- package/test/element_finding_test.js +201 -185
- package/test/execute_script_test.js +108 -111
- package/test/fingerprint_test.js +16 -11
- package/test/firefox/firefox_test.js +75 -49
- package/test/firefox/profile_test.js +1 -3
- package/test/http/util_test.js +21 -27
- package/test/io_test.js +2 -5
- package/test/lib/http_test.js +8 -6
- package/test/lib/promise_aplus_test.js +48 -44
- package/test/lib/promise_error_test.js +687 -611
- package/test/lib/promise_flow_test.js +1810 -1806
- package/test/lib/promise_generator_test.js +227 -225
- package/test/lib/promise_test.js +864 -835
- package/test/lib/until_test.js +1 -1
- package/test/lib/webdriver_test.js +520 -424
- package/test/logging_test.js +43 -45
- package/test/net/portprober_test.js +23 -24
- package/test/page_loading_test.js +84 -78
- package/test/phantomjs/execute_phantomjs_test.js +11 -25
- package/test/proxy_test.js +23 -23
- package/test/remote_test.js +22 -22
- package/test/safari_test.js +108 -0
- package/test/session_test.js +11 -10
- package/test/stale_element_test.js +18 -16
- package/test/tag_name_test.js +7 -5
- package/test/testing/assert_test.js +2 -3
- package/test/testing/index_test.js +163 -117
- package/test/upload_test.js +13 -13
- package/test/window_test.js +94 -70
- package/testing/index.js +176 -37
- package/builder.js +0 -553
- package/lib/safari/client.js +0 -56
package/test/http/util_test.js
CHANGED
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const assert = require('assert');
|
|
21
|
+
const http = require('http');
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const error = require('../../lib/error');
|
|
24
|
+
const util = require('../../http/util');
|
|
25
|
+
const promise = require('../../lib/promise');
|
|
25
26
|
|
|
26
27
|
describe('selenium-webdriver/http/util', function() {
|
|
27
28
|
|
|
@@ -123,19 +124,15 @@ describe('selenium-webdriver/http/util', function() {
|
|
|
123
124
|
function() {});
|
|
124
125
|
});
|
|
125
126
|
|
|
126
|
-
it('can cancel wait', function(
|
|
127
|
+
it('can cancel wait', function() {
|
|
127
128
|
status = 1;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
setTimeout(function() {
|
|
137
|
-
isReady.cancel('cancelled!');
|
|
138
|
-
}, 50);
|
|
129
|
+
let cancel = new Promise(resolve => {
|
|
130
|
+
setTimeout(_ => resolve(), 50)
|
|
131
|
+
});
|
|
132
|
+
return util.waitForServer(baseUrl, 200, cancel)
|
|
133
|
+
.then(
|
|
134
|
+
() => { throw Error('Did not expect to succeed!'); },
|
|
135
|
+
(e) => assert.ok(e instanceof promise.CancellationError));
|
|
139
136
|
});
|
|
140
137
|
});
|
|
141
138
|
|
|
@@ -167,18 +164,15 @@ describe('selenium-webdriver/http/util', function() {
|
|
|
167
164
|
});
|
|
168
165
|
});
|
|
169
166
|
|
|
170
|
-
it('can cancel wait', function(
|
|
167
|
+
it('can cancel wait', function() {
|
|
171
168
|
responseCode = 404;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
setTimeout(function() {
|
|
180
|
-
isReady.cancel('cancelled!');
|
|
181
|
-
}, 50);
|
|
169
|
+
let cancel = new Promise(resolve => {
|
|
170
|
+
setTimeout(_ => resolve(), 50);
|
|
171
|
+
});
|
|
172
|
+
return util.waitForUrl(baseUrl, 200, cancel)
|
|
173
|
+
.then(
|
|
174
|
+
() => { throw Error('Did not expect to succeed!'); },
|
|
175
|
+
(e) => assert.ok(e instanceof promise.CancellationError));
|
|
182
176
|
});
|
|
183
177
|
});
|
|
184
178
|
});
|
package/test/io_test.js
CHANGED
|
@@ -22,10 +22,7 @@ var assert = require('assert'),
|
|
|
22
22
|
path = require('path'),
|
|
23
23
|
tmp = require('tmp');
|
|
24
24
|
|
|
25
|
-
var io = require('../io')
|
|
26
|
-
before = require('../testing').before,
|
|
27
|
-
beforeEach = require('../testing').beforeEach,
|
|
28
|
-
it = require('../testing').it;
|
|
25
|
+
var io = require('../io');
|
|
29
26
|
|
|
30
27
|
|
|
31
28
|
describe('io', function() {
|
|
@@ -310,7 +307,7 @@ describe('io', function() {
|
|
|
310
307
|
});
|
|
311
308
|
|
|
312
309
|
it('catches errors from invalid input', function() {
|
|
313
|
-
return io.read(
|
|
310
|
+
return io.read({})
|
|
314
311
|
.then(() => assert.fail('should have failed'),
|
|
315
312
|
(e) => assert.ok(e instanceof TypeError));
|
|
316
313
|
});
|
package/test/lib/http_test.js
CHANGED
|
@@ -84,12 +84,14 @@ describe('http', function() {
|
|
|
84
84
|
|
|
85
85
|
describe('command routing', function() {
|
|
86
86
|
it('rejects unrecognized commands', function() {
|
|
87
|
-
|
|
88
|
-
(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
return executor.execute(new Command('fake-name'))
|
|
88
|
+
.then(assert.fail, err => {
|
|
89
|
+
if (err instanceof error.UnknownCommandError
|
|
90
|
+
&& 'Unrecognized command: fake-name' === err.message) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
throw err;
|
|
94
|
+
})
|
|
93
95
|
});
|
|
94
96
|
|
|
95
97
|
it('rejects promise if client fails to send request', function() {
|
|
@@ -18,57 +18,61 @@
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
20
|
const promise = require('../../lib/promise');
|
|
21
|
+
const {enablePromiseManager} = require('../../lib/test/promise');
|
|
21
22
|
|
|
22
23
|
describe('Promises/A+ Compliance Tests', function() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
enablePromiseManager(() => {
|
|
25
|
+
// The promise spec does not define behavior for unhandled rejections and
|
|
26
|
+
// assumes they are effectively swallowed. This is not the case with our
|
|
27
|
+
// implementation, so we have to disable error propagation to test that the
|
|
28
|
+
// rest of our behavior is compliant.
|
|
29
|
+
// We run the tests with a separate instance of the control flow to ensure
|
|
30
|
+
// disablign error propagation does not impact other tests.
|
|
31
|
+
var flow = new promise.ControlFlow();
|
|
32
|
+
flow.setPropagateUnhandledRejections(false);
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
// Skip the tests in 2.2.6.1/2. We are not compliant in these scenarios.
|
|
35
|
+
var realDescribe = global.describe;
|
|
36
|
+
global.describe = function(name, fn) {
|
|
37
|
+
realDescribe(name, function() {
|
|
38
|
+
var prefix = 'Promises/A+ Compliance Tests '
|
|
39
|
+
+ 'SELENIUM_PROMISE_MANAGER=true 2.2.6: '
|
|
40
|
+
+ '`then` may be called multiple times on the same promise.';
|
|
41
|
+
var suffix = 'even when one handler is added inside another handler';
|
|
42
|
+
if (this.fullTitle().startsWith(prefix)
|
|
43
|
+
&& this.fullTitle().endsWith(suffix)) {
|
|
44
|
+
var realSpecify = global.specify;
|
|
45
|
+
try {
|
|
46
|
+
global.specify = function(name) {
|
|
47
|
+
realSpecify(name);
|
|
48
|
+
};
|
|
49
|
+
fn();
|
|
50
|
+
} finally {
|
|
51
|
+
global.specify = realSpecify;
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
46
54
|
fn();
|
|
47
|
-
} finally {
|
|
48
|
-
global.specify = realSpecify;
|
|
49
55
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
require('promises-aplus-tests').mocha({
|
|
60
|
+
resolved: function(value) {
|
|
61
|
+
return new promise.Promise((fulfill) => fulfill(value), flow);
|
|
62
|
+
},
|
|
63
|
+
rejected: function(error) {
|
|
64
|
+
return new promise.Promise((_, reject) => reject(error), flow);
|
|
65
|
+
},
|
|
66
|
+
deferred: function() {
|
|
67
|
+
var d = new promise.Deferred(flow);
|
|
68
|
+
return {
|
|
69
|
+
resolve: d.fulfill,
|
|
70
|
+
reject: d.reject,
|
|
71
|
+
promise: d.promise
|
|
72
|
+
};
|
|
52
73
|
}
|
|
53
74
|
});
|
|
54
|
-
};
|
|
55
75
|
|
|
56
|
-
|
|
57
|
-
resolved: function(value) {
|
|
58
|
-
return new promise.Promise((fulfill) => fulfill(value), flow);
|
|
59
|
-
},
|
|
60
|
-
rejected: function(error) {
|
|
61
|
-
return new promise.Promise((_, reject) => reject(error), flow);
|
|
62
|
-
},
|
|
63
|
-
deferred: function() {
|
|
64
|
-
var d = new promise.Deferred(flow);
|
|
65
|
-
return {
|
|
66
|
-
resolve: d.fulfill,
|
|
67
|
-
reject: d.reject,
|
|
68
|
-
promise: d.promise
|
|
69
|
-
};
|
|
70
|
-
}
|
|
76
|
+
global.describe = realDescribe;
|
|
71
77
|
});
|
|
72
|
-
|
|
73
|
-
global.describe = realDescribe;
|
|
74
78
|
});
|