froth-webdriverio-framework 3.0.105 → 3.0.107
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/froth_common_actions/swipe.js +86 -60
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ async function swipedown(selector, yoffset, speedinsec) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
async function swipewithcoordinates(StartX, StartY, EndX, EndY) {
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
await driver.performActions([
|
|
62
62
|
{
|
|
63
63
|
type: "pointer",
|
|
@@ -132,62 +132,88 @@ async function swipetofit() {
|
|
|
132
132
|
console.log("✅ Crop overlay resized from two corners successfully!");
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
async function swipetofit(TopRStartXpct, TopRStartYpct, TopREndXpct, TopREndYpct, BottomLStartXpct, BottomLStartYpct, BottomLEndXpct, BottomLEndYpct) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
135
|
+
// async function swipetofit(TopRStartXpct, TopRStartYpct, TopREndXpct, TopREndYpct, BottomLStartXpct, BottomLStartYpct, BottomLEndXpct, BottomLEndYpct) {
|
|
136
|
+
|
|
137
|
+
// let topRightStartX; // Top-right corner
|
|
138
|
+
// let topRightStartY;
|
|
139
|
+
|
|
140
|
+
// let topRightEndX; // Expand to the right
|
|
141
|
+
// let topRightEndY; // Move upwards slightly
|
|
142
|
+
|
|
143
|
+
// let bottomLeftStartX; // Bottom-left corner
|
|
144
|
+
// let bottomLeftStartY;
|
|
145
|
+
|
|
146
|
+
// let bottomLeftEndX; // Expand to the left
|
|
147
|
+
// let bottomLeftEndY;
|
|
148
|
+
|
|
149
|
+
// // Get screen size dynamically
|
|
150
|
+
// const screenSize = await driver.getWindowRect();
|
|
151
|
+
// const screenWidth = screenSize.width;
|
|
152
|
+
// const screenHeight = screenSize.height;
|
|
153
|
+
|
|
154
|
+
// console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
|
|
155
|
+
// // Define approximate positions for corners
|
|
156
|
+
|
|
157
|
+
// if (TopRStartXpct === null) {// default calucaltion
|
|
158
|
+
// topRightStartX = screenWidth * 0.88; // Top-right corner
|
|
159
|
+
// topRightStartY = screenHeight * 0.44;
|
|
160
|
+
|
|
161
|
+
// topRightEndX = screenWidth * 0.96; // Expand to the right
|
|
162
|
+
// topRightEndY = screenHeight * 0.39; // Move upwards slightly
|
|
163
|
+
|
|
164
|
+
// bottomLeftStartX = screenWidth * 0.12; // Bottom-left corner
|
|
165
|
+
// bottomLeftStartY = screenHeight * 0.69;
|
|
166
|
+
|
|
167
|
+
// bottomLeftEndX = screenWidth * 0.014; // Expand to the left
|
|
168
|
+
// bottomLeftEndY = screenHeight * 0.73;
|
|
169
|
+
// } else {
|
|
170
|
+
// topRightStartX = screenWidth * (TopRStartXpct / 100); // Top-right corner
|
|
171
|
+
// topRightStartY = screenHeight * (TopRStartYpct / 100);
|
|
172
|
+
|
|
173
|
+
// topRightEndX = screenWidth * (TopREndXpct / 100); // Expand to the right
|
|
174
|
+
// topRightEndY = screenHeight * (TopREndYpct / 100); // Move upwards slightly
|
|
175
|
+
|
|
176
|
+
// bottomLeftStartX = screenWidth * (BottomLStartXpct / 100); // Bottom-left corner
|
|
177
|
+
// bottomLeftStartY = screenHeight * (BottomLStartYpct / 100);
|
|
178
|
+
|
|
179
|
+
// bottomLeftEndX = screenWidth * (BottomLEndXpct / 100); // Expand to the left
|
|
180
|
+
// bottomLeftEndY = screenHeight * (BottomLEndYpct / 100); // Move down slightly
|
|
181
|
+
// }
|
|
182
|
+
// console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
|
|
183
|
+
// console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
|
|
184
|
+
|
|
185
|
+
// // Resize from top-right corner
|
|
186
|
+
// await driver.performActions([
|
|
187
|
+
// {
|
|
188
|
+
// type: "pointer",
|
|
189
|
+
// id: "finger1",
|
|
190
|
+
// parameters: { pointerType: "touch" },
|
|
191
|
+
// actions: [
|
|
192
|
+
// { type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
|
|
193
|
+
// { type: "pointerDown", button: 0 },
|
|
194
|
+
// { type: "pause", duration: 300 },
|
|
195
|
+
// { type: "pointerMove", duration: 1000, x: topRightEndX, y: topRightEndY },
|
|
196
|
+
// { type: "pointerUp", button: 0 }
|
|
197
|
+
// ],
|
|
198
|
+
// }
|
|
199
|
+
// ]);
|
|
200
|
+
|
|
201
|
+
// // Resize from bottom-left corner
|
|
202
|
+
// await driver.performActions([
|
|
203
|
+
// {
|
|
204
|
+
// type: "pointer",
|
|
205
|
+
// id: "finger2",
|
|
206
|
+
// parameters: { pointerType: "touch" },
|
|
207
|
+
// actions: [
|
|
208
|
+
// { type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
|
|
209
|
+
// { type: "pointerDown", button: 0 },
|
|
210
|
+
// { type: "pause", duration: 300 },
|
|
211
|
+
// { type: "pointerMove", duration: 1000, x: bottomLeftEndX, y: bottomLeftEndY },
|
|
212
|
+
// { type: "pointerUp", button: 0 }
|
|
213
|
+
// ],
|
|
214
|
+
// }
|
|
215
|
+
// ]);
|
|
216
|
+
|
|
217
|
+
// console.log("✅ Crop overlay resized from two corners successfully!");
|
|
218
|
+
// }
|
|
219
|
+
module.exports = { swipeleft, swipedown, swiperight, swipeup, swipetofit, swipewithcoordinates };
|