froth-webdriverio-framework 7.0.43 → 7.0.45

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,45 +0,0 @@
1
- async function STORETEXT(element, buffername) {
2
-
3
- try {
4
- let ele = await $(element);
5
- // Get the actual text from the specified attribute
6
- const actualText = await ele.getText();
7
- console.log('Text stored in buffer:', actualText);
8
- BUFFER.setItem(buffername, actualText);
9
-
10
- } catch (error) {
11
- console.log('Excption occured during storing the text into buffer', `${error.message}`);
12
- console.error(error.message);
13
- }
14
- }
15
-
16
- async function STOREVALUE(element, buffername) {
17
-
18
- try {
19
- let ele = await $(element);
20
- // Get the actual text from the specified attribute
21
- const actualText = await ele.getValue();
22
- console.log('Value stored in buffer:', actualText);
23
- BUFFER.setItem(buffername, actualText);
24
-
25
- } catch (error) {
26
- console.log('Excption occured during storing the value into buffer', `${error.message}`);
27
- console.error(error.message);
28
- }
29
- }
30
-
31
- async function STOREATTRIBUTEVALUE(element, attribute, buffername) {
32
-
33
- try {
34
- let ele = await $(element);
35
- // Get the actual text from the specified attribute
36
- const actualText = await ele.getAttribute(attribute);
37
- console.log('Attr value stored in buffer:', actualText);
38
- BUFFER.setItem(buffername, actualText);
39
-
40
- } catch (error) {
41
- console.log('Excption occured during storing the attribute value into buffer', `${error.message}`);
42
- console.error(error.message);
43
- }
44
- }
45
- module.exports = { STORETEXT, STOREVALUE, STOREATTRIBUTEVALUE };
@@ -1,36 +0,0 @@
1
- /**
2
- * Switches to a browser window/tab by its title using WebdriverIO.
3
- * @param {string} title - The title of the window/tab to switch to.
4
- */
5
- async function switch2WindowByTitle(title) {
6
- const handles = await browser.getWindowHandles();
7
- for (const handle of handles) {
8
- await browser.switchToWindow(handle);
9
- const currentTitle = await browser.getTitle();
10
- if (currentTitle === title) {
11
- return true; // Switched successfully
12
- }
13
- }
14
- throw new Error(`No window with title "${title}" found.`);
15
- }
16
-
17
- /**
18
- * Switches to a browser window/tab by its index using WebdriverIO.
19
- * @param {number} index - The index of the window/tab to switch to (0-based).
20
- */
21
- async function switch2WindowByIndex(index) {
22
- const handles = await browser.getWindowHandles();
23
- console.log(`Total open windows: ${handles.length}`);
24
- console.log(`Switching to window at index: ${index}`);
25
- console.log(`Available handles: ${handles.join(', ')}`);
26
- if (index < 0 || index >= handles.length) {
27
- throw new Error(`Invalid window index: ${index}. There are only ${handles.length} windows open.`);
28
- }
29
- await browser.switchToWindow(handles[index]);
30
- return true; // Switched successfully
31
- }
32
-
33
-
34
- // Example usage in a test
35
- // await switchToWindowByTitle('Your Window Title');
36
- module.exports = {switch2WindowByTitle,switch2WindowByIndex};
@@ -1,219 +0,0 @@
1
- async function swipeleft(selector, xoffset, speedinsec) {
2
- try {
3
- console.log('Swiping left');
4
-
5
- if (xoffset == null) {
6
- driver.swipeLeft(selector, speedinsec);
7
- } else {
8
- driver.swipeLeft(selector, xoffset, speedinsec);
9
- }
10
- } catch (error) {
11
- console.error(error.message);
12
- }
13
-
14
- }
15
-
16
- async function swiperight(selector, xoffset, speedinsec) {
17
- try {
18
- console.log('Swiping right');
19
-
20
- if (xoffset == null) {
21
- driver.swipeRight(selector, speedinsec);
22
- } else {
23
- driver.swipeRight(selector, xoffset, speedinsec);
24
- }
25
- } catch (error) {
26
- console.error(error.message);
27
- }
28
-
29
- }
30
-
31
- async function swipeup(selector, yoffset, speedinsec) {
32
- try {
33
- console.log('Swiping up');
34
-
35
- if (yoffset == null) {
36
- driver.swipeUp(selector, speedinsec);
37
- } else {
38
- driver.swipeUp(selector, yoffset, speedinsec);
39
- }
40
- } catch (error) {
41
- console.error(error.message);
42
- }
43
- }
44
-
45
- async function swipedown(selector, yoffset, speedinsec) {
46
- try {
47
- console.log('Swiping down');
48
-
49
- if (yoffset == null) {
50
- driver.swipeDown(selector, speedinsec);
51
- } else {
52
- driver.swipeDown(selector, yoffset, speedinsec);
53
- }
54
- } catch (error) {
55
- console.error(error.message);
56
- }
57
- }
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
- }
76
- async function swipetofit() {
77
- // Get screen size dynamically
78
- const screenSize = await driver.getWindowRect();
79
- const screenWidth = screenSize.width;
80
- const screenHeight = screenSize.height;
81
-
82
- console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
83
-
84
- // Define approximate positions for corners
85
- const topRightStartX = screenWidth * 0.88; // Top-right corner
86
- const topRightStartY = screenHeight * 0.44;
87
-
88
- const topRightEndX = screenWidth * 0.96; // Expand to the right
89
- const topRightEndY = screenHeight * 0.39; // Move upwards slightly
90
-
91
- const bottomLeftStartX = screenWidth * 0.12; // Bottom-left corner
92
- const bottomLeftStartY = screenHeight * 0.69;
93
-
94
- const bottomLeftEndX = screenWidth * 0.014; // Expand to the left
95
- const bottomLeftEndY = screenHeight * 0.73; // Move down slightly
96
-
97
- console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
98
- console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
99
-
100
- // Resize from top-right corner
101
- await driver.performActions([
102
- {
103
- type: "pointer",
104
- id: "finger1",
105
- parameters: { pointerType: "touch" },
106
- actions: [
107
- { type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
108
- { type: "pointerDown", button: 0 },
109
- { type: "pause", duration: 300 },
110
- { type: "pointerMove", duration: 1000, x: topRightEndX, y: topRightEndY },
111
- { type: "pointerUp", button: 0 }
112
- ],
113
- }
114
- ]);
115
-
116
- // Resize from bottom-left corner
117
- await driver.performActions([
118
- {
119
- type: "pointer",
120
- id: "finger2",
121
- parameters: { pointerType: "touch" },
122
- actions: [
123
- { type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
124
- { type: "pointerDown", button: 0 },
125
- { type: "pause", duration: 300 },
126
- { type: "pointerMove", duration: 1000, x: bottomLeftEndX, y: bottomLeftEndY },
127
- { type: "pointerUp", button: 0 }
128
- ],
129
- }
130
- ]);
131
-
132
- console.log("✅ Crop overlay resized from two corners successfully!");
133
- }
134
-
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 };