webdriverio 5.11.12 → 5.12.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.
|
@@ -21,12 +21,16 @@ async function dragAndDrop(target, duration = 100) {
|
|
|
21
21
|
return this.buttonUp(ACTION_BUTTON);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
const {
|
|
25
|
+
scrollX,
|
|
26
|
+
scrollY
|
|
27
|
+
} = await (0, _utils.getScrollPosition)(this);
|
|
24
28
|
const sourceRect = await (0, _utils.getElementRect)(this);
|
|
25
29
|
const targetRect = await (0, _utils.getElementRect)(target);
|
|
26
|
-
const sourceX = parseInt(sourceRect.x + sourceRect.width / 2, 10);
|
|
27
|
-
const sourceY = parseInt(sourceRect.y + sourceRect.height / 2, 10);
|
|
28
|
-
const targetX = parseInt(targetRect.x + targetRect.width / 2, 10) - sourceX;
|
|
29
|
-
const targetY = parseInt(targetRect.y + targetRect.height / 2, 10) - sourceY;
|
|
30
|
+
const sourceX = parseInt(sourceRect.x - scrollX + sourceRect.width / 2, 10);
|
|
31
|
+
const sourceY = parseInt(sourceRect.y - scrollY + sourceRect.height / 2, 10);
|
|
32
|
+
const targetX = parseInt(targetRect.x - scrollX + targetRect.width / 2, 10) - sourceX;
|
|
33
|
+
const targetY = parseInt(targetRect.y - scrollY + targetRect.height / 2, 10) - sourceY;
|
|
30
34
|
return this.performActions([{
|
|
31
35
|
type: 'pointer',
|
|
32
36
|
id: 'finger1',
|
|
@@ -18,8 +18,12 @@ async function moveTo(xoffset, yoffset) {
|
|
|
18
18
|
width,
|
|
19
19
|
height
|
|
20
20
|
} = await (0, _utils.getElementRect)(this);
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const {
|
|
22
|
+
scrollX,
|
|
23
|
+
scrollY
|
|
24
|
+
} = await (0, _utils.getScrollPosition)(this);
|
|
25
|
+
const newXoffset = parseInt(x + (typeof xoffset === 'number' ? xoffset : width / 2), 10) - scrollX;
|
|
26
|
+
const newYoffset = parseInt(y + (typeof yoffset === 'number' ? yoffset : height / 2), 10) - scrollY;
|
|
23
27
|
return this.performActions([{
|
|
24
28
|
type: 'pointer',
|
|
25
29
|
id: 'finger1',
|
package/build/constants.js
CHANGED
|
@@ -167,9 +167,9 @@ const WDIO_DEFAULTS = {
|
|
|
167
167
|
beforeFeature: HOOK_DEFINITION,
|
|
168
168
|
beforeScenario: HOOK_DEFINITION,
|
|
169
169
|
beforeStep: HOOK_DEFINITION,
|
|
170
|
-
|
|
170
|
+
afterStep: HOOK_DEFINITION,
|
|
171
171
|
afterScenario: HOOK_DEFINITION,
|
|
172
|
-
|
|
172
|
+
afterFeature: HOOK_DEFINITION
|
|
173
173
|
};
|
|
174
174
|
exports.WDIO_DEFAULTS = WDIO_DEFAULTS;
|
|
175
175
|
const UNICODE_CHARACTERS = {
|
package/build/utils.js
CHANGED
|
@@ -14,6 +14,7 @@ exports.getElementRect = getElementRect;
|
|
|
14
14
|
exports.getAbsoluteFilepath = getAbsoluteFilepath;
|
|
15
15
|
exports.assertDirectoryExists = assertDirectoryExists;
|
|
16
16
|
exports.validateUrl = validateUrl;
|
|
17
|
+
exports.getScrollPosition = getScrollPosition;
|
|
17
18
|
exports.getElementFromResponse = exports.getPrototype = void 0;
|
|
18
19
|
|
|
19
20
|
var _fs = _interopRequireDefault(require("fs"));
|
|
@@ -306,4 +307,8 @@ function validateUrl(url, origError) {
|
|
|
306
307
|
|
|
307
308
|
return validateUrl(`http://${url}`, e);
|
|
308
309
|
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function getScrollPosition(scope) {
|
|
313
|
+
return getBrowserObject(scope).execute('return { scrollX: this.pageXOffset, scrollY: this.pageYOffset };');
|
|
309
314
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriverio",
|
|
3
3
|
"description": "Next-gen WebDriver test automation framework for Node.js",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.12.1",
|
|
5
5
|
"homepage": "https://webdriver.io",
|
|
6
6
|
"author": "Christian Bromann <christian@saucelabs.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
"test:unit": "jest"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@wdio/config": "^5.
|
|
59
|
-
"@wdio/logger": "^5.
|
|
60
|
-
"@wdio/repl": "^5.
|
|
58
|
+
"@wdio/config": "^5.12.1",
|
|
59
|
+
"@wdio/logger": "^5.12.1",
|
|
60
|
+
"@wdio/repl": "^5.12.1",
|
|
61
61
|
"archiver": "^3.0.0",
|
|
62
62
|
"css-value": "^0.0.1",
|
|
63
63
|
"grapheme-splitter": "^1.0.2",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"resq": "^1.5.0",
|
|
69
69
|
"rgb2hex": "^0.1.0",
|
|
70
70
|
"serialize-error": "^4.1.0",
|
|
71
|
-
"webdriver": "^5.
|
|
71
|
+
"webdriver": "^5.12.1"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "848151e5fdcb8b694c1a273b9b69852c22875687"
|
|
74
74
|
}
|
package/webdriverio-core.d.ts
CHANGED
|
@@ -157,6 +157,8 @@ declare namespace WebdriverIO {
|
|
|
157
157
|
type TouchActions = string | TouchAction | TouchAction[];
|
|
158
158
|
|
|
159
159
|
interface Element {
|
|
160
|
+
"element-6066-11e4-a52e-4f735466cecf"?: string;
|
|
161
|
+
ELEMENT?: string;
|
|
160
162
|
selector: string;
|
|
161
163
|
elementId: string;
|
|
162
164
|
addCommand(
|
|
@@ -298,7 +300,7 @@ declare namespace WebdriverIO {
|
|
|
298
300
|
getCookies(
|
|
299
301
|
names?: string[]
|
|
300
302
|
): Cookie[];
|
|
301
|
-
getWindowSize():
|
|
303
|
+
getWindowSize(): WebDriver.RectReturn;
|
|
302
304
|
keys(
|
|
303
305
|
value: string | string[]
|
|
304
306
|
): void;
|
|
@@ -345,7 +347,7 @@ declare namespace WebdriverIO {
|
|
|
345
347
|
): void;
|
|
346
348
|
uploadFile(
|
|
347
349
|
localPath: string
|
|
348
|
-
):
|
|
350
|
+
): string;
|
|
349
351
|
url(
|
|
350
352
|
url?: string
|
|
351
353
|
): void;
|
package/webdriverio.d.ts
CHANGED
|
@@ -4,7 +4,15 @@ type $ = (selector: string | Function) => Promise<WebdriverIOAsync.Element>;
|
|
|
4
4
|
type $$ = (selector: string | Function) => Promise<WebdriverIOAsync.Element[]>;
|
|
5
5
|
|
|
6
6
|
// Element commands that should be wrapper with Promise
|
|
7
|
-
type ElementPromise = Omit<WebdriverIO.Element,
|
|
7
|
+
type ElementPromise = Omit<WebdriverIO.Element,
|
|
8
|
+
'addCommand'
|
|
9
|
+
| '$'
|
|
10
|
+
| '$$'
|
|
11
|
+
| 'selector'
|
|
12
|
+
| 'elementId'
|
|
13
|
+
| 'element-6066-11e4-a52e-4f735466cecf'
|
|
14
|
+
| 'ELEMENT'
|
|
15
|
+
>;
|
|
8
16
|
|
|
9
17
|
// Methods which return async element(s) so non-async equivalents cannot just be promise-wrapped
|
|
10
18
|
interface AsyncSelectors {
|
|
@@ -19,7 +27,13 @@ type ElementAsync = {
|
|
|
19
27
|
} & AsyncSelectors;
|
|
20
28
|
|
|
21
29
|
// Element commands that should not be wrapper with promise
|
|
22
|
-
type ElementStatic = Pick<WebdriverIO.Element,
|
|
30
|
+
type ElementStatic = Pick<WebdriverIO.Element,
|
|
31
|
+
'addCommand'
|
|
32
|
+
| 'selector'
|
|
33
|
+
| 'elementId'
|
|
34
|
+
| 'element-6066-11e4-a52e-4f735466cecf'
|
|
35
|
+
| 'ELEMENT'
|
|
36
|
+
>;
|
|
23
37
|
|
|
24
38
|
// Browser commands that should be wrapper with Promise
|
|
25
39
|
type BrowserPromise = Omit<WebdriverIO.Browser, 'addCommand' | 'overwriteCommand' | 'options' | '$' | '$$'>;
|