webdriverio 8.8.4 → 8.8.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollIntoView.d.ts","sourceRoot":"","sources":["../../../src/commands/element/scrollIntoView.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,cAAc,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,GAAE,qBAAqB,GAAG,OAA+C,
|
|
1
|
+
{"version":3,"file":"scrollIntoView.d.ts","sourceRoot":"","sources":["../../../src/commands/element/scrollIntoView.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,cAAc,CAChC,IAAI,EAAE,WAAW,CAAC,OAAO,EACzB,OAAO,GAAE,qBAAqB,GAAG,OAA+C,iBA0EnF"}
|
|
@@ -45,10 +45,16 @@ export async function scrollIntoView(options = { block: 'start', inline: 'neares
|
|
|
45
45
|
*/
|
|
46
46
|
const elemRect = await browser.getElementRect(this.elementId);
|
|
47
47
|
const viewport = await browser.getWindowSize();
|
|
48
|
+
let [windowX, windowY] = await browser.execute(() => [
|
|
49
|
+
window.scrollX, window.scrollY
|
|
50
|
+
]);
|
|
51
|
+
const origin = windowX === 0 && windowY === 0 ? this : undefined;
|
|
52
|
+
windowX = elemRect.x <= viewport.width ? elemRect.x - 10 : viewport.width / 2;
|
|
53
|
+
windowY = elemRect.y <= viewport.height ? elemRect.y - 10 : viewport.height / 2;
|
|
48
54
|
const deltaByOption = {
|
|
49
55
|
start: { y: elemRect.y, x: elemRect.x },
|
|
50
56
|
center: { y: elemRect.y - Math.round((viewport.height - elemRect.height) / 2), x: elemRect.x - Math.round((viewport.width - elemRect.width) / 2) },
|
|
51
|
-
end: { y: elemRect.y - (viewport.height - elemRect.height), x: elemRect.x - (viewport.width - elemRect.width) }
|
|
57
|
+
end: { y: elemRect.y - (viewport.height - elemRect.height - 20), x: elemRect.x - (viewport.width - elemRect.width) }
|
|
52
58
|
};
|
|
53
59
|
let [deltaX, deltaY] = [deltaByOption.start.x, deltaByOption.start.y];
|
|
54
60
|
if (options && typeof options !== 'boolean') {
|
|
@@ -68,11 +74,21 @@ export async function scrollIntoView(options = { block: 'start', inline: 'neares
|
|
|
68
74
|
deltaX = deltaByOption[inline].x;
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
if (origin) {
|
|
78
|
+
deltaX = Math.round(deltaX - elemRect.x);
|
|
79
|
+
deltaY = Math.round(deltaY - (elemRect.y - viewport.height));
|
|
80
|
+
windowX = 0;
|
|
81
|
+
windowY = 0;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
deltaX = Math.round(deltaX - windowX);
|
|
85
|
+
deltaY = Math.round(deltaY - windowY);
|
|
86
|
+
windowX = Math.round(windowX);
|
|
87
|
+
windowY = Math.round(windowY);
|
|
88
|
+
}
|
|
73
89
|
try {
|
|
74
90
|
return await browser.action('wheel')
|
|
75
|
-
.scroll({ duration: 200, deltaX, deltaY })
|
|
91
|
+
.scroll({ duration: 200, x: windowX, y: windowY, deltaX, deltaY, origin })
|
|
76
92
|
.perform();
|
|
77
93
|
}
|
|
78
94
|
catch (err) {
|
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.8.
|
|
4
|
+
"version": "8.8.7",
|
|
5
5
|
"homepage": "https://webdriver.io",
|
|
6
6
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -68,30 +68,30 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@types/node": "^18.0.0",
|
|
71
|
-
"@wdio/config": "8.8.
|
|
71
|
+
"@wdio/config": "8.8.7",
|
|
72
72
|
"@wdio/logger": "8.6.6",
|
|
73
73
|
"@wdio/protocols": "8.8.1",
|
|
74
74
|
"@wdio/repl": "8.6.6",
|
|
75
|
-
"@wdio/types": "8.8.
|
|
76
|
-
"@wdio/utils": "8.8.
|
|
75
|
+
"@wdio/types": "8.8.7",
|
|
76
|
+
"@wdio/utils": "8.8.7",
|
|
77
77
|
"archiver": "^5.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": "8.8.
|
|
82
|
-
"devtools-protocol": "^0.0.
|
|
81
|
+
"devtools": "8.8.7",
|
|
82
|
+
"devtools-protocol": "^0.0.1135726",
|
|
83
83
|
"grapheme-splitter": "^1.0.2",
|
|
84
|
-
"import-meta-resolve": "^
|
|
84
|
+
"import-meta-resolve": "^3.0.0",
|
|
85
85
|
"is-plain-obj": "^4.1.0",
|
|
86
86
|
"lodash.clonedeep": "^4.5.0",
|
|
87
87
|
"lodash.zip": "^4.2.0",
|
|
88
88
|
"minimatch": "^9.0.0",
|
|
89
|
-
"puppeteer-core": "19.
|
|
89
|
+
"puppeteer-core": "19.11.1",
|
|
90
90
|
"query-selector-shadow-dom": "^1.0.0",
|
|
91
91
|
"resq": "^1.9.1",
|
|
92
92
|
"rgb2hex": "0.2.5",
|
|
93
93
|
"serialize-error": "^8.0.0",
|
|
94
|
-
"webdriver": "8.8.
|
|
94
|
+
"webdriver": "8.8.7"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "c8f7c7298308b5d313d88a16fdd58f241fdeec52"
|
|
97
97
|
}
|