froth-webdriverio-framework 3.0.79 → 3.0.80
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/commonMethods/Utils.js +3 -1
- package/commonMethods/swipe.js +28 -1
- package/package.json +1 -1
package/commonMethods/Utils.js
CHANGED
|
@@ -12,7 +12,7 @@ let swipeRight = null;
|
|
|
12
12
|
let swipeLeft = null;
|
|
13
13
|
let swipeUp = null;
|
|
14
14
|
let swipeDown = null;
|
|
15
|
-
|
|
15
|
+
let swipetoFit = null;
|
|
16
16
|
|
|
17
17
|
let clickIfVisible = null;
|
|
18
18
|
|
|
@@ -58,6 +58,7 @@ swipeDown = require(basepath + '/swipe').swipedown;
|
|
|
58
58
|
swipeLeft = require(basepath + '/swipe').swipeleft;
|
|
59
59
|
swipeRight = require(basepath + '/swipe').swiperight;
|
|
60
60
|
swipeUp = require(basepath + '/swipe').swipeup;
|
|
61
|
+
swipetoFit= require(basepath + '/swipe').swipetofit;
|
|
61
62
|
|
|
62
63
|
clickIfVisible = require(basepath + "/click").clickIfVisible;
|
|
63
64
|
clickByIdWithExecute = require(basepath + "/click").clickByIdWithExecute;
|
|
@@ -119,5 +120,6 @@ module.exports = {
|
|
|
119
120
|
swipeRight,
|
|
120
121
|
swipeDown,
|
|
121
122
|
swipeUp,
|
|
123
|
+
swipetoFit,
|
|
122
124
|
generateJWT
|
|
123
125
|
};
|
package/commonMethods/swipe.js
CHANGED
|
@@ -56,4 +56,31 @@ async function swipedown(selector, yoffset, speedinsec) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
async function swipetofit() {
|
|
61
|
+
try {
|
|
62
|
+
const { width, height } = await driver.getWindowRect();
|
|
63
|
+
|
|
64
|
+
console.log('width and height:', width, height);
|
|
65
|
+
// ⬅ Swipe from right to left (Full Swipe)
|
|
66
|
+
|
|
67
|
+
await driver.touchAction([
|
|
68
|
+
{ action: 'press', x: width - 10, y: height / 2 }, // Start near the right edge
|
|
69
|
+
{ action: 'wait', ms: 500 }, // Hold to stabilize
|
|
70
|
+
{ action: 'moveTo', x: 10, y: height / 2 }, // Move to the left edge
|
|
71
|
+
{ action: 'release' }
|
|
72
|
+
]);
|
|
73
|
+
// ⬅ Swipe from Left to Right (Full Swipe)
|
|
74
|
+
|
|
75
|
+
await driver.touchAction([
|
|
76
|
+
{ action: 'press', x: 10, y: height / 2 }, // Start near the left edge
|
|
77
|
+
{ action: 'wait', ms: 500 },
|
|
78
|
+
{ action: 'moveTo', x: width - 10, y: height / 2 }, // Move to the right edge
|
|
79
|
+
{ action: 'release' }
|
|
80
|
+
]);
|
|
81
|
+
|
|
82
|
+
} catch (error) {
|
|
83
|
+
console.error(error.message);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
module.exports = { swipeleft, swipedown, swiperight, swipeup, swipetofit };
|