froth-webdriverio-framework 3.0.78 → 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/click.js +23 -0
- package/commonMethods/jwt.js +3 -3
- 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/click.js
CHANGED
|
@@ -20,6 +20,29 @@ async function clickIfVisible(elementSelector) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
async function dobubleClick(elementSelector) {
|
|
24
|
+
try {
|
|
25
|
+
let isDisplayed;
|
|
26
|
+
// Wait for the element to be visible
|
|
27
|
+
await driver.waitUntil(async () => {
|
|
28
|
+
console.log("Waiting for element to be visible");
|
|
29
|
+
const element = await $(elementSelector);
|
|
30
|
+
isDisplayed = await element.isDisplayed();
|
|
31
|
+
console.log("Element is displayed:", isDisplayed);
|
|
32
|
+
if (isDisplayed) {
|
|
33
|
+
// Get the actual text from the element
|
|
34
|
+
const element = await $(elementSelector);
|
|
35
|
+
await element.doubleClick();
|
|
36
|
+
console.log("Element is double clicked successfully.");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}, { timeout: 30000 });
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error("Element not found or not visible within 30 seconds");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
23
46
|
|
|
24
47
|
async function clickByIdWithExecute(elementid) {
|
|
25
48
|
try {
|
package/commonMethods/jwt.js
CHANGED
|
@@ -54,11 +54,11 @@ function main() {
|
|
|
54
54
|
iat: currentTimestamp, // Issued at
|
|
55
55
|
exp: currentTimestamp + 200, // Expiry time: 30 seconds from issuance
|
|
56
56
|
user_agent: {
|
|
57
|
-
id: "janga.reddy@
|
|
57
|
+
id: "janga.reddy@ytl.com"
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
console.log('JWT signed token:', generateJWTToken(payload));
|
|
62
62
|
}
|
|
63
|
-
main()
|
|
64
|
-
|
|
63
|
+
//main()
|
|
64
|
+
module.exports = { generateJWTToken}
|
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 };
|