webdriverio 8.20.3 → 8.21.0
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/element/moveTo.d.ts.map +1 -1
- package/build/commands/element/moveTo.js +14 -9
- package/build/commands/element/scrollIntoView.js +1 -1
- package/build/utils/findStrategy.js +3 -3
- package/build/utils/index.d.ts +0 -8
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +0 -10
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moveTo.d.ts","sourceRoot":"","sources":["../../../src/commands/element/moveTo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"moveTo.d.ts","sourceRoot":"","sources":["../../../src/commands/element/moveTo.ts"],"names":[],"mappings":"AAIA,KAAK,aAAa,GAAG;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,MAAM,CACxB,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAE,aAAkB,iBAsB3C"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getBrowserObject } from '../../utils/index.js';
|
|
2
|
+
import { ELEMENT_KEY } from '../../constants.js';
|
|
3
|
+
import isElementInViewportScript from '../../scripts/isElementInViewport.js';
|
|
2
4
|
/**
|
|
3
5
|
*
|
|
4
6
|
* Move the mouse by an offset of the specified element. If no element is specified,
|
|
@@ -17,18 +19,21 @@ export async function moveTo({ xOffset, yOffset } = {}) {
|
|
|
17
19
|
if (!this.isW3C) {
|
|
18
20
|
return this.moveToElement(this.elementId, xOffset, yOffset);
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const newYOffset = Math.floor(y - scrollY + (typeof yOffset === 'number' ? yOffset : (height / 2)));
|
|
22
|
+
const isIntoView = async () => {
|
|
23
|
+
return await browser.execute(isElementInViewportScript, {
|
|
24
|
+
[ELEMENT_KEY]: this.elementId,
|
|
25
|
+
ELEMENT: this.elementId // jsonwp compatible
|
|
26
|
+
});
|
|
27
|
+
};
|
|
27
28
|
/**
|
|
28
29
|
* W3C way of handle the mouse move actions
|
|
29
30
|
*/
|
|
30
31
|
const browser = getBrowserObject(this);
|
|
32
|
+
await this.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'instant' });
|
|
33
|
+
if (!(await isIntoView())) {
|
|
34
|
+
await this.scrollIntoView({ block: 'center', inline: 'center', behavior: 'instant' });
|
|
35
|
+
}
|
|
31
36
|
return browser.action('pointer', { parameters: { pointerType: 'mouse' } })
|
|
32
|
-
.move({ x:
|
|
37
|
+
.move({ origin: this, x: xOffset ? xOffset : 0, y: yOffset ? yOffset : 0 })
|
|
33
38
|
.perform();
|
|
34
39
|
}
|
|
@@ -85,7 +85,7 @@ export async function scrollIntoView(options = { block: 'start', inline: 'neares
|
|
|
85
85
|
deltaX = Math.round(deltaX - scrollX);
|
|
86
86
|
deltaY = Math.round(deltaY - scrollY);
|
|
87
87
|
await browser.action('wheel')
|
|
88
|
-
.scroll({ duration: 0, x: deltaX, deltaY, origin: this })
|
|
88
|
+
.scroll({ duration: 0, x: deltaX, y: deltaY, origin: this })
|
|
89
89
|
.perform();
|
|
90
90
|
}
|
|
91
91
|
catch (err) {
|
|
@@ -97,7 +97,7 @@ const defineStrategy = function (selector) {
|
|
|
97
97
|
// Use name strategy if selector queries elements with name attributes for JSONWP
|
|
98
98
|
// or if isMobile is used even when w3c is used
|
|
99
99
|
// e.g. "[name='myName']" or '[name="myName"]'
|
|
100
|
-
if (stringSelector.search(/^\[name=("|'
|
|
100
|
+
if (stringSelector.search(/^\[name=(?:"(.[^"]*)"|'(.[^']*)')]$/) >= 0) {
|
|
101
101
|
return 'name';
|
|
102
102
|
}
|
|
103
103
|
// Allow to move up to the parent or select current element
|
|
@@ -224,12 +224,12 @@ export const findStrategy = function (selector, isW3C, isMobile) {
|
|
|
224
224
|
}
|
|
225
225
|
case 'name': {
|
|
226
226
|
if (isMobile || !isW3C) {
|
|
227
|
-
const match = stringSelector.match(/^\[name=("|'
|
|
227
|
+
const match = stringSelector.match(/^\[name=(?:"(.[^"]*)"|'(.[^']*)')]$/);
|
|
228
228
|
if (!match) {
|
|
229
229
|
throw new Error(`InvalidSelectorMatch. Strategy 'name' has failed to match '${stringSelector}'`);
|
|
230
230
|
}
|
|
231
231
|
using = 'name';
|
|
232
|
-
value = match[2];
|
|
232
|
+
value = match[1] || match[2];
|
|
233
233
|
}
|
|
234
234
|
break;
|
|
235
235
|
}
|
package/build/utils/index.d.ts
CHANGED
|
@@ -61,14 +61,6 @@ export declare function assertDirectoryExists(filepath: string): Promise<void>;
|
|
|
61
61
|
* @return {string} fixed url
|
|
62
62
|
*/
|
|
63
63
|
export declare function validateUrl(url: string, origError?: Error): string;
|
|
64
|
-
/**
|
|
65
|
-
* get window's scrollX and scrollY
|
|
66
|
-
* @param {object} scope
|
|
67
|
-
*/
|
|
68
|
-
export declare function getScrollPosition(scope: WebdriverIO.Element): Promise<{
|
|
69
|
-
scrollX: number;
|
|
70
|
-
scrollY: number;
|
|
71
|
-
}>;
|
|
72
64
|
export declare function hasElementId(element: WebdriverIO.Element): Promise<boolean>;
|
|
73
65
|
export declare function addLocatorStrategyHandler(scope: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser): (name: string, func: (selector: string, root?: HTMLElement) => CustomLocatorReturnValue) => void;
|
|
74
66
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAOvD,OAAO,KAAK,EAAE,YAAY,EAAmB,QAAQ,E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AgB,2BAA2B,CAAC,IAAI,EAAE,GAAG,OAkBpD;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,iDAuC9D;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,UAInD;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,iBAK3D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAcnE;AAED,wBAAsB,YAAY,CAAE,OAAO,EAAE,WAAW,CAAC,OAAO,oBAoB/D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,UACnF,MAAM,mBAAmB,MAAM,SAAS,WAAW,KAAK,wBAAwB,UAOjG;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,aACnB,YAAY,UACd,YAAY,OAAO,GAAG,mBAAmB,YACvC,QAAQ,GAAG,gBAAgB,EAAE,GAAG,mBAAmB,EAAE,8BAExD,GAAG,EAAE,iBAcf,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,wBAAyB,MAAM,YAAgD,CAAA;AAElG;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,SACvB,OAAO,MAAM,EAAE,MAAM,CAAC,SACrB,OAAO,MAAM,EAAE,MAAM,CAAC,YAShC,CAAA"}
|
package/build/utils/index.js
CHANGED
|
@@ -382,16 +382,6 @@ export function validateUrl(url, origError) {
|
|
|
382
382
|
return validateUrl(`http://${url}`, new Error(`Invalid URL: ${url}`));
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
|
-
/**
|
|
386
|
-
* get window's scrollX and scrollY
|
|
387
|
-
* @param {object} scope
|
|
388
|
-
*/
|
|
389
|
-
export function getScrollPosition(scope) {
|
|
390
|
-
return getBrowserObject(scope)
|
|
391
|
-
.execute(/* istanbul ignore next */ function () {
|
|
392
|
-
return { scrollX: this.pageXOffset, scrollY: this.pageYOffset };
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
385
|
export async function hasElementId(element) {
|
|
396
386
|
/*
|
|
397
387
|
* This is only necessary as isDisplayed is on the exclusion list for the middleware
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webdriverio",
|
|
3
3
|
"description": "Next-gen browser and mobile automation test framework for Node.js",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.21.0",
|
|
5
5
|
"homepage": "https://webdriver.io",
|
|
6
6
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -68,17 +68,17 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@types/node": "^20.1.0",
|
|
71
|
-
"@wdio/config": "8.
|
|
71
|
+
"@wdio/config": "8.21.0",
|
|
72
72
|
"@wdio/logger": "8.16.17",
|
|
73
|
-
"@wdio/protocols": "8.20.
|
|
73
|
+
"@wdio/protocols": "8.20.4",
|
|
74
74
|
"@wdio/repl": "8.10.1",
|
|
75
|
-
"@wdio/types": "8.
|
|
76
|
-
"@wdio/utils": "8.
|
|
75
|
+
"@wdio/types": "8.21.0",
|
|
76
|
+
"@wdio/utils": "8.21.0",
|
|
77
77
|
"archiver": "^6.0.0",
|
|
78
78
|
"aria-query": "^5.0.0",
|
|
79
79
|
"css-shorthand-properties": "^1.1.1",
|
|
80
80
|
"css-value": "^0.0.1",
|
|
81
|
-
"devtools-protocol": "^0.0.
|
|
81
|
+
"devtools-protocol": "^0.0.1213968",
|
|
82
82
|
"grapheme-splitter": "^1.0.2",
|
|
83
83
|
"import-meta-resolve": "^3.0.0",
|
|
84
84
|
"is-plain-obj": "^4.1.0",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"resq": "^1.9.1",
|
|
91
91
|
"rgb2hex": "0.2.5",
|
|
92
92
|
"serialize-error": "^11.0.1",
|
|
93
|
-
"webdriver": "8.
|
|
93
|
+
"webdriver": "8.21.0"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"devtools": "^8.14.0"
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"optional": true
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "92a7474463e872223ee26c99112e79ad7d8eb8d3"
|
|
104
104
|
}
|