webdriverio 8.6.3 → 8.6.6
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,iBAmDnF"}
|
|
@@ -38,33 +38,39 @@ export async function scrollIntoView(options = { block: 'start', inline: 'neares
|
|
|
38
38
|
if (browser.isMobile) {
|
|
39
39
|
return scrollIntoViewWeb.call(this, options);
|
|
40
40
|
}
|
|
41
|
-
let deltaX = 0;
|
|
42
|
-
let deltaY = 0;
|
|
43
41
|
/**
|
|
44
42
|
* by default the WebDriver action scrolls the element just into the
|
|
45
43
|
* viewport. In order to stay complaint with `Element.scrollIntoView()`
|
|
46
44
|
* we need to adjust the values a bit.
|
|
47
45
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
const elemRect = await browser.getElementRect(this.elementId);
|
|
47
|
+
const viewport = await browser.getWindowSize();
|
|
48
|
+
const deltaByOption = {
|
|
49
|
+
start: { y: elemRect.y, x: elemRect.x },
|
|
50
|
+
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) }
|
|
52
|
+
};
|
|
53
|
+
let [deltaX, deltaY] = [deltaByOption.start.x, deltaByOption.start.y];
|
|
54
|
+
if (options && typeof options !== 'boolean') {
|
|
55
|
+
const { block, inline } = options;
|
|
56
|
+
if (block === 'nearest') {
|
|
57
|
+
const nearestDistance = Math.min(...Object.values(deltaByOption).map(delta => Math.abs(delta.y)));
|
|
58
|
+
deltaY = Object.values(deltaByOption).find(delta => Math.abs(delta.y) === nearestDistance).y;
|
|
54
59
|
}
|
|
55
|
-
else if (
|
|
56
|
-
deltaY
|
|
60
|
+
else if (block) {
|
|
61
|
+
deltaY = deltaByOption[block].y;
|
|
57
62
|
}
|
|
58
|
-
if (
|
|
59
|
-
|
|
63
|
+
if (inline === 'nearest') {
|
|
64
|
+
const nearestDistance = Math.min(...Object.values(deltaByOption).map(delta => Math.abs(delta.x)));
|
|
65
|
+
deltaX = Object.values(deltaByOption).find(delta => Math.abs(delta.x) === nearestDistance).x;
|
|
60
66
|
}
|
|
61
|
-
else if (
|
|
62
|
-
deltaX
|
|
67
|
+
else if (inline) {
|
|
68
|
+
deltaX = deltaByOption[inline].x;
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
71
|
try {
|
|
66
72
|
return await browser.action('wheel')
|
|
67
|
-
.scroll({
|
|
73
|
+
.scroll({ duration: 200, deltaX, deltaY })
|
|
68
74
|
.perform();
|
|
69
75
|
}
|
|
70
76
|
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.6.
|
|
4
|
+
"version": "8.6.6",
|
|
5
5
|
"homepage": "https://webdriver.io",
|
|
6
6
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,7 +55,8 @@
|
|
|
55
55
|
"require": "./build/cjs/index.js"
|
|
56
56
|
},
|
|
57
57
|
"./build/cjs/index.js"
|
|
58
|
-
]
|
|
58
|
+
],
|
|
59
|
+
"./package.json": "./package.json"
|
|
59
60
|
},
|
|
60
61
|
"types": "./build/index.d.ts",
|
|
61
62
|
"typeScriptVersion": "3.8.3",
|
|
@@ -67,30 +68,30 @@
|
|
|
67
68
|
},
|
|
68
69
|
"dependencies": {
|
|
69
70
|
"@types/node": "^18.0.0",
|
|
70
|
-
"@wdio/config": "8.6.
|
|
71
|
-
"@wdio/logger": "8.
|
|
72
|
-
"@wdio/protocols": "8.
|
|
73
|
-
"@wdio/repl": "8.
|
|
71
|
+
"@wdio/config": "8.6.6",
|
|
72
|
+
"@wdio/logger": "8.6.6",
|
|
73
|
+
"@wdio/protocols": "8.6.6",
|
|
74
|
+
"@wdio/repl": "8.6.6",
|
|
74
75
|
"@wdio/types": "8.4.0",
|
|
75
|
-
"@wdio/utils": "8.6.
|
|
76
|
+
"@wdio/utils": "8.6.6",
|
|
76
77
|
"archiver": "^5.0.0",
|
|
77
78
|
"aria-query": "^5.0.0",
|
|
78
79
|
"css-shorthand-properties": "^1.1.1",
|
|
79
80
|
"css-value": "^0.0.1",
|
|
80
|
-
"devtools": "8.6.
|
|
81
|
-
"devtools-protocol": "^0.0.
|
|
81
|
+
"devtools": "8.6.6",
|
|
82
|
+
"devtools-protocol": "^0.0.1119014",
|
|
82
83
|
"grapheme-splitter": "^1.0.2",
|
|
83
84
|
"import-meta-resolve": "^2.1.0",
|
|
84
85
|
"is-plain-obj": "^4.1.0",
|
|
85
86
|
"lodash.clonedeep": "^4.5.0",
|
|
86
87
|
"lodash.zip": "^4.2.0",
|
|
87
88
|
"minimatch": "^7.0.0",
|
|
88
|
-
"puppeteer-core": "19.7.
|
|
89
|
+
"puppeteer-core": "19.7.5",
|
|
89
90
|
"query-selector-shadow-dom": "^1.0.0",
|
|
90
91
|
"resq": "^1.9.1",
|
|
91
92
|
"rgb2hex": "0.2.5",
|
|
92
93
|
"serialize-error": "^8.0.0",
|
|
93
|
-
"webdriver": "8.6.
|
|
94
|
+
"webdriver": "8.6.6"
|
|
94
95
|
},
|
|
95
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "1bcac586be548a778d452e0b01c11e4097d743f4"
|
|
96
97
|
}
|