froth-webdriverio-framework 3.0.81 → 3.0.82
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 -0
- package/commonMethods/swipe.js +28 -11
- package/package.json +1 -1
package/commonMethods/Utils.js
CHANGED
|
@@ -13,6 +13,7 @@ let swipeLeft = null;
|
|
|
13
13
|
let swipeUp = null;
|
|
14
14
|
let swipeDown = null;
|
|
15
15
|
let swipetoFit = null;
|
|
16
|
+
let swipeWithCoordinates = null;
|
|
16
17
|
|
|
17
18
|
let clickIfVisible = null;
|
|
18
19
|
|
|
@@ -59,6 +60,7 @@ swipeLeft = require(basepath + '/swipe').swipeleft;
|
|
|
59
60
|
swipeRight = require(basepath + '/swipe').swiperight;
|
|
60
61
|
swipeUp = require(basepath + '/swipe').swipeup;
|
|
61
62
|
swipetoFit= require(basepath + '/swipe').swipetofit;
|
|
63
|
+
swipeWithCoordinates = require(basepath + '/swipe').swipewithcoordinates;
|
|
62
64
|
|
|
63
65
|
clickIfVisible = require(basepath + "/click").clickIfVisible;
|
|
64
66
|
clickByIdWithExecute = require(basepath + "/click").clickByIdWithExecute;
|
|
@@ -121,5 +123,6 @@ module.exports = {
|
|
|
121
123
|
swipeDown,
|
|
122
124
|
swipeUp,
|
|
123
125
|
swipetoFit,
|
|
126
|
+
swipeWithCoordinates,
|
|
124
127
|
generateJWT
|
|
125
128
|
};
|
package/commonMethods/swipe.js
CHANGED
|
@@ -56,6 +56,23 @@ async function swipedown(selector, yoffset, speedinsec) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
async function swipewithcoordinates(StartX, StartY, EndX, EndY) {
|
|
60
|
+
|
|
61
|
+
await driver.performActions([
|
|
62
|
+
{
|
|
63
|
+
type: "pointer",
|
|
64
|
+
id: "finger1",
|
|
65
|
+
parameters: { pointerType: "touch" },
|
|
66
|
+
actions: [
|
|
67
|
+
{ type: "pointerMove", duration: 0, x: StartX, y: StartY },
|
|
68
|
+
{ type: "pointerDown", button: 0 },
|
|
69
|
+
{ type: "pause", duration: 300 },
|
|
70
|
+
{ type: "pointerMove", duration: 1000, x: EndX, y: EndY },
|
|
71
|
+
{ type: "pointerUp", button: 0 }
|
|
72
|
+
],
|
|
73
|
+
}
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
59
76
|
async function swipetofit() {
|
|
60
77
|
// Get screen size dynamically
|
|
61
78
|
const screenSize = await driver.getWindowRect();
|
|
@@ -65,17 +82,17 @@ async function swipetofit() {
|
|
|
65
82
|
console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
|
|
66
83
|
|
|
67
84
|
// Define approximate positions for corners
|
|
68
|
-
const topRightStartX = screenWidth * 0.
|
|
69
|
-
const topRightStartY = screenHeight * 0.
|
|
85
|
+
const topRightStartX = screenWidth * 0.88; // Top-right corner
|
|
86
|
+
const topRightStartY = screenHeight * 0.44;
|
|
70
87
|
|
|
71
|
-
const topRightEndX = screenWidth * 0.
|
|
72
|
-
const topRightEndY = screenHeight * 0.
|
|
88
|
+
const topRightEndX = screenWidth * 0.96; // Expand to the right
|
|
89
|
+
const topRightEndY = screenHeight * 0.39; // Move upwards slightly
|
|
73
90
|
|
|
74
|
-
const bottomLeftStartX = screenWidth * 0.
|
|
75
|
-
const bottomLeftStartY = screenHeight * 0.
|
|
91
|
+
const bottomLeftStartX = screenWidth * 0.12; // Bottom-left corner
|
|
92
|
+
const bottomLeftStartY = screenHeight * 0.69;
|
|
76
93
|
|
|
77
|
-
const bottomLeftEndX = screenWidth * 0.
|
|
78
|
-
const bottomLeftEndY = screenHeight * 0.
|
|
94
|
+
const bottomLeftEndX = screenWidth * 0.014; // Expand to the left
|
|
95
|
+
const bottomLeftEndY = screenHeight * 0.73; // Move down slightly
|
|
79
96
|
|
|
80
97
|
console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
|
|
81
98
|
console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
|
|
@@ -90,7 +107,7 @@ async function swipetofit() {
|
|
|
90
107
|
{ type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
|
|
91
108
|
{ type: "pointerDown", button: 0 },
|
|
92
109
|
{ type: "pause", duration: 300 },
|
|
93
|
-
{ type: "pointerMove", duration:
|
|
110
|
+
{ type: "pointerMove", duration: 1000, x: topRightEndX, y: topRightEndY },
|
|
94
111
|
{ type: "pointerUp", button: 0 }
|
|
95
112
|
],
|
|
96
113
|
}
|
|
@@ -106,7 +123,7 @@ async function swipetofit() {
|
|
|
106
123
|
{ type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
|
|
107
124
|
{ type: "pointerDown", button: 0 },
|
|
108
125
|
{ type: "pause", duration: 300 },
|
|
109
|
-
{ type: "pointerMove", duration:
|
|
126
|
+
{ type: "pointerMove", duration: 1000, x: bottomLeftEndX, y: bottomLeftEndY },
|
|
110
127
|
{ type: "pointerUp", button: 0 }
|
|
111
128
|
],
|
|
112
129
|
}
|
|
@@ -143,4 +160,4 @@ async function swipetofit() {
|
|
|
143
160
|
// console.error(error.message);
|
|
144
161
|
// }
|
|
145
162
|
// }
|
|
146
|
-
module.exports = { swipeleft, swipedown, swiperight, swipeup, swipetofit };
|
|
163
|
+
module.exports = { swipeleft, swipedown, swiperight, swipeup, swipetofit ,swipewithcoordinates};
|