selenium-webdriver 4.0.0-alpha.3 → 4.0.0-alpha.4

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.
Files changed (95) hide show
  1. package/CHANGES.md +8 -1
  2. package/LICENSE +202 -0
  3. package/NOTICE +2 -0
  4. package/README.md +0 -0
  5. package/chrome.js +0 -0
  6. package/edge.js +0 -0
  7. package/example/chrome_android.js +0 -0
  8. package/example/chrome_mobile_emulation.js +0 -0
  9. package/example/firefox_channels.js +0 -0
  10. package/example/google_search.js +0 -0
  11. package/example/google_search_test.js +0 -0
  12. package/example/headless.js +0 -0
  13. package/example/logging.js +0 -0
  14. package/firefox.js +20 -3
  15. package/http/index.js +0 -0
  16. package/http/util.js +0 -0
  17. package/ie.js +0 -0
  18. package/index.js +0 -0
  19. package/io/exec.js +0 -0
  20. package/io/index.js +0 -0
  21. package/io/zip.js +0 -0
  22. package/lib/actions.js +0 -0
  23. package/lib/by.js +0 -0
  24. package/lib/capabilities.js +0 -0
  25. package/lib/command.js +0 -0
  26. package/lib/error.js +0 -0
  27. package/lib/http.js +0 -0
  28. package/lib/input.js +0 -0
  29. package/lib/logging.js +0 -0
  30. package/lib/promise.js +0 -0
  31. package/lib/proxy.js +0 -0
  32. package/lib/session.js +0 -0
  33. package/lib/symbols.js +0 -0
  34. package/lib/until.js +0 -0
  35. package/lib/webdriver.js +0 -0
  36. package/net/index.js +0 -0
  37. package/net/portprober.js +0 -0
  38. package/package.json +1 -1
  39. package/proxy.js +0 -0
  40. package/remote/index.js +0 -0
  41. package/safari.js +0 -0
  42. package/testing/index.js +0 -0
  43. package/BUILD.bazel +0 -88
  44. package/jasmine.json +0 -11
  45. package/lib/README +0 -5
  46. package/lib/atoms/BUILD.bazel +0 -28
  47. package/lib/atoms/make-atoms-module.js +0 -12
  48. package/lib/test/bootstrap_jasmine.js +0 -28
  49. package/lib/test/build.js +0 -156
  50. package/lib/test/data/actions/click.html +0 -24
  51. package/lib/test/data/actions/drag.html +0 -77
  52. package/lib/test/data/actions/record_click.html +0 -21
  53. package/lib/test/data/chrome/download.html +0 -2
  54. package/lib/test/data/firefox/webextension.xpi +0 -0
  55. package/lib/test/fileserver.js +0 -337
  56. package/lib/test/httpserver.js +0 -120
  57. package/lib/test/index.js +0 -87
  58. package/lib/test/resources.js +0 -40
  59. package/test/actions_test.js +0 -206
  60. package/test/builder_test.js +0 -106
  61. package/test/chrome/devtools_test.js +0 -93
  62. package/test/chrome/options_test.js +0 -121
  63. package/test/chrome/service_test.js +0 -45
  64. package/test/cookie_test.js +0 -210
  65. package/test/element_finding_test.js +0 -431
  66. package/test/execute_script_test.js +0 -355
  67. package/test/fingerprint_test.js +0 -63
  68. package/test/firefox_test.js +0 -233
  69. package/test/frame_test.js +0 -45
  70. package/test/http/http_test.js +0 -229
  71. package/test/http/util_test.js +0 -178
  72. package/test/io/io_test.js +0 -364
  73. package/test/io/zip_test.js +0 -126
  74. package/test/lib/by_test.js +0 -160
  75. package/test/lib/capabilities_test.js +0 -129
  76. package/test/lib/error_test.js +0 -333
  77. package/test/lib/http_test.js +0 -576
  78. package/test/lib/input_test.js +0 -1379
  79. package/test/lib/logging_test.js +0 -272
  80. package/test/lib/promise_test.js +0 -674
  81. package/test/lib/testutil.js +0 -90
  82. package/test/lib/until_test.js +0 -478
  83. package/test/lib/webdriver_test.js +0 -1692
  84. package/test/logging_test.js +0 -160
  85. package/test/net/index_test.js +0 -60
  86. package/test/net/portprober_test.js +0 -128
  87. package/test/page_loading_test.js +0 -156
  88. package/test/proxy_test.js +0 -167
  89. package/test/rect_test.js +0 -51
  90. package/test/remote_test.js +0 -98
  91. package/test/safari_test.js +0 -44
  92. package/test/stale_element_test.js +0 -60
  93. package/test/upload_test.js +0 -78
  94. package/test/window_test.js +0 -168
  95. package/tools/init_jasmine.js +0 -7
@@ -1,272 +0,0 @@
1
- // Licensed to the Software Freedom Conservancy (SFC) under one
2
- // or more contributor license agreements. See the NOTICE file
3
- // distributed with this work for additional information
4
- // regarding copyright ownership. The SFC licenses this file
5
- // to you under the Apache License, Version 2.0 (the
6
- // "License"); you may not use this file except in compliance
7
- // with the License. You may obtain a copy of the License at
8
- //
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // Unless required by applicable law or agreed to in writing,
12
- // software distributed under the License is distributed on an
13
- // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- // KIND, either express or implied. See the License for the
15
- // specific language governing permissions and limitations
16
- // under the License.
17
-
18
- 'use strict';
19
-
20
- const assert = require('assert');
21
- const sinon = require('sinon');
22
- const logging = require('../../lib/logging');
23
-
24
- describe('logging', function() {
25
- let mgr, root, clock;
26
-
27
- beforeEach(function setUp() {
28
- mgr = new logging.LogManager;
29
- root = mgr.getLogger('');
30
-
31
- clock = sinon.useFakeTimers();
32
- });
33
-
34
- afterEach(function tearDown() {
35
- clock.restore();
36
- });
37
-
38
- describe('LogManager', function() {
39
- describe('getLogger()', function() {
40
- it('handles falsey input', function() {
41
- assert.strictEqual(root, mgr.getLogger());
42
- assert.strictEqual(root, mgr.getLogger(''));
43
- assert.strictEqual(root, mgr.getLogger(null));
44
- assert.strictEqual(root, mgr.getLogger(0));
45
- });
46
-
47
- it('creates parent loggers', function() {
48
- let logger = mgr.getLogger('foo.bar.baz');
49
- assert.strictEqual(logger.parent_, mgr.getLogger('foo.bar'));
50
-
51
- logger = logger.parent_;
52
- assert.strictEqual(logger.parent_, mgr.getLogger('foo'));
53
-
54
- logger = logger.parent_;
55
- assert.strictEqual(logger.parent_, mgr.getLogger(''));
56
-
57
- assert.strictEqual(logger.parent_.parent_, null);
58
- });
59
- });
60
- });
61
-
62
- describe('Logger', function() {
63
- describe('getEffectiveLevel()', function() {
64
- it('defaults to OFF', function() {
65
- assert.strictEqual(root.getLevel(), logging.Level.OFF);
66
- assert.strictEqual(root.getEffectiveLevel(), logging.Level.OFF);
67
-
68
- root.setLevel(null);
69
- assert.strictEqual(root.getLevel(), null);
70
- assert.strictEqual(root.getEffectiveLevel(), logging.Level.OFF);
71
- });
72
-
73
- it('uses own level if set', function() {
74
- let logger = mgr.getLogger('foo.bar.baz');
75
- assert.strictEqual(logger.getLevel(), null);
76
- assert.strictEqual(logger.getEffectiveLevel(), logging.Level.OFF);
77
-
78
- logger.setLevel(logging.Level.INFO);
79
- assert.strictEqual(logger.getLevel(), logging.Level.INFO);
80
- assert.strictEqual(logger.getEffectiveLevel(), logging.Level.INFO);
81
- });
82
-
83
- it('uses level from set on nearest parent', function() {
84
- let ancestor = mgr.getLogger('foo');
85
- ancestor.setLevel(logging.Level.SEVERE);
86
-
87
- let logger = mgr.getLogger('foo.bar.baz');
88
- assert.strictEqual(logger.getLevel(), null);
89
- assert.strictEqual(logger.getEffectiveLevel(), logging.Level.SEVERE);
90
- });
91
- });
92
-
93
- describe('isLoggable()', function() {
94
- it('compares level against logger\'s effective level', function() {
95
- const log1 = mgr.getLogger('foo');
96
- log1.setLevel(logging.Level.WARNING);
97
-
98
- const log2 = mgr.getLogger('foo.bar.baz');
99
-
100
- assert(!log2.isLoggable(logging.Level.FINEST));
101
- assert(!log2.isLoggable(logging.Level.INFO));
102
- assert(log2.isLoggable(logging.Level.WARNING));
103
- assert(log2.isLoggable(logging.Level.SEVERE));
104
-
105
- log2.setLevel(logging.Level.INFO);
106
-
107
- assert(!log2.isLoggable(logging.Level.FINEST));
108
- assert(log2.isLoggable(logging.Level.INFO));
109
- assert(log2.isLoggable(logging.Level.WARNING));
110
- assert(log2.isLoggable(logging.Level.SEVERE));
111
-
112
- log2.setLevel(logging.Level.ALL);
113
-
114
- assert(log2.isLoggable(logging.Level.FINEST));
115
- assert(log2.isLoggable(logging.Level.INFO));
116
- assert(log2.isLoggable(logging.Level.WARNING));
117
- assert(log2.isLoggable(logging.Level.SEVERE));
118
- });
119
-
120
- it('Level.OFF is never loggable', function() {
121
- function test(level) {
122
- root.setLevel(level);
123
- assert(!root.isLoggable(logging.Level.OFF),
124
- 'OFF should not be loggable at ' + level);
125
- }
126
-
127
- test(logging.Level.ALL);
128
- test(logging.Level.INFO);
129
- test(logging.Level.OFF);
130
- });
131
- });
132
-
133
- describe('log()', function() {
134
- it('does not invoke loggable if message is not loggable', function() {
135
- const log = mgr.getLogger('foo');
136
- log.setLevel(logging.Level.OFF);
137
-
138
- let callback = sinon.spy();
139
- log.addHandler(callback);
140
- root.addHandler(callback);
141
-
142
- assert(!callback.called);
143
- });
144
-
145
- it('invokes handlers for each parent logger', function() {
146
- const cb1 = sinon.spy();
147
- const cb2 = sinon.spy();
148
- const cb3 = sinon.spy();
149
- const cb4 = sinon.spy();
150
-
151
- const log1 = mgr.getLogger('foo');
152
- const log2 = mgr.getLogger('foo.bar');
153
- const log3 = mgr.getLogger('foo.bar.baz');
154
- const log4 = mgr.getLogger('foo.bar.baz.quot');
155
-
156
- log1.addHandler(cb1);
157
- log1.setLevel(logging.Level.INFO);
158
-
159
- log2.addHandler(cb2);
160
- log2.setLevel(logging.Level.WARNING);
161
-
162
- log3.addHandler(cb3);
163
- log3.setLevel(logging.Level.FINER);
164
-
165
- clock.tick(123456);
166
-
167
- log4.finest('this is the finest message');
168
- log4.finer('this is a finer message');
169
- log4.info('this is an info message');
170
- log4.warning('this is a warning message');
171
- log4.severe('this is a severe message');
172
-
173
- assert.equal(4, cb1.callCount);
174
- assert.equal(4, cb2.callCount);
175
- assert.equal(4, cb3.callCount);
176
-
177
- const entry1 = new logging.Entry(
178
- logging.Level.FINER,
179
- '[foo.bar.baz.quot] this is a finer message',
180
- 123456);
181
- const entry2 = new logging.Entry(
182
- logging.Level.INFO,
183
- '[foo.bar.baz.quot] this is an info message',
184
- 123456);
185
- const entry3 = new logging.Entry(
186
- logging.Level.WARNING,
187
- '[foo.bar.baz.quot] this is a warning message',
188
- 123456);
189
- const entry4 = new logging.Entry(
190
- logging.Level.SEVERE,
191
- '[foo.bar.baz.quot] this is a severe message',
192
- 123456);
193
-
194
- check(cb1.getCall(0).args[0], entry1);
195
- check(cb1.getCall(1).args[0], entry2);
196
- check(cb1.getCall(2).args[0], entry3);
197
- check(cb1.getCall(3).args[0], entry4);
198
-
199
- check(cb2.getCall(0).args[0], entry1);
200
- check(cb2.getCall(1).args[0], entry2);
201
- check(cb2.getCall(2).args[0], entry3);
202
- check(cb2.getCall(3).args[0], entry4);
203
-
204
- check(cb3.getCall(0).args[0], entry1);
205
- check(cb3.getCall(1).args[0], entry2);
206
- check(cb3.getCall(2).args[0], entry3);
207
- check(cb3.getCall(3).args[0], entry4);
208
-
209
- function check(entry, expected) {
210
- assert.equal(entry.level, expected.level, 'wrong level');
211
- assert.equal(entry.message, expected.message, 'wrong message');
212
- assert.equal(entry.timestamp, expected.timestamp, 'wrong time');
213
- }
214
- });
215
-
216
- it('does not invoke removed handler', function() {
217
- root.setLevel(logging.Level.INFO);
218
- const cb = sinon.spy();
219
-
220
- root.addHandler(cb);
221
- root.info('hi');
222
- assert.equal(1, cb.callCount);
223
-
224
- assert(root.removeHandler(cb));
225
- root.info('bye');
226
- assert.equal(1, cb.callCount);
227
-
228
- assert(!root.removeHandler(cb));
229
- });
230
- });
231
- });
232
-
233
- describe('getLevel()', function() {
234
- it('converts named levels', function() {
235
- assert.strictEqual(logging.Level.DEBUG, logging.getLevel('DEBUG'));
236
- assert.strictEqual(logging.Level.ALL, logging.getLevel('FAKE'));
237
- });
238
-
239
- it('converts numeric levels', function() {
240
- assert.strictEqual(
241
- logging.Level.DEBUG,
242
- logging.getLevel(logging.Level.DEBUG.value));
243
- });
244
-
245
- it('normalizes numeric levels', function() {
246
- assert.strictEqual(
247
- logging.Level.OFF,
248
- logging.getLevel(logging.Level.OFF.value * 2));
249
-
250
- let diff = logging.Level.SEVERE.value - logging.Level.WARNING.value;
251
- assert.strictEqual(
252
- logging.Level.WARNING,
253
- logging.getLevel(logging.Level.WARNING.value + (diff * .5)));
254
-
255
- assert.strictEqual(logging.Level.ALL, logging.getLevel(0));
256
- assert.strictEqual(logging.Level.ALL, logging.getLevel(-1));
257
- });
258
- });
259
-
260
- describe('Preferences', function() {
261
- it('can be converted to JSON', function() {
262
- let prefs = new logging.Preferences;
263
- assert.equal('{}', JSON.stringify(prefs));
264
-
265
- prefs.setLevel('foo', logging.Level.DEBUG);
266
- assert.equal('{"foo":"DEBUG"}', JSON.stringify(prefs));
267
-
268
- prefs.setLevel(logging.Type.BROWSER, logging.Level.FINE);
269
- assert.equal('{"foo":"DEBUG","browser":"FINE"}', JSON.stringify(prefs));
270
- });
271
- });
272
- });