webdriverio 5.11.11 → 5.11.12
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/build/commands/browser/$$.js +0 -42
- package/build/commands/browser/$.js +0 -42
- package/build/commands/browser/call.js +0 -38
- package/build/commands/browser/debug.js +1 -21
- package/build/commands/browser/deleteCookies.js +0 -43
- package/build/commands/browser/execute.js +0 -43
- package/build/commands/browser/executeAsync.js +0 -51
- package/build/commands/browser/getCookies.js +0 -32
- package/build/commands/browser/getWindowSize.js +0 -20
- package/build/commands/browser/keys.js +0 -36
- package/build/commands/browser/newWindow.js +0 -37
- package/build/commands/browser/pause.js +0 -21
- package/build/commands/browser/react$$.js +0 -24
- package/build/commands/browser/react$.js +0 -28
- package/build/commands/browser/reloadSession.js +1 -28
- package/build/commands/browser/saveRecordingScreen.js +0 -23
- package/build/commands/browser/saveScreenshot.js +0 -22
- package/build/commands/browser/setCookies.js +0 -46
- package/build/commands/browser/setTimeout.js +1 -38
- package/build/commands/browser/setWindowSize.js +0 -25
- package/build/commands/browser/switchWindow.js +0 -38
- package/build/commands/browser/touchAction.js +0 -60
- package/build/commands/browser/uploadFile.js +0 -32
- package/build/commands/browser/url.js +0 -33
- package/build/commands/browser/waitUntil.js +0 -40
- package/build/commands/constant.js +0 -18
- package/build/commands/element/$$.js +0 -39
- package/build/commands/element/$.js +0 -43
- package/build/commands/element/addValue.js +1 -28
- package/build/commands/element/clearValue.js +0 -26
- package/build/commands/element/click.js +0 -43
- package/build/commands/element/doubleClick.js +0 -30
- package/build/commands/element/dragAndDrop.js +1 -21
- package/build/commands/element/getAttribute.js +0 -26
- package/build/commands/element/getCSSProperty.js +0 -66
- package/build/commands/element/getHTML.js +1 -33
- package/build/commands/element/getLocation.js +0 -27
- package/build/commands/element/getProperty.js +0 -16
- package/build/commands/element/getSize.js +0 -27
- package/build/commands/element/getTagName.js +0 -23
- package/build/commands/element/getText.js +0 -40
- package/build/commands/element/getValue.js +0 -24
- package/build/commands/element/isDisplayed.js +1 -62
- package/build/commands/element/isDisplayedInViewport.js +1 -39
- package/build/commands/element/isEnabled.js +0 -32
- package/build/commands/element/isExisting.js +0 -40
- package/build/commands/element/isFocused.js +1 -29
- package/build/commands/element/isSelected.js +0 -29
- package/build/commands/element/moveTo.js +0 -21
- package/build/commands/element/react$$.js +0 -25
- package/build/commands/element/react$.js +0 -29
- package/build/commands/element/saveScreenshot.js +0 -21
- package/build/commands/element/scrollIntoView.js +2 -26
- package/build/commands/element/selectByAttribute.js +0 -46
- package/build/commands/element/selectByIndex.js +0 -40
- package/build/commands/element/selectByVisibleText.js +1 -43
- package/build/commands/element/setValue.js +0 -25
- package/build/commands/element/shadow$$.js +0 -18
- package/build/commands/element/shadow$.js +0 -18
- package/build/commands/element/touchAction.js +0 -53
- package/build/commands/element/waitForDisplayed.js +0 -37
- package/build/commands/element/waitForEnabled.js +0 -35
- package/build/commands/element/waitForExist.js +0 -38
- package/build/commands/element/waitUntil.js +0 -6
- package/build/constants.js +0 -128
- package/build/index.js +0 -25
- package/build/middlewares.js +0 -14
- package/build/multiremote.js +0 -46
- package/build/scripts/getHTML.js +0 -7
- package/build/scripts/getProperty.js +0 -6
- package/build/scripts/isDisplayedInViewport.js +0 -5
- package/build/scripts/isElementDisplayed.js +10 -71
- package/build/scripts/isFocused.js +0 -5
- package/build/scripts/newWindow.js +0 -8
- package/build/scripts/resq.js +2 -7
- package/build/scripts/shadowFnFactory.js +0 -1
- package/build/utils/Timer.js +4 -23
- package/build/utils/findStrategy.js +16 -48
- package/build/utils/getElementObject.js +0 -25
- package/build/utils/implicitWait.js +0 -12
- package/build/utils/refetchElement.js +2 -15
- package/build/utils.js +3 -119
- package/package.json +3 -3
- package/webdriverio-core.d.ts +0 -8
|
@@ -7,59 +7,6 @@ exports.default = touchAction;
|
|
|
7
7
|
|
|
8
8
|
var _constant = require("../constant");
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* The Touch Action API provides the basis of all gestures that can be automated in Appium.
|
|
13
|
-
* It is currently only available to native apps and can not be used to interact with webapps.
|
|
14
|
-
* At its core is the ability to chain together _ad hoc_ individual actions, which will then be
|
|
15
|
-
* applied to an element in the application on the device. The basic actions that can be used are:
|
|
16
|
-
*
|
|
17
|
-
* - press (pass element or (x,y) or both)
|
|
18
|
-
* - longPress (pass element or (x,y) or both)
|
|
19
|
-
* - tap (pass element or (x,y) or both)
|
|
20
|
-
* - moveTo (pass absolute x,y coordinates)
|
|
21
|
-
* - wait (pass ms (as milliseconds))
|
|
22
|
-
* - release (no arguments)
|
|
23
|
-
*
|
|
24
|
-
* <example>
|
|
25
|
-
:touchAction.js
|
|
26
|
-
it('should do a touch gesture', function () {
|
|
27
|
-
const screen = $('//UITextbox');
|
|
28
|
-
|
|
29
|
-
// simple touch action on element
|
|
30
|
-
screen.touchAction('tap');
|
|
31
|
-
|
|
32
|
-
// simple touch action using selector and x y variables
|
|
33
|
-
// tap location is 30px right and 20px down relative from the center of the element
|
|
34
|
-
screen.touchAction({
|
|
35
|
-
action: 'tap', x: 30, y:20
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
// multi action on an element (drag&drop)
|
|
39
|
-
screen.touchAction([
|
|
40
|
-
'press',
|
|
41
|
-
{ action: 'moveTo', x: 200, y: 300 },
|
|
42
|
-
'release'
|
|
43
|
-
])
|
|
44
|
-
|
|
45
|
-
// drag&drop to element
|
|
46
|
-
const otherElement = $('//UIAApplication[1]/UIAElement[2]')
|
|
47
|
-
screen.touchAction([
|
|
48
|
-
'press',
|
|
49
|
-
{ action: 'moveTo', element: otherElement },
|
|
50
|
-
'release'
|
|
51
|
-
])
|
|
52
|
-
});
|
|
53
|
-
* </example>
|
|
54
|
-
*
|
|
55
|
-
* @param {String|Object[]} action action to execute
|
|
56
|
-
*
|
|
57
|
-
* @see https://saucelabs.com/blog/appium-sauce-labs-bootcamp-chapter-2-touch-actions
|
|
58
|
-
* @type mobile
|
|
59
|
-
* @for android, ios
|
|
60
|
-
* @uses mobile/performTouchAction, mobile/performMultiAction
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
10
|
function touchAction(...args) {
|
|
64
11
|
return _constant.touchAction.apply(this, args);
|
|
65
12
|
}
|
|
@@ -5,44 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = waitForDisplayed;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Wait for an element for the provided amount of
|
|
11
|
-
* milliseconds to be displayed or not displayed.
|
|
12
|
-
*
|
|
13
|
-
* <example>
|
|
14
|
-
:index.html
|
|
15
|
-
<div id="elem" style="visibility: hidden;">Hello World!</div>
|
|
16
|
-
<script type="text/javascript">
|
|
17
|
-
setTimeout(() => {
|
|
18
|
-
document.getElementById('elem').style.visibility = 'visible';
|
|
19
|
-
}, 2000);
|
|
20
|
-
</script>
|
|
21
|
-
:waitForVisibleExample.js
|
|
22
|
-
it('should detect when element is visible', () => {
|
|
23
|
-
const elem = $('#elem')
|
|
24
|
-
elem.waitForDisplayed(3000);
|
|
25
|
-
});
|
|
26
|
-
it('should detect when element is no longer visible', () => {
|
|
27
|
-
const elem = $('#elem')
|
|
28
|
-
// passing 'undefined' allows us to keep the default timeout value without overwriting it
|
|
29
|
-
elem.waitForDisplayed(undefined, true);
|
|
30
|
-
});
|
|
31
|
-
* </example>
|
|
32
|
-
*
|
|
33
|
-
* @alias element.waitForDisplayed
|
|
34
|
-
* @param {Number=} ms time in ms (default: 500)
|
|
35
|
-
* @param {Boolean=} reverse if true it waits for the opposite (default: false)
|
|
36
|
-
* @param {String=} error if exists it overrides the default error message
|
|
37
|
-
* @return {Boolean} true if element is displayed (or doesn't if flag is set)
|
|
38
|
-
* @uses utility/waitUntil, state/isDisplayed
|
|
39
|
-
* @type utility
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
8
|
async function waitForDisplayed(ms, reverse = false, error) {
|
|
43
|
-
/*
|
|
44
|
-
* ensure that ms is set properly
|
|
45
|
-
*/
|
|
46
9
|
if (typeof ms !== 'number') {
|
|
47
10
|
ms = this.options.waitforTimeout;
|
|
48
11
|
}
|
|
@@ -5,42 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = waitForEnabled;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Wait for an element (selected by css selector) for the provided amount of
|
|
11
|
-
* milliseconds to be (dis/en)abled. If multiple elements get queried by given
|
|
12
|
-
* selector, it returns true if at least one element is (dis/en)abled.
|
|
13
|
-
*
|
|
14
|
-
* <example>
|
|
15
|
-
:index.html
|
|
16
|
-
<input type="text" id="username" value="foobar" disabled="disabled"></input>
|
|
17
|
-
<script type="text/javascript">
|
|
18
|
-
setTimeout(() => {
|
|
19
|
-
document.getElementById('username').disabled = false
|
|
20
|
-
}, 2000);
|
|
21
|
-
</script>
|
|
22
|
-
:waitForEnabledExample.js
|
|
23
|
-
it('should detect when element is enabled', () => {
|
|
24
|
-
$('#username').waitForEnabled(3000);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should detect when element is disabled', () => {
|
|
28
|
-
elem = $('#username');
|
|
29
|
-
elem.waitForEnabled(3000, true)
|
|
30
|
-
});
|
|
31
|
-
* </example>
|
|
32
|
-
*
|
|
33
|
-
* @alias element.waitForEnabled
|
|
34
|
-
* @param {Number=} ms time in ms (default: 500)
|
|
35
|
-
* @param {Boolean=} reverse if true it waits for the opposite (default: false)
|
|
36
|
-
* @param {String=} error if exists it overrides the default error message
|
|
37
|
-
* @return {Boolean} true if element is (dis/en)abled
|
|
38
|
-
* @uses utility/waitUntil, state/isEnabled
|
|
39
|
-
* @type utility
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
8
|
async function waitForEnabled(ms, reverse = false, error) {
|
|
43
|
-
// If the element doesn't already exist, wait for it to exist
|
|
44
9
|
if (!this.elementId && !reverse) {
|
|
45
10
|
await this.waitForExist(ms, false, error);
|
|
46
11
|
}
|
|
@@ -5,45 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = waitForExist;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* Wait for an element for the provided amount of
|
|
11
|
-
* milliseconds to be present within the DOM. Returns true if the selector
|
|
12
|
-
* matches at least one element that exists in the DOM, otherwise throws an
|
|
13
|
-
* error. If the reverse flag is true, the command will instead return true
|
|
14
|
-
* if the selector does not match any elements.
|
|
15
|
-
*
|
|
16
|
-
* <example>
|
|
17
|
-
:waitForExistSyncExample.js
|
|
18
|
-
it('should display a notification message after successful form submit', function () {
|
|
19
|
-
const form = $('form');
|
|
20
|
-
const notification = $('.notification');
|
|
21
|
-
form.submit();
|
|
22
|
-
notification.waitForExist(5000);
|
|
23
|
-
expect(notification.getText()).to.be.equal('Data transmitted successfully!')
|
|
24
|
-
});
|
|
25
|
-
it('should remove a message after successful form submit', function () {
|
|
26
|
-
const form = $('form');
|
|
27
|
-
const message = $('.message');
|
|
28
|
-
form.submit();
|
|
29
|
-
// passing 'undefined' allows us to keep the default timeout value without overwriting it
|
|
30
|
-
message.waitForExist(undefined, true);
|
|
31
|
-
});
|
|
32
|
-
* </example>
|
|
33
|
-
*
|
|
34
|
-
* @alias element.waitForExist
|
|
35
|
-
* @param {Number=} ms time in ms (default: 500)
|
|
36
|
-
* @param {Boolean=} reverse if true it instead waits for the selector to not match any elements (default: false)
|
|
37
|
-
* @param {String=} error if exists it overrides the default error message
|
|
38
|
-
* @return {Boolean} true if element exists (or doesn't if flag is set)
|
|
39
|
-
* @uses utility/waitUntil, state/isExisting
|
|
40
|
-
* @type utility
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
8
|
function waitForExist(ms, reverse = false, error) {
|
|
44
|
-
/*!
|
|
45
|
-
* ensure that ms is set properly
|
|
46
|
-
*/
|
|
47
9
|
if (typeof ms !== 'number') {
|
|
48
10
|
ms = this.options.waitforTimeout;
|
|
49
11
|
}
|
|
@@ -9,11 +9,5 @@ var _waitUntil = _interopRequireDefault(require("../browser/waitUntil"));
|
|
|
9
9
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* Nothing to see here!
|
|
14
|
-
* The original implementation is in the browser scope. Since the element
|
|
15
|
-
* scope should be able to query sub elements of itself this command is
|
|
16
|
-
* just a placeholder so it gets picked up as regular command.
|
|
17
|
-
*/
|
|
18
12
|
var _default = _waitUntil.default;
|
|
19
13
|
exports.default = _default;
|
package/build/constants.js
CHANGED
|
@@ -4,25 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.APPIUM_CAPABILITES = exports.APPIUM_IOS_CAPABILITIES = exports.APPIUM_ANDROID_CAPABILITIES = exports.JSONWP_CAPABILITIES = exports.W3C_CAPABILITIES = exports.W3C_SELECTOR_STRATEGIES = exports.UNICODE_CHARACTERS = exports.WDIO_DEFAULTS = exports.ELEMENT_KEY = void 0;
|
|
7
|
-
|
|
8
|
-
/* istanbul ignore next */
|
|
9
7
|
const HOOK_DEFINITION = {
|
|
10
8
|
type: param => {
|
|
11
|
-
/**
|
|
12
|
-
* option must be an array
|
|
13
|
-
*/
|
|
14
9
|
if (!Array.isArray(param)) {
|
|
15
10
|
throw new Error('a hook option needs to be a list of functions');
|
|
16
11
|
}
|
|
17
|
-
/**
|
|
18
|
-
* array elements must be functions
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
12
|
|
|
22
13
|
for (const option of param) {
|
|
23
|
-
/**
|
|
24
|
-
* either a string
|
|
25
|
-
*/
|
|
26
14
|
if (typeof option === 'function') {
|
|
27
15
|
continue;
|
|
28
16
|
}
|
|
@@ -36,9 +24,6 @@ const HOOK_DEFINITION = {
|
|
|
36
24
|
const ELEMENT_KEY = 'element-6066-11e4-a52e-4f735466cecf';
|
|
37
25
|
exports.ELEMENT_KEY = ELEMENT_KEY;
|
|
38
26
|
const WDIO_DEFAULTS = {
|
|
39
|
-
/**
|
|
40
|
-
* define specs for test execution
|
|
41
|
-
*/
|
|
42
27
|
specs: {
|
|
43
28
|
type: param => {
|
|
44
29
|
if (!Array.isArray(param)) {
|
|
@@ -46,10 +31,6 @@ const WDIO_DEFAULTS = {
|
|
|
46
31
|
}
|
|
47
32
|
}
|
|
48
33
|
},
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* exclude specs from test execution
|
|
52
|
-
*/
|
|
53
34
|
exclude: {
|
|
54
35
|
type: param => {
|
|
55
36
|
if (!Array.isArray(param)) {
|
|
@@ -57,23 +38,11 @@ const WDIO_DEFAULTS = {
|
|
|
57
38
|
}
|
|
58
39
|
}
|
|
59
40
|
},
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* key/value definition of suites (named by key) and a list of specs as value
|
|
63
|
-
* to specify a specific set of tests to execute
|
|
64
|
-
*/
|
|
65
41
|
suites: {
|
|
66
42
|
type: 'object'
|
|
67
43
|
},
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* capabilities of WebDriver sessions
|
|
71
|
-
*/
|
|
72
44
|
capabilities: {
|
|
73
45
|
type: param => {
|
|
74
|
-
/**
|
|
75
|
-
* should be an object
|
|
76
|
-
*/
|
|
77
46
|
if (!Array.isArray(param)) {
|
|
78
47
|
if (typeof param === 'object') {
|
|
79
48
|
return true;
|
|
@@ -81,14 +50,9 @@ const WDIO_DEFAULTS = {
|
|
|
81
50
|
|
|
82
51
|
throw new Error('the "capabilities" options needs to be an object or a list of objects');
|
|
83
52
|
}
|
|
84
|
-
/**
|
|
85
|
-
* or an array of objects
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
53
|
|
|
89
54
|
for (const option of param) {
|
|
90
55
|
if (typeof option === 'object') {
|
|
91
|
-
// Check does not work recursively
|
|
92
56
|
continue;
|
|
93
57
|
}
|
|
94
58
|
|
|
@@ -99,84 +63,36 @@ const WDIO_DEFAULTS = {
|
|
|
99
63
|
},
|
|
100
64
|
required: true
|
|
101
65
|
},
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Shorten navigateTo command calls by setting a base url
|
|
105
|
-
*/
|
|
106
66
|
baseUrl: {
|
|
107
67
|
type: 'string'
|
|
108
68
|
},
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* If you only want to run your tests until a specific amount of tests have failed use
|
|
112
|
-
* bail (default is 0 - don't bail, run all tests).
|
|
113
|
-
*/
|
|
114
69
|
bail: {
|
|
115
70
|
type: 'number',
|
|
116
71
|
default: 0
|
|
117
72
|
},
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Default interval for all waitFor* commands
|
|
121
|
-
*/
|
|
122
73
|
waitforInterval: {
|
|
123
74
|
type: 'number',
|
|
124
75
|
default: 500
|
|
125
76
|
},
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Default timeout for all waitFor* commands
|
|
129
|
-
*/
|
|
130
77
|
waitforTimeout: {
|
|
131
78
|
type: 'number',
|
|
132
79
|
default: 3000
|
|
133
80
|
},
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* supported test framework by wdio testrunner
|
|
137
|
-
*/
|
|
138
81
|
framework: {
|
|
139
82
|
type: 'string'
|
|
140
83
|
},
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* list of reporters to use, a reporter can be either a string or an object with
|
|
144
|
-
* reporter options, e.g.:
|
|
145
|
-
* [
|
|
146
|
-
* 'dot',
|
|
147
|
-
* {
|
|
148
|
-
* name: 'spec',
|
|
149
|
-
* outputDir: __dirname + '/reports'
|
|
150
|
-
* }
|
|
151
|
-
* ]
|
|
152
|
-
*/
|
|
153
84
|
reporters: {
|
|
154
85
|
type: param => {
|
|
155
|
-
/**
|
|
156
|
-
* option must be an array
|
|
157
|
-
*/
|
|
158
86
|
if (!Array.isArray(param)) {
|
|
159
87
|
throw new Error('the "reporters" options needs to be a list of strings');
|
|
160
88
|
}
|
|
161
89
|
|
|
162
90
|
const isValidReporter = option => typeof option === 'string' || typeof option === 'function';
|
|
163
|
-
/**
|
|
164
|
-
* array elements must be:
|
|
165
|
-
*/
|
|
166
|
-
|
|
167
91
|
|
|
168
92
|
for (const option of param) {
|
|
169
|
-
/**
|
|
170
|
-
* either a string or a function (custom reporter)
|
|
171
|
-
*/
|
|
172
93
|
if (isValidReporter(option)) {
|
|
173
94
|
continue;
|
|
174
95
|
}
|
|
175
|
-
/**
|
|
176
|
-
* or an array with the name of the reporter as first element and the options
|
|
177
|
-
* as second element
|
|
178
|
-
*/
|
|
179
|
-
|
|
180
96
|
|
|
181
97
|
if (Array.isArray(option) && typeof option[1] === 'object' && isValidReporter(option[0])) {
|
|
182
98
|
continue;
|
|
@@ -188,22 +104,11 @@ const WDIO_DEFAULTS = {
|
|
|
188
104
|
return true;
|
|
189
105
|
}
|
|
190
106
|
},
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* set of WDIO services to use
|
|
194
|
-
*/
|
|
195
107
|
services: {
|
|
196
108
|
type: param => {
|
|
197
|
-
/**
|
|
198
|
-
* should be an array
|
|
199
|
-
*/
|
|
200
109
|
if (!Array.isArray(param)) {
|
|
201
110
|
throw new Error('the "services" options needs to be a list of strings and/or arrays');
|
|
202
111
|
}
|
|
203
|
-
/**
|
|
204
|
-
* with arrays and/or strings
|
|
205
|
-
*/
|
|
206
|
-
|
|
207
112
|
|
|
208
113
|
for (const option of param) {
|
|
209
114
|
if (!Array.isArray(option)) {
|
|
@@ -219,10 +124,6 @@ const WDIO_DEFAULTS = {
|
|
|
219
124
|
},
|
|
220
125
|
default: []
|
|
221
126
|
},
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Node arguments to specify when launching child processes
|
|
225
|
-
*/
|
|
226
127
|
execArgv: {
|
|
227
128
|
type: param => {
|
|
228
129
|
if (!Array.isArray(param)) {
|
|
@@ -231,32 +132,16 @@ const WDIO_DEFAULTS = {
|
|
|
231
132
|
},
|
|
232
133
|
default: []
|
|
233
134
|
},
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* amount of instances to be allowed to run in total
|
|
237
|
-
*/
|
|
238
135
|
maxInstances: {
|
|
239
136
|
type: 'number'
|
|
240
137
|
},
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* amount of instances to be allowed to run per capability
|
|
244
|
-
*/
|
|
245
138
|
maxInstancesPerCapability: {
|
|
246
139
|
type: 'number'
|
|
247
140
|
},
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* directory for log files
|
|
251
|
-
*/
|
|
252
141
|
outputDir: {
|
|
253
142
|
type: 'string',
|
|
254
143
|
default: process.cwd()
|
|
255
144
|
},
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* list of strings to watch of `wdio` command is called with `--watch` flag
|
|
259
|
-
*/
|
|
260
145
|
filesToWatch: {
|
|
261
146
|
type: param => {
|
|
262
147
|
if (!Array.isArray(param)) {
|
|
@@ -264,10 +149,6 @@ const WDIO_DEFAULTS = {
|
|
|
264
149
|
}
|
|
265
150
|
}
|
|
266
151
|
},
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* hooks
|
|
270
|
-
*/
|
|
271
152
|
onPrepare: HOOK_DEFINITION,
|
|
272
153
|
before: HOOK_DEFINITION,
|
|
273
154
|
beforeSession: HOOK_DEFINITION,
|
|
@@ -283,21 +164,12 @@ const WDIO_DEFAULTS = {
|
|
|
283
164
|
after: HOOK_DEFINITION,
|
|
284
165
|
onComplete: HOOK_DEFINITION,
|
|
285
166
|
onReload: HOOK_DEFINITION,
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* cucumber specific hooks
|
|
289
|
-
*/
|
|
290
167
|
beforeFeature: HOOK_DEFINITION,
|
|
291
168
|
beforeScenario: HOOK_DEFINITION,
|
|
292
169
|
beforeStep: HOOK_DEFINITION,
|
|
293
170
|
afterFeature: HOOK_DEFINITION,
|
|
294
171
|
afterScenario: HOOK_DEFINITION,
|
|
295
172
|
afterStep: HOOK_DEFINITION
|
|
296
|
-
/**
|
|
297
|
-
* unicode characters
|
|
298
|
-
* https://w3c.github.io/webdriver/webdriver-spec.html#character-types
|
|
299
|
-
*/
|
|
300
|
-
|
|
301
173
|
};
|
|
302
174
|
exports.WDIO_DEFAULTS = WDIO_DEFAULTS;
|
|
303
175
|
const UNICODE_CHARACTERS = {
|
package/build/index.js
CHANGED
|
@@ -19,13 +19,6 @@ var _utils = require("./utils");
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* A method to create a new session with WebdriverIO
|
|
24
|
-
*
|
|
25
|
-
* @param {Object} [params={}] Options to create the session with
|
|
26
|
-
* @param {function} remoteModifier Modifier function to change the monad object
|
|
27
|
-
* @return {object} browser object with sessionId
|
|
28
|
-
*/
|
|
29
22
|
const remote = async function (params = {}, remoteModifier) {
|
|
30
23
|
const config = (0, _config.validateConfig)(_constants.WDIO_DEFAULTS, params);
|
|
31
24
|
|
|
@@ -48,11 +41,6 @@ const remote = async function (params = {}, remoteModifier) {
|
|
|
48
41
|
|
|
49
42
|
const prototype = (0, _utils.getPrototype)('browser');
|
|
50
43
|
const instance = await _webdriver.default.newSession(params, modifier, prototype, _config.wrapCommand);
|
|
51
|
-
/**
|
|
52
|
-
* we need to overwrite the original addCommand and overwriteCommand
|
|
53
|
-
* in order to wrap the function within Fibers
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
44
|
const origAddCommand = instance.addCommand.bind(instance);
|
|
57
45
|
|
|
58
46
|
instance.addCommand = (name, fn, attachToElement) => origAddCommand(name, (0, _config.runFnInFiberContext)(fn), attachToElement);
|
|
@@ -76,10 +64,6 @@ exports.attach = attach;
|
|
|
76
64
|
const multiremote = async function (params = {}) {
|
|
77
65
|
const multibrowser = new _multiremote.default();
|
|
78
66
|
const browserNames = Object.keys(params);
|
|
79
|
-
/**
|
|
80
|
-
* create all instance sessions
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
67
|
await Promise.all(browserNames.map(browserName => {
|
|
84
68
|
const config = (0, _config.validateConfig)(_constants.WDIO_DEFAULTS, params[browserName]);
|
|
85
69
|
|
|
@@ -94,10 +78,6 @@ const multiremote = async function (params = {}) {
|
|
|
94
78
|
|
|
95
79
|
return multibrowser.addInstance(browserName, instance);
|
|
96
80
|
}));
|
|
97
|
-
/**
|
|
98
|
-
* use attachToSession capability to wrap instances around blank pod
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
81
|
const prototype = (0, _utils.getPrototype)('browser');
|
|
102
82
|
const sessionParams = {
|
|
103
83
|
sessionId: '',
|
|
@@ -106,11 +86,6 @@ const multiremote = async function (params = {}) {
|
|
|
106
86
|
};
|
|
107
87
|
|
|
108
88
|
const driver = _webdriver.default.attachToSession(sessionParams, multibrowser.modifier.bind(multibrowser), prototype, _config.wrapCommand);
|
|
109
|
-
/**
|
|
110
|
-
* in order to get custom command overwritten or added to multiremote instance
|
|
111
|
-
* we need to pass in the prototype of the multibrowser
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
89
|
|
|
115
90
|
const origAddCommand = driver.addCommand.bind(driver);
|
|
116
91
|
|
package/build/middlewares.js
CHANGED
|
@@ -11,12 +11,6 @@ var _implicitWait = _interopRequireDefault(require("./utils/implicitWait"));
|
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* This method is an command wrapper for elements that checks if a command is called
|
|
16
|
-
* that wasn't found on the page and automatically waits for it
|
|
17
|
-
*
|
|
18
|
-
* @param {Function} fn commandWrap from wdio-sync package (or shim if not running in sync)
|
|
19
|
-
*/
|
|
20
14
|
const elementErrorHandler = fn => (commandName, commandFn) => {
|
|
21
15
|
return function elementErrorHandlerCallback(...args) {
|
|
22
16
|
return fn(commandName, async function elementErrorHandlerCallbackFn() {
|
|
@@ -25,10 +19,6 @@ const elementErrorHandler = fn => (commandName, commandFn) => {
|
|
|
25
19
|
|
|
26
20
|
try {
|
|
27
21
|
const result = await fn(commandName, commandFn).apply(this, args);
|
|
28
|
-
/**
|
|
29
|
-
* assume Safari responses like { error: 'no such element', message: '', stacktrace: '' }
|
|
30
|
-
* as `stale element reference`
|
|
31
|
-
*/
|
|
32
22
|
|
|
33
23
|
if (result && result.error === 'no such element') {
|
|
34
24
|
const err = new Error();
|
|
@@ -50,10 +40,6 @@ const elementErrorHandler = fn => (commandName, commandFn) => {
|
|
|
50
40
|
}).apply(this);
|
|
51
41
|
};
|
|
52
42
|
};
|
|
53
|
-
/**
|
|
54
|
-
* handle single command calls from multiremote instances
|
|
55
|
-
*/
|
|
56
|
-
|
|
57
43
|
|
|
58
44
|
exports.elementErrorHandler = elementErrorHandler;
|
|
59
45
|
|
package/build/multiremote.js
CHANGED
|
@@ -25,26 +25,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
25
25
|
|
|
26
26
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Multiremote class
|
|
30
|
-
*/
|
|
31
28
|
class MultiRemote {
|
|
32
29
|
constructor() {
|
|
33
30
|
this.instances = {};
|
|
34
31
|
}
|
|
35
|
-
/**
|
|
36
|
-
* add instance to multibrowser instance
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
32
|
|
|
40
33
|
async addInstance(browserName, client) {
|
|
41
34
|
this.instances[browserName] = await client;
|
|
42
35
|
return this.instances[browserName];
|
|
43
36
|
}
|
|
44
|
-
/**
|
|
45
|
-
* modifier for multibrowser instance
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
37
|
|
|
49
38
|
modifier(wrapperClient) {
|
|
50
39
|
const propertiesObject = {};
|
|
@@ -67,9 +56,6 @@ class MultiRemote {
|
|
|
67
56
|
};
|
|
68
57
|
this.baseInstance = new MultiRemoteDriver(this.instances, propertiesObject);
|
|
69
58
|
const client = Object.create(this.baseInstance, propertiesObject);
|
|
70
|
-
/**
|
|
71
|
-
* attach instances to wrapper client
|
|
72
|
-
*/
|
|
73
59
|
|
|
74
60
|
for (const [identifier, instance] of Object.entries(this.instances)) {
|
|
75
61
|
client[identifier] = instance;
|
|
@@ -77,22 +63,6 @@ class MultiRemote {
|
|
|
77
63
|
|
|
78
64
|
return client;
|
|
79
65
|
}
|
|
80
|
-
/**
|
|
81
|
-
* helper method to generate element objects from results, so that we can call, e.g.
|
|
82
|
-
*
|
|
83
|
-
* ```
|
|
84
|
-
* const elem = $('#elem')
|
|
85
|
-
* elem.getHTML()
|
|
86
|
-
* ```
|
|
87
|
-
*
|
|
88
|
-
* or in case multiremote is used
|
|
89
|
-
*
|
|
90
|
-
* ```
|
|
91
|
-
* const elems = $$('div')
|
|
92
|
-
* elems[0].getHTML()
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
|
|
96
66
|
|
|
97
67
|
static elementWrapper(instances, result, propertiesObject) {
|
|
98
68
|
const prototype = _objectSpread({}, propertiesObject, {}, (0, _lodash2.default)((0, _utils.getPrototype)('element')), {
|
|
@@ -100,9 +70,6 @@ class MultiRemote {
|
|
|
100
70
|
});
|
|
101
71
|
|
|
102
72
|
const element = (0, _webdriver.webdriverMonad)({}, client => {
|
|
103
|
-
/**
|
|
104
|
-
* attach instances to wrapper client
|
|
105
|
-
*/
|
|
106
73
|
for (const [i, identifier] of Object.entries(Object.keys(instances))) {
|
|
107
74
|
client[identifier] = result[i];
|
|
108
75
|
}
|
|
@@ -113,18 +80,11 @@ class MultiRemote {
|
|
|
113
80
|
}, prototype);
|
|
114
81
|
return element(this.sessionId, (0, _middlewares.multiremoteHandler)(_config.wrapCommand));
|
|
115
82
|
}
|
|
116
|
-
/**
|
|
117
|
-
* handle commands for multiremote instances
|
|
118
|
-
*/
|
|
119
|
-
|
|
120
83
|
|
|
121
84
|
commandWrapper(commandName) {
|
|
122
85
|
const instances = this.instances;
|
|
123
86
|
return (0, _config.wrapCommand)(commandName, async function (...args) {
|
|
124
87
|
const result = await Promise.all(Object.entries(instances).map(([, instance]) => instance[commandName](...args)));
|
|
125
|
-
/**
|
|
126
|
-
* return element object to call commands directly
|
|
127
|
-
*/
|
|
128
88
|
|
|
129
89
|
if (commandName === '$') {
|
|
130
90
|
return MultiRemote.elementWrapper(instances, result, this.__propertiesObject__);
|
|
@@ -138,12 +98,6 @@ class MultiRemote {
|
|
|
138
98
|
}
|
|
139
99
|
|
|
140
100
|
}
|
|
141
|
-
/**
|
|
142
|
-
* event listener class that propagates events to sub drivers
|
|
143
|
-
*/
|
|
144
|
-
|
|
145
|
-
/* istanbul ignore next */
|
|
146
|
-
|
|
147
101
|
|
|
148
102
|
exports.default = MultiRemote;
|
|
149
103
|
|
package/build/scripts/getHTML.js
CHANGED
|
@@ -5,13 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = getHTML;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* get HTML of selector element
|
|
10
|
-
*
|
|
11
|
-
* @param {String} element element to get HTML from
|
|
12
|
-
* @param {Boolean} includeSelectorTag if true, selector tag gets included (uses outerHTML)
|
|
13
|
-
* @return {String} html source
|
|
14
|
-
*/
|
|
15
8
|
function getHTML(element, includeSelectorTag) {
|
|
16
9
|
return element[includeSelectorTag ? 'outerHTML' : 'innerHTML'];
|
|
17
10
|
}
|
|
@@ -5,12 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = getProperty;
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* get property from element
|
|
10
|
-
* @param {String} element element with requested property
|
|
11
|
-
* @param {String} property requested property
|
|
12
|
-
* @return {String} the value of the property
|
|
13
|
-
*/
|
|
14
8
|
function getProperty(element, property) {
|
|
15
9
|
return element[property];
|
|
16
10
|
}
|