froth-webdriverio-framework 3.0.80 → 3.0.81

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.
@@ -56,31 +56,91 @@ async function swipedown(selector, yoffset, speedinsec) {
56
56
  }
57
57
  }
58
58
 
59
-
60
59
  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
- }
60
+ // Get screen size dynamically
61
+ const screenSize = await driver.getWindowRect();
62
+ const screenWidth = screenSize.width;
63
+ const screenHeight = screenSize.height;
64
+
65
+ console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
66
+
67
+ // Define approximate positions for corners
68
+ const topRightStartX = screenWidth * 0.85; // Top-right corner
69
+ const topRightStartY = screenHeight * 0.30;
70
+
71
+ const topRightEndX = screenWidth * 0.95; // Expand to the right
72
+ const topRightEndY = screenHeight * 0.20; // Move upwards slightly
73
+
74
+ const bottomLeftStartX = screenWidth * 0.15; // Bottom-left corner
75
+ const bottomLeftStartY = screenHeight * 0.75;
76
+
77
+ const bottomLeftEndX = screenWidth * 0.05; // Expand to the left
78
+ const bottomLeftEndY = screenHeight * 0.85; // Move down slightly
79
+
80
+ console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
81
+ console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
82
+
83
+ // Resize from top-right corner
84
+ await driver.performActions([
85
+ {
86
+ type: "pointer",
87
+ id: "finger1",
88
+ parameters: { pointerType: "touch" },
89
+ actions: [
90
+ { type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
91
+ { type: "pointerDown", button: 0 },
92
+ { type: "pause", duration: 300 },
93
+ { type: "pointerMove", duration: 500, x: topRightEndX, y: topRightEndY },
94
+ { type: "pointerUp", button: 0 }
95
+ ],
96
+ }
97
+ ]);
98
+
99
+ // Resize from bottom-left corner
100
+ await driver.performActions([
101
+ {
102
+ type: "pointer",
103
+ id: "finger2",
104
+ parameters: { pointerType: "touch" },
105
+ actions: [
106
+ { type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
107
+ { type: "pointerDown", button: 0 },
108
+ { type: "pause", duration: 300 },
109
+ { type: "pointerMove", duration: 500, x: bottomLeftEndX, y: bottomLeftEndY },
110
+ { type: "pointerUp", button: 0 }
111
+ ],
112
+ }
113
+ ]);
114
+
115
+ console.log("✅ Crop overlay resized from two corners successfully!");
85
116
  }
117
+
118
+
119
+
120
+ // async function swipetofit() {
121
+ // try {
122
+ // const { width, height } = await driver.getWindowRect();
123
+
124
+ // console.log('width and height:', width, height);
125
+ // // ⬅ Swipe from right to left (Full Swipe)
126
+
127
+ // await driver.touchAction([
128
+ // { action: 'press', x: width - 10, y: height / 2 }, // Start near the right edge
129
+ // { action: 'wait', ms: 500 }, // Hold to stabilize
130
+ // { action: 'moveTo', x: 10, y: height / 2 }, // Move to the left edge
131
+ // { action: 'release' }
132
+ // ]);
133
+ // // ⬅ Swipe from Left to Right (Full Swipe)
134
+
135
+ // await driver.touchAction([
136
+ // { action: 'press', x: 10, y: height / 2 }, // Start near the left edge
137
+ // { action: 'wait', ms: 500 },
138
+ // { action: 'moveTo', x: width - 10, y: height / 2 }, // Move to the right edge
139
+ // { action: 'release' }
140
+ // ]);
141
+
142
+ // } catch (error) {
143
+ // console.error(error.message);
144
+ // }
145
+ // }
86
146
  module.exports = { swipeleft, swipedown, swiperight, swipeup, swipetofit };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "3.0.80",
3
+ "version": "3.0.81",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",