@camperaid/watest 2.3.3 → 2.3.7
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/package.json +1 -1
- package/tests/e2e/samples/folder/node_modules/.package-lock.json +1 -1
- package/tests/e2e/samples/folder/package-lock.json +1 -1
- package/tests/e2e/samples/loader/node_modules/.package-lock.json +1 -1
- package/tests/e2e/samples/loader/package-lock.json +1 -1
- package/tests/e2e/samples/loader_mixed/node_modules/.package-lock.json +1 -1
- package/tests/e2e/samples/loader_mixed/package-lock.json +1 -1
- package/tests/e2e/samples/loader_multiple/node_modules/.package-lock.json +1 -1
- package/tests/e2e/samples/loader_multiple/package-lock.json +1 -1
- package/tests/e2e/samples/single/node_modules/.package-lock.json +1 -1
- package/tests/e2e/samples/single/package-lock.json +1 -1
- package/tests/e2e/samples/wd_mixed/node_modules/.package-lock.json +1 -1
- package/tests/e2e/samples/wd_mixed/package-lock.json +1 -1
- package/tests/e2e/samples/wd_single/node_modules/.package-lock.json +1 -1
- package/tests/e2e/samples/wd_single/package-lock.json +1 -1
- package/tests/webdriver/t_app_driver.js +2 -2
- package/webdriver/app_driver.js +12 -2
- package/webdriver/driver.js +36 -6
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@ module.exports.test = do_self_tests(snippet, async session => {
|
|
|
25
25
|
`Test: Input is shown. Selector: '#input'`,
|
|
26
26
|
`Ok: '#input' has to be unique, got: 1`,
|
|
27
27
|
`Ok: Input is shown`,
|
|
28
|
-
`Action: Input.type into Type hello`,
|
|
28
|
+
`Action: Input.type 'hello' into Type hello`,
|
|
29
29
|
`Test: Focus. Selector: '#input'`,
|
|
30
30
|
`Ok: '#input' has to be unique, got: 1`,
|
|
31
31
|
`Ok: Focus`,
|
|
@@ -47,7 +47,7 @@ module.exports.test = do_self_tests(snippet, async session => {
|
|
|
47
47
|
`Test: Input is shown. Selector: '#input'`,
|
|
48
48
|
`Ok: '#input' has to be unique, got: 1`,
|
|
49
49
|
`Ok: Input is shown`,
|
|
50
|
-
`Action: Input.type into Type hello`,
|
|
50
|
+
`Action: Input.type 'hello' into Type hello`,
|
|
51
51
|
`Test: Focus. Selector: '#input'`,
|
|
52
52
|
`Ok: '#input' has to be unique, got: 1`,
|
|
53
53
|
`Ok: Focus`,
|
package/webdriver/app_driver.js
CHANGED
|
@@ -73,7 +73,7 @@ class AppDriver {
|
|
|
73
73
|
|
|
74
74
|
type(selector, value, field) {
|
|
75
75
|
return this.chain(() =>
|
|
76
|
-
this.action(`${this.uiname}.type into ${field}`)
|
|
76
|
+
this.action(`${this.uiname}.type '${value}' into ${field}`)
|
|
77
77
|
.sendKeys(selector, '', `Focus`)
|
|
78
78
|
.elementFocused(selector, 'Focused')
|
|
79
79
|
.selectAll(selector, `Select all text`)
|
|
@@ -82,6 +82,14 @@ class AppDriver {
|
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
clear(selector, field) {
|
|
86
|
+
return this.chain(() =>
|
|
87
|
+
this.action(`${this.uiname}.clear ${field}`)
|
|
88
|
+
.clear(selector, `Clear text`)
|
|
89
|
+
.textIs(selector, '', `Check ${field} text`)
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
85
93
|
setValue(selector, value, field) {
|
|
86
94
|
return this.chain(() =>
|
|
87
95
|
this.action(`${this.uiname}.setValue for ${field}`)
|
|
@@ -112,7 +120,9 @@ class AppDriver {
|
|
|
112
120
|
// Returns a name for the tested class. Typically the name convension for
|
|
113
121
|
// UI drivers is a test class name postixed by Driver.
|
|
114
122
|
get uiname() {
|
|
115
|
-
|
|
123
|
+
let o = this;
|
|
124
|
+
while ((o = Object.getPrototypeOf(o)) && o.constructor.name == '');
|
|
125
|
+
return o.constructor.name.replace(/Driver$/, '');
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
defineSelectors(context, selectors) {
|
package/webdriver/driver.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { By, Condition, Key, until } = require('selenium-webdriver');
|
|
4
4
|
|
|
5
5
|
const { test_is, test_contains, is, contains, ok } = require('../core/base.js');
|
|
6
|
-
const { assert } = require('../core/core.js');
|
|
6
|
+
const { assert, fail } = require('../core/core.js');
|
|
7
7
|
const { is_mac, stringify, toDataURL } = require('../core/util.js');
|
|
8
8
|
const { log } = require('../logging/logging.js');
|
|
9
9
|
const { getTimeout, DriverBase } = require('./driver_base.js');
|
|
@@ -187,6 +187,29 @@ class Driver extends DriverBase {
|
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Waits untils an element defined by a selector has attribute of a given value.
|
|
192
|
+
*/
|
|
193
|
+
attributeIsAll(selector, attr, values, msg) {
|
|
194
|
+
assert(selector, `attributeIsAll: no selector`);
|
|
195
|
+
assert(attr, `attributeIsAll: no attr`);
|
|
196
|
+
assert(values, `attributeIsAll: no values`);
|
|
197
|
+
assert(msg, `attributeIsAll: no msg`);
|
|
198
|
+
|
|
199
|
+
return this.matchAttributeAll({
|
|
200
|
+
selector,
|
|
201
|
+
attr,
|
|
202
|
+
values,
|
|
203
|
+
msg,
|
|
204
|
+
test: got =>
|
|
205
|
+
test_is(
|
|
206
|
+
got,
|
|
207
|
+
values.map(value => got => got == value)
|
|
208
|
+
),
|
|
209
|
+
expected_stringified: stringify(values),
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
190
213
|
/**
|
|
191
214
|
* Waits untils an element defined by a selector has attribute of a given value.
|
|
192
215
|
*/
|
|
@@ -316,9 +339,9 @@ class Driver extends DriverBase {
|
|
|
316
339
|
* Checks elements text whether it matches the given text.
|
|
317
340
|
*/
|
|
318
341
|
textIsAll(selector, text, msg) {
|
|
319
|
-
assert(selector, `
|
|
320
|
-
assert(text instanceof Array, `
|
|
321
|
-
assert(msg, `
|
|
342
|
+
assert(selector, `textIsAll: no selector`);
|
|
343
|
+
assert(text instanceof Array, `textIsAll: no text`);
|
|
344
|
+
assert(msg, `textIsAll: no msg`);
|
|
322
345
|
|
|
323
346
|
return this.matchTextAll({
|
|
324
347
|
selector,
|
|
@@ -789,7 +812,7 @@ class Driver extends DriverBase {
|
|
|
789
812
|
|
|
790
813
|
// ctlr+A doens't work OS X in Chrome.
|
|
791
814
|
let script = `
|
|
792
|
-
let el = document.querySelector(
|
|
815
|
+
let el = document.querySelector(\`${selector}\`);
|
|
793
816
|
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
794
817
|
el.select();
|
|
795
818
|
}
|
|
@@ -800,7 +823,14 @@ else {
|
|
|
800
823
|
window.getSelection().addRange(r);
|
|
801
824
|
}
|
|
802
825
|
`;
|
|
803
|
-
return this.run(
|
|
826
|
+
return this.run(
|
|
827
|
+
() =>
|
|
828
|
+
this.dvr.executeScript(script).catch(e => {
|
|
829
|
+
fail(`Failed to execute selectAll script: ${script}`);
|
|
830
|
+
throw e;
|
|
831
|
+
}),
|
|
832
|
+
msg
|
|
833
|
+
);
|
|
804
834
|
}
|
|
805
835
|
|
|
806
836
|
/**
|