froth-webdriverio-framework 3.0.34 → 3.0.36
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 +25 -4
- package/commonMethods/alert.js +34 -0
- package/commonMethods/swipe.js +46 -16
- package/package.json +1 -1
package/commonMethods/Utils.js
CHANGED
|
@@ -8,8 +8,13 @@ let scrollToRight = null;
|
|
|
8
8
|
let scrollDownToView = null;
|
|
9
9
|
let scrollRightToView = null;
|
|
10
10
|
|
|
11
|
+
let swipeRight = null;
|
|
12
|
+
let swipeLeft = null;
|
|
13
|
+
let swipeUp = null;
|
|
14
|
+
let swipeDown = null;
|
|
15
|
+
|
|
16
|
+
|
|
11
17
|
let clickIfVisible = null;
|
|
12
|
-
let clickById = null;
|
|
13
18
|
|
|
14
19
|
let assertText = null;
|
|
15
20
|
let randomtext = null;
|
|
@@ -26,9 +31,12 @@ let assertAttributeValue = null;
|
|
|
26
31
|
let basepath = null;
|
|
27
32
|
let scrollIntoView = null;
|
|
28
33
|
|
|
29
|
-
let api=null;
|
|
34
|
+
let api = null;
|
|
30
35
|
|
|
31
|
-
let selectDropDownValue=null;
|
|
36
|
+
let selectDropDownValue = null;
|
|
37
|
+
|
|
38
|
+
let acceptalert = null;
|
|
39
|
+
let dismissalert = null;
|
|
32
40
|
|
|
33
41
|
if (process.env.LOCATION == 'local') {
|
|
34
42
|
basepath = ".";
|
|
@@ -44,6 +52,11 @@ scrollDownToView = require(basepath + '/scroll').scrollDownToView;
|
|
|
44
52
|
scrollRightToView = require(basepath + '/scroll').scrollRightToView;
|
|
45
53
|
scrollIntoView = require(basepath + '/scroll').scrollIntoView;
|
|
46
54
|
|
|
55
|
+
swipeDown = require(basepath + '/swipe').swipedown;
|
|
56
|
+
swipeLeft = require(basepath + '/swipe').swipeleft;
|
|
57
|
+
swipeRight = require(basepath + '/swipe').swiperight;
|
|
58
|
+
swipeUp = require(basepath + '/swipe').swipeup;
|
|
59
|
+
|
|
47
60
|
clickIfVisible = require(basepath + "/click").clickIfVisible;
|
|
48
61
|
clickByIdWithExecute = require(basepath + "/click").clickByIdWithExecute;
|
|
49
62
|
|
|
@@ -67,6 +80,8 @@ validate = require(basepath + '/apicall').validate;
|
|
|
67
80
|
|
|
68
81
|
selectDropDownValue = require(basepath + '/dropDown').select4mDropDownValue;
|
|
69
82
|
|
|
83
|
+
acceptalert = require(basepath + '/alert.js').acceptAlert;
|
|
84
|
+
dismissalert = require(basepath + '/alert.js').dismissAlert;
|
|
70
85
|
|
|
71
86
|
//export the variabels
|
|
72
87
|
module.exports = {
|
|
@@ -93,5 +108,11 @@ module.exports = {
|
|
|
93
108
|
scrollIntoView,
|
|
94
109
|
api,
|
|
95
110
|
validate,
|
|
96
|
-
selectDropDownValue
|
|
111
|
+
selectDropDownValue,
|
|
112
|
+
acceptalert,
|
|
113
|
+
dismissalert,
|
|
114
|
+
swipeLeft,
|
|
115
|
+
swipeRight,
|
|
116
|
+
swipeDown,
|
|
117
|
+
swipeUp
|
|
97
118
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
async function acceptAlert() {
|
|
2
|
+
|
|
3
|
+
try {
|
|
4
|
+
await browser.waitUntil(async () => {
|
|
5
|
+
return await browser.isAlertOpen();
|
|
6
|
+
}, {
|
|
7
|
+
timeout: 5000,
|
|
8
|
+
timeoutMsg: 'Expected alert to appear but it did not'
|
|
9
|
+
});
|
|
10
|
+
await browser.acceptAlert();
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.log("error occured while accepting alert", e)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function dismissAlert() {
|
|
18
|
+
try {
|
|
19
|
+
await browser.waitUntil(async () => {
|
|
20
|
+
return await browser.isAlertOpen();
|
|
21
|
+
}, {
|
|
22
|
+
timeout: 5000,
|
|
23
|
+
timeoutMsg: 'Expected alert to appear but it did not'
|
|
24
|
+
});
|
|
25
|
+
await browser.dismissAlert();
|
|
26
|
+
|
|
27
|
+
} catch (e) {
|
|
28
|
+
console.log("error occured while dismissing alert", e)
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = { acceptAlert, dismissAlert };
|
package/commonMethods/swipe.js
CHANGED
|
@@ -1,29 +1,59 @@
|
|
|
1
|
-
async function swipeleft(selector,xoffset,speedinsec) {
|
|
1
|
+
async function swipeleft(selector, xoffset, speedinsec) {
|
|
2
2
|
try {
|
|
3
3
|
console.log('Swiping left');
|
|
4
|
-
|
|
5
|
-
if(xoffset == null){
|
|
6
|
-
browser.swipeLeft(selector,speedinsec);
|
|
7
|
-
}else{
|
|
8
|
-
browser.swipeLeft(selector,xoffset,speedinsec);
|
|
4
|
+
|
|
5
|
+
if (xoffset == null) {
|
|
6
|
+
browser.swipeLeft(selector, speedinsec);
|
|
7
|
+
} else {
|
|
8
|
+
browser.swipeLeft(selector, xoffset, speedinsec);
|
|
9
9
|
}
|
|
10
10
|
} catch (error) {
|
|
11
11
|
console.error(error.message);
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
async function swiperight(selector,xoffset,speedinsec) {
|
|
16
|
+
async function swiperight(selector, xoffset, speedinsec) {
|
|
17
17
|
try {
|
|
18
|
-
console.log('Swiping
|
|
19
|
-
|
|
20
|
-
if(xoffset == null){
|
|
21
|
-
browser.swipeRight(selector,speedinsec);
|
|
22
|
-
}else{
|
|
23
|
-
browser.swipeRight(selector,xoffset,speedinsec);
|
|
18
|
+
console.log('Swiping right');
|
|
19
|
+
|
|
20
|
+
if (xoffset == null) {
|
|
21
|
+
browser.swipeRight(selector, speedinsec);
|
|
22
|
+
} else {
|
|
23
|
+
browser.swipeRight(selector, xoffset, speedinsec);
|
|
24
24
|
}
|
|
25
25
|
} catch (error) {
|
|
26
26
|
console.error(error.message);
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function swipeup(selector, yoffset, speedinsec) {
|
|
32
|
+
try {
|
|
33
|
+
console.log('Swiping up');
|
|
34
|
+
|
|
35
|
+
if (yoffset == null) {
|
|
36
|
+
browser.swipeUp(selector, speedinsec);
|
|
37
|
+
} else {
|
|
38
|
+
browser.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
|
+
browser.swipeDown(selector, speedinsec);
|
|
51
|
+
} else {
|
|
52
|
+
browser.swipeDown(selector, yoffset, speedinsec);
|
|
53
|
+
}
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error(error.message);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = { swipeleft, swipedown, swiperight, swipeup };
|