froth-webdriverio-framework 3.0.65 → 3.0.67
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/android/samplescript.js +199 -0
- package/android_suites/samplsuite.js +16 -0
- package/api/browsersatckSessionInfo.js +6 -2
- package/commonMethods/Utils.js +1 -1
- package/config/android.conf.js +2 -2
- package/config/commonconfig.js +47 -40
- package/config/dataHandler.js +5 -0
- package/config/injectimage.js +3 -2
- package/config/wdio.common.conf.js +62 -0
- package/logs/bstack-wdio-service.log +32 -0
- package/logs/funnelData.json +1 -0
- package/package.json +4 -2
- package/ymls/browserstack/android/sample.yml +17 -0
- package/api/getDBdetails.js +0 -70
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
const Util = require('../config/dataHandler.js');
|
|
2
|
+
|
|
3
|
+
describe('Yes Shop Prepaid Registration', () => {
|
|
4
|
+
|
|
5
|
+
it('Yes Shop Prepaid Registration', async () => {
|
|
6
|
+
|
|
7
|
+
// File URLs from BrowserStack
|
|
8
|
+
const idCardFileUrl = "https://drive.google.com/file/d/1t5KZ7a6JLS97khFnuUS-_aOa6EY4a9H0/view?usp=sharing"; // Replace with actual file ID for ID card
|
|
9
|
+
const videoFileUrl = "https://drive.google.com/file/d/1PYMY2LQ-GFFKJ1wC5yRNflcxfA3ATgvW/view?usp=sharing"; // Replace with actual file ID for video
|
|
10
|
+
const el1 = await driver.$("id:com.ytlcomms.ymca:id/yesLogoIv");
|
|
11
|
+
await el1.click();
|
|
12
|
+
await el1.click();
|
|
13
|
+
await el1.click();
|
|
14
|
+
await el1.click();
|
|
15
|
+
await el1.click();
|
|
16
|
+
await el1.click();
|
|
17
|
+
await el1.click();
|
|
18
|
+
await el1.click();
|
|
19
|
+
await el1.click();
|
|
20
|
+
await el1.click();
|
|
21
|
+
const el2 = await driver.$("id:com.ytlcomms.ymca:id/etBetaUserId");
|
|
22
|
+
await el2.addValue("alpha_login");
|
|
23
|
+
const el3 = await driver.$("id:com.ytlcomms.ymca:id/etBetaUserPass");
|
|
24
|
+
await el3.addValue("@45kj*3d");
|
|
25
|
+
const el411 = await driver.$("id:com.ytlcomms.ymca:id/btBetaSignIn");
|
|
26
|
+
await el411.click();
|
|
27
|
+
const el51 = await driver.$("id:com.ytlcomms.ymca:id/iotUrl");
|
|
28
|
+
await el51.click();
|
|
29
|
+
/*To scroll to the down of the screen until text is visible */
|
|
30
|
+
await Util.F.scrollDownToView("GO BACK")
|
|
31
|
+
|
|
32
|
+
const el61 = await driver.$("id:com.ytlcomms.ymca:id/btGoBack");
|
|
33
|
+
await el61.click();
|
|
34
|
+
const el71 = await driver.$("id:com.ytlcomms.ymca:id/mUserId");
|
|
35
|
+
await el71.addValue("pdc_branch");
|
|
36
|
+
const el81 = await driver.$("id:com.ytlcomms.ymca:id/mPassword");
|
|
37
|
+
await el81.addValue("ytlc@xm1234");
|
|
38
|
+
const el91 = await driver.$("id:com.ytlcomms.ymca:id/btSignIn");
|
|
39
|
+
await el91.click();
|
|
40
|
+
// Start the automation script
|
|
41
|
+
const el4 = await driver.$("-android uiautomator:new UiSelector().text(\"Registration\")");
|
|
42
|
+
await el4.click();
|
|
43
|
+
|
|
44
|
+
const el5 = await driver.$("-android uiautomator:new UiSelector().text(\"Prepaid\")");
|
|
45
|
+
await el5.click();
|
|
46
|
+
|
|
47
|
+
// Trigger ID card upload
|
|
48
|
+
const el6 = await driver.$("id:com.ytlcomms.ymca:id/ekycMyKadBtn");
|
|
49
|
+
await el6.click();
|
|
50
|
+
|
|
51
|
+
const el7 = await driver.$("id:com.android.permissioncontroller:id/permission_allow_one_time_button");
|
|
52
|
+
await el7.click();
|
|
53
|
+
|
|
54
|
+
const el8 = await driver.$("id:com.ytlcomms.ymca:id/ekycMyKadBtn");
|
|
55
|
+
await el8.click();
|
|
56
|
+
|
|
57
|
+
const el9 = await driver.$("id:com.ytlcomms.ymca:id/skipBtn");
|
|
58
|
+
await el9.click();
|
|
59
|
+
|
|
60
|
+
const el10 = await driver.$("id:com.ytlcomms.ymca:id/selectCountryBtn");
|
|
61
|
+
await el10.click();
|
|
62
|
+
|
|
63
|
+
await driver.execute('browserstack_executor: {"action":"cameraImageInjection", "arguments": {"imageUrl" : "media://b44ff746563b5e458e2b5034d3cb25263ad24ebd"}}');
|
|
64
|
+
|
|
65
|
+
const el11 = await driver.$("id:com.ytlcomms.ymca:id/confirmBtn");
|
|
66
|
+
await el11.click();
|
|
67
|
+
await driver.pause(3000)
|
|
68
|
+
|
|
69
|
+
const el12 = await driver.$("id:com.sec.android.app.camera:id/bottom_background");
|
|
70
|
+
await el12.click();
|
|
71
|
+
|
|
72
|
+
await driver.pause(3000)
|
|
73
|
+
|
|
74
|
+
////android.widget.Button[@resource-id="com.sec.android.app.camera:id/okay"]
|
|
75
|
+
|
|
76
|
+
const el13 = await driver.$("//android.widget.Button[@resource-id='com.sec.android.app.camera:id/okay']");
|
|
77
|
+
await el13.click();
|
|
78
|
+
// const el29 = await driver.$("id:com.ytlcomms.ymca:id/selectCountryBtn");
|
|
79
|
+
// await el29.click();
|
|
80
|
+
|
|
81
|
+
await driver.pause(10000)
|
|
82
|
+
try {
|
|
83
|
+
await driver.action('pointer')
|
|
84
|
+
.move({
|
|
85
|
+
duration: 0,
|
|
86
|
+
x: 937,
|
|
87
|
+
y: 905
|
|
88
|
+
})
|
|
89
|
+
.down({
|
|
90
|
+
button: 0
|
|
91
|
+
})
|
|
92
|
+
.move({
|
|
93
|
+
duration: 1000,
|
|
94
|
+
x: 1043,
|
|
95
|
+
y: 696
|
|
96
|
+
})
|
|
97
|
+
.up({
|
|
98
|
+
button: 0
|
|
99
|
+
})
|
|
100
|
+
.perform();
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
} catch (e) {
|
|
104
|
+
console.error('Error in right :', e);
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
await driver.action('pointer')
|
|
109
|
+
.move({
|
|
110
|
+
duration: 0,
|
|
111
|
+
x: 134,
|
|
112
|
+
y: 1498
|
|
113
|
+
})
|
|
114
|
+
.down({
|
|
115
|
+
button: 0
|
|
116
|
+
})
|
|
117
|
+
.move({
|
|
118
|
+
duration: 1000,
|
|
119
|
+
x: 28,
|
|
120
|
+
y: 1723
|
|
121
|
+
})
|
|
122
|
+
.up({
|
|
123
|
+
button: 0
|
|
124
|
+
})
|
|
125
|
+
.perform();
|
|
126
|
+
|
|
127
|
+
//
|
|
128
|
+
} catch (e) {
|
|
129
|
+
console.error('Error in left:', e);
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
await driver.pause(10000) // Confirm upload
|
|
133
|
+
|
|
134
|
+
const el16 = await driver.$("//android.widget.TextView[@text='Done']");
|
|
135
|
+
await el16.click();
|
|
136
|
+
|
|
137
|
+
await driver.pause(30000)
|
|
138
|
+
const el17 = await driver.$("id:com.ytlcomms.ymca:id/newRb");
|
|
139
|
+
await el17.click();
|
|
140
|
+
|
|
141
|
+
await Util.F.scrollDownToView("Facial Recognition")
|
|
142
|
+
|
|
143
|
+
const el18 = await driver.$("id:com.ytlcomms.ymca:id/frRecognitionBtn");
|
|
144
|
+
await el18.click();
|
|
145
|
+
const el19 = await driver.$("id:com.ytlcomms.ymca:id/skipBtn");
|
|
146
|
+
await el19.click();
|
|
147
|
+
|
|
148
|
+
await driver.execute('browserstack_executor: {"action":"cameraVideoInjection", "arguments": {"videoUrl" : "media://1920c80136e1c7e2278e15d820845ed64a676e92"}}');
|
|
149
|
+
|
|
150
|
+
const el20 = await driver.$("id:com.ytlcomms.ymca:id/startBtn");
|
|
151
|
+
await el20.click();
|
|
152
|
+
|
|
153
|
+
await driver.pause(3000)
|
|
154
|
+
|
|
155
|
+
const el21 = await driver.$("id:com.ytlcomms.ymca:id/captureVideo");
|
|
156
|
+
await el21.click();
|
|
157
|
+
|
|
158
|
+
await driver.pause(10000)
|
|
159
|
+
|
|
160
|
+
////android.widget.Button[@resource-id="com.sec.android.app.camera:id/okay"]
|
|
161
|
+
|
|
162
|
+
// const el13 = await driver.$("//android.widget.Button[@resource-id='com.sec.android.app.camera:id/okay']");
|
|
163
|
+
// await el13.click();
|
|
164
|
+
//99999999
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
// Trigger video upload for face recognition
|
|
168
|
+
// const el18 = await driver.$("id:com.ytlcomms.ymca:id/frRecognitionBtn");
|
|
169
|
+
// await el18.click();
|
|
170
|
+
// await driver.execute("mobile: uploadFile", { file: videoFileUrl }); // Upload video
|
|
171
|
+
|
|
172
|
+
// Complete the remaining flow
|
|
173
|
+
const el25 = await driver.$("-android uiautomator:new UiSelector().text('-- PLAN --')");
|
|
174
|
+
await el25.click();
|
|
175
|
+
|
|
176
|
+
const el26 = await driver.$("-android uiautomator:new UiSelector().text('YES 5G Prepaid')");
|
|
177
|
+
await el26.click();
|
|
178
|
+
|
|
179
|
+
const el44 = await driver.$("id:com.ytlcomms.ymca:id/submitBtn");
|
|
180
|
+
await el44.click();
|
|
181
|
+
|
|
182
|
+
const el40 = await driver.$("id:com.ytlcomms.ymca:id/eSimRb");
|
|
183
|
+
await el40.click();
|
|
184
|
+
const el41 = await driver.$("id:com.ytlcomms.ymca:id/optionalMobTitleLabel");
|
|
185
|
+
await el41.click();
|
|
186
|
+
//add scroll here
|
|
187
|
+
|
|
188
|
+
const el42 = await driver.$("-android uiautomator:new UiSelector().text('01117242402')");
|
|
189
|
+
await el42.click();
|
|
190
|
+
const el43 = await driver.$("id:com.ytlcomms.ymca:id/md_buttonDefaultPositive");
|
|
191
|
+
await el43.click();
|
|
192
|
+
//add scroll to end here
|
|
193
|
+
|
|
194
|
+
const el45 = await driver.$("id:com.ytlcomms.ymca:id/submitBtn");
|
|
195
|
+
await el45.click();
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
});
|
|
199
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// iOS Suite: Login and Logout Suite
|
|
2
|
+
// const deepmerge = require('deepmerge')
|
|
3
|
+
// const androidconfig = require('../config/wdio.common.conf.js');
|
|
4
|
+
|
|
5
|
+
// const specconfig = deepmerge.all([androidconfig, {
|
|
6
|
+
// specs: [["../android/samplescript.js"]]
|
|
7
|
+
// }
|
|
8
|
+
// ]);
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
tests: [
|
|
12
|
+
'../android/samplescript.js'
|
|
13
|
+
]
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//module.exports.config = specconfig;
|
|
@@ -5,12 +5,13 @@ async function getBSBuildDetails(sessiontype, bs_username, bs_pwd) {
|
|
|
5
5
|
console.log("sessiontype:" + sessiontype)
|
|
6
6
|
const username = bs_username;
|
|
7
7
|
const accessKey = bs_pwd;
|
|
8
|
+
console.log("accessKey:" + accessKey)
|
|
8
9
|
const basicAuth = btoa(`${username}:${accessKey}`);
|
|
9
10
|
|
|
10
11
|
let hashed_id = null;
|
|
11
12
|
|
|
12
13
|
// const sessionid= BUFFER.getItem("SESSION_ID");
|
|
13
|
-
|
|
14
|
+
console.log("Browsersatck build name :" + process.env.BROWSERSTACK_BUILD_NAME)
|
|
14
15
|
const url = `https://api.browserstack.com/${sessiontype}/builds.json?name=${process.env.BROWSERSTACK_BUILD_NAME}`;
|
|
15
16
|
|
|
16
17
|
console.log("url:" + url)
|
|
@@ -35,6 +36,7 @@ async function getBSBuildDetails(sessiontype, bs_username, bs_pwd) {
|
|
|
35
36
|
} else {
|
|
36
37
|
const errorText = await response.text();
|
|
37
38
|
console.error(`Data fetch failed response in getBSBuildDetails:${response.status}`);
|
|
39
|
+
// console.error(`Data fetch failed response in getBSBuildDetails:${errorText}`);
|
|
38
40
|
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -52,7 +54,9 @@ async function getBSSessionDetails(sessiontype, bs_username, bs_pwd) {
|
|
|
52
54
|
try {
|
|
53
55
|
// const sessionId = sessionIdd;
|
|
54
56
|
const username = bs_username;
|
|
55
|
-
const accessKey = Buffer.from(bs_pwd, 'base64').toString('utf-8');
|
|
57
|
+
// const accessKey = Buffer.from(bs_pwd, 'base64').toString('utf-8');
|
|
58
|
+
const accessKey = bs_pwd;
|
|
59
|
+
|
|
56
60
|
const basicAuth = btoa(`${username}:${accessKey}`);
|
|
57
61
|
|
|
58
62
|
const hash_id = await getBSBuildDetails(sessiontype, bs_username, accessKey)
|
package/commonMethods/Utils.js
CHANGED
|
@@ -40,7 +40,7 @@ let dismissalert = null;
|
|
|
40
40
|
|
|
41
41
|
let generateJWT=null;
|
|
42
42
|
|
|
43
|
-
if (process.env.LOCATION == 'local') {
|
|
43
|
+
if (process.env.LOCATION ==null || process.env.LOCATION == 'local') {
|
|
44
44
|
basepath = ".";
|
|
45
45
|
} else {
|
|
46
46
|
basepath = "froth-webdriverio-framework/commonMethods";
|
package/config/android.conf.js
CHANGED
|
@@ -31,8 +31,8 @@ const androidConfig = deepmerge.all([commonmobileconfig, {
|
|
|
31
31
|
networkLogs: "true",
|
|
32
32
|
debug: "true",
|
|
33
33
|
appProfiling: "true",
|
|
34
|
-
enableCameraImageInjection: true,
|
|
35
|
-
|
|
34
|
+
//enableCameraImageInjection: true,
|
|
35
|
+
// enableCameraVideoInjection: true,
|
|
36
36
|
deviceOrientation: process.env.DEVICENAME.toLowerCase().includes('tab') ? 'landscape' : 'portrait',
|
|
37
37
|
}
|
|
38
38
|
}],
|
package/config/commonconfig.js
CHANGED
|
@@ -5,7 +5,7 @@ const path = require('path');
|
|
|
5
5
|
const exeDetails = require("../api/getexecutionDetails")
|
|
6
6
|
const getBSSessionDetails = require("../api/browsersatckSessionInfo").getBSSessionDetails;
|
|
7
7
|
const { fail } = require("assert");
|
|
8
|
-
const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
8
|
+
//const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
9
9
|
let starttime;
|
|
10
10
|
let endtime;
|
|
11
11
|
|
|
@@ -14,27 +14,36 @@ const commonconfig = {
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
onPrepare: async function (capabilities, specs) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
try {
|
|
18
|
+
console.log('====> This is the onPrepare hook');
|
|
19
|
+
// This code runs before the test suite starts
|
|
20
|
+
await setAllDetails.setEnvVariables();
|
|
21
|
+
await setAllDetails.setLoginToken();
|
|
22
|
+
await setAllDetails.setExecutionDetails();
|
|
23
|
+
// await setAllDetails.setIntegrationsDetails();
|
|
24
|
+
await setAllDetails.setSuiteDetails();
|
|
25
|
+
await setAllDetails.setTestDataDetails();
|
|
26
|
+
// console.log(JSON.stringify(capabilities))
|
|
27
|
+
// console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.log("====> Error in onPrepare:", e);
|
|
30
|
+
|
|
31
|
+
}
|
|
26
32
|
},
|
|
27
33
|
|
|
28
34
|
|
|
29
|
-
beforeSession: async function (config, capabilities,specs
|
|
30
|
-
console.log('
|
|
35
|
+
beforeSession: async function (config, capabilities, specs) {
|
|
36
|
+
console.log('====> This is the beforesession hook');
|
|
31
37
|
// Perform any setup or pre-test actions here
|
|
32
|
-
|
|
38
|
+
// console.log("Capabilities:", capabilities);
|
|
33
39
|
console.log("Specs:", specs.length);
|
|
34
|
-
const specdat=specs
|
|
40
|
+
const specdat = specs
|
|
35
41
|
console.log("specdat:", specdat);
|
|
36
42
|
console.log("length:", specdat.length);
|
|
37
|
-
|
|
43
|
+
|
|
44
|
+
console.log(`Running tests on: ${capabilities.platformName} ${capabilities.browserName} ${capabilities.browserVersion}`);
|
|
45
|
+
// console.log('specs:', specs);
|
|
46
|
+
// console.log("Config:", config);
|
|
38
47
|
},
|
|
39
48
|
/**
|
|
40
49
|
* Gets executed before the suite starts (in Mocha/Jasmine only).
|
|
@@ -42,14 +51,14 @@ const commonconfig = {
|
|
|
42
51
|
*/
|
|
43
52
|
beforeSuite: async function (suite) {
|
|
44
53
|
try {
|
|
45
|
-
console.log(
|
|
54
|
+
console.log(`====> Test suite has been started ' ${suite.title}' `,);
|
|
46
55
|
|
|
47
56
|
starttime = new Date().getTime();
|
|
48
57
|
|
|
49
|
-
|
|
58
|
+
// if (isBrowserStackEnabled) {
|
|
50
59
|
console.log("BrowserStack is enabled");
|
|
51
60
|
await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
|
|
52
|
-
|
|
61
|
+
// }
|
|
53
62
|
const resultdetails = {};
|
|
54
63
|
exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
55
64
|
|
|
@@ -64,7 +73,7 @@ const commonconfig = {
|
|
|
64
73
|
* @param {object} context scope object the test was executed with
|
|
65
74
|
*/
|
|
66
75
|
beforeTest: function (test, context) {
|
|
67
|
-
console.log(
|
|
76
|
+
console.log(`====> Test Started '${test.title}'`);
|
|
68
77
|
|
|
69
78
|
// console.log("File Name:", test.file);
|
|
70
79
|
|
|
@@ -82,13 +91,14 @@ const commonconfig = {
|
|
|
82
91
|
* @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
|
|
83
92
|
*/
|
|
84
93
|
afterTest: async function (test, context, { error, result, duration, passed, retries }) {
|
|
85
|
-
console.log(
|
|
94
|
+
console.log(`====> Test name finished '${test.title}'`);
|
|
86
95
|
|
|
87
96
|
const fileName = path.basename(test.file);
|
|
88
|
-
console.log('
|
|
97
|
+
console.log('====> Test File Name:', fileName);
|
|
89
98
|
// BUFFER.setItem("FROTH_TOTAL_DURATION", Number(BUFFER.getItem("FROTH_TOTAL_DURATION")) + duration)
|
|
90
|
-
console.log(
|
|
91
|
-
console.log(
|
|
99
|
+
console.log(`====> Total Duration for this test: ${duration}ms`);
|
|
100
|
+
console.log(`====> Status of test: ${passed}`);
|
|
101
|
+
|
|
92
102
|
let scriptresult = "NOT RUN";
|
|
93
103
|
|
|
94
104
|
if (passed) {
|
|
@@ -102,7 +112,7 @@ const commonconfig = {
|
|
|
102
112
|
// scriptresult = "FAILED"
|
|
103
113
|
}
|
|
104
114
|
let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
|
|
105
|
-
let script_platform = BUFFER.getItem(fileName.replace(".js", "")+"_PLATFORM")
|
|
115
|
+
let script_platform = BUFFER.getItem(fileName.replace(".js", "") + "_PLATFORM")
|
|
106
116
|
|
|
107
117
|
await exeDetails.updateScriptExecutionStatus(
|
|
108
118
|
BUFFER.getItem("ORGANISATION_DOMAIN_URL"),
|
|
@@ -117,7 +127,7 @@ const commonconfig = {
|
|
|
117
127
|
* @param {object} suite suite details
|
|
118
128
|
*/
|
|
119
129
|
afterSuite: function (suite) {
|
|
120
|
-
console.log(
|
|
130
|
+
console.log(`====> Test suite has completed '${suite.title}'`);
|
|
121
131
|
},
|
|
122
132
|
/**
|
|
123
133
|
* Gets executed after all tests are done. You still have access to all global variables from
|
|
@@ -127,15 +137,15 @@ const commonconfig = {
|
|
|
127
137
|
* @param {Array.<String>} specs List of spec file paths that ran
|
|
128
138
|
*/
|
|
129
139
|
after: async function (result, config, capabilities, specs) {
|
|
130
|
-
console.log('
|
|
140
|
+
console.log('====> All tests are completed.' + result);
|
|
131
141
|
|
|
132
142
|
BUFFER.setItem("RESULT_DATA", result);
|
|
133
|
-
console.log("
|
|
143
|
+
console.log("====> Result data :" + BUFFER.getItem("RESULT_DATA"))
|
|
134
144
|
|
|
135
145
|
const resultdetails = {}
|
|
136
146
|
resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
|
|
137
|
-
console.log("
|
|
138
|
-
console.log("
|
|
147
|
+
console.log("====> Total Duration taken for the suite:" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
|
|
148
|
+
console.log("====> Execution Status from results" + resultdetails.excution_status);
|
|
139
149
|
|
|
140
150
|
resultdetails.excution_time = await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
|
|
141
151
|
await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
@@ -143,7 +153,7 @@ const commonconfig = {
|
|
|
143
153
|
},
|
|
144
154
|
|
|
145
155
|
afterSession: async function (config, capabilities, specs) {
|
|
146
|
-
console.log('
|
|
156
|
+
console.log('====> This is the aftersession hook');
|
|
147
157
|
// Perform any cleanup or post-test actions here
|
|
148
158
|
console.log("Capabilities:", capabilities);
|
|
149
159
|
console.log("Specs:", specs);
|
|
@@ -151,14 +161,14 @@ const commonconfig = {
|
|
|
151
161
|
|
|
152
162
|
endtime = new Date().getTime();
|
|
153
163
|
let totalDuration = endtime - starttime;
|
|
154
|
-
console.log("
|
|
164
|
+
console.log("====> Total Duration in after session based on start time and end time:" + totalDuration);
|
|
155
165
|
|
|
156
|
-
|
|
166
|
+
// if (isBrowserStackEnabled)
|
|
157
167
|
await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
|
|
158
168
|
|
|
159
169
|
const resultdetails = {}
|
|
160
170
|
resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
|
|
161
|
-
console.log("
|
|
171
|
+
console.log("====> Total Duration calculation:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION")));
|
|
162
172
|
|
|
163
173
|
resultdetails.excution_time = BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
|
|
164
174
|
await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
@@ -169,22 +179,19 @@ const commonconfig = {
|
|
|
169
179
|
},
|
|
170
180
|
|
|
171
181
|
onComplete: async function (exitCode, config, capabilities, results) {
|
|
172
|
-
|
|
173
|
-
console.log('========= This is the onComplete hook', results);
|
|
174
182
|
|
|
175
|
-
console.log('
|
|
183
|
+
console.log('====> This is the onComplete hook', results);
|
|
184
|
+
|
|
185
|
+
console.log('====> Test Results Summary ');
|
|
176
186
|
console.log('----------------------------');
|
|
177
187
|
|
|
178
188
|
console.log('Total Tests:', results.total);
|
|
179
189
|
console.log('Passed:', results.passed);
|
|
180
190
|
console.log('Failed:', results.failed);
|
|
181
191
|
console.log('Skipped:', results.skipped);
|
|
182
|
-
console.log('----------------------------');
|
|
183
192
|
console.log('Execution Time:', results.duration);
|
|
184
|
-
console.log('----------------------------');
|
|
185
193
|
console.log('Exit Code:', exitCode);
|
|
186
|
-
console.log('
|
|
187
|
-
console.log('========= All tests are done, exiting the browser session.');
|
|
194
|
+
console.log('====> All tests are done, exiting the browser session.');
|
|
188
195
|
|
|
189
196
|
}
|
|
190
197
|
|
package/config/injectimage.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
await driver.execute('browserstack_executor: {"action":"cameraImageInjection", "arguments": {"imageUrl" : "media://1965674f959d00128d4fb649dcc6823bd00b00cb"}}');
|
|
3
|
-
|
|
2
|
+
await driver.execute('browserstack_executor: {"action":"cameraImageInjection", "arguments": {"imageUrl" : "media://1965674f959d00128d4fb649dcc6823bd00b00cb"}}');
|
|
3
|
+
|
|
4
|
+
await driver.execute('browserstack_executor: {"action":"cameraVideoInjection", "arguments": {"videoUrl" : "media://1920c80136e1c7e2278e15d820845ed64a676e92"}}')
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const deepmerge = require('deepmerge')
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const yaml = require('js-yaml');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const commonconfig = require('./commonconfig');
|
|
6
|
+
|
|
7
|
+
// Select platform at runtime
|
|
8
|
+
const PLATFORM = process.env.PLATFORM || 'browserstack';
|
|
9
|
+
const configFile = PLATFORM === 'browserstack' ? '../ymls/browserstack/android/sample.yml' : 'saucelabs-config.yml';
|
|
10
|
+
console.log('PLATFORM:', PLATFORM);
|
|
11
|
+
const SUITE_FILE = process.env.SUITE;
|
|
12
|
+
// Load YAML file
|
|
13
|
+
const capabilities = yaml.load(fs.readFileSync(path.join(__dirname, configFile), 'utf8'));
|
|
14
|
+
capabilities.buildName = process.env.BROWSERSTACK_BUILD_NAME;
|
|
15
|
+
console.log('capabilities:', capabilities.platformName);
|
|
16
|
+
process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios'? 'app-automate' : 'automate';
|
|
17
|
+
process.env.BROWSERSTACK_USERNAME=capabilities.userName;
|
|
18
|
+
process.env.BROWSERSTACK_ACCESS_KEY=capabilities.accessKey;
|
|
19
|
+
console.log('process.env.BS_SESSION_TYPE:', process.env.BS_SESSION_TYPE);
|
|
20
|
+
console.log('capabilities:', capabilities);
|
|
21
|
+
|
|
22
|
+
exports.config = deepmerge(commonconfig,
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
user: capabilities.userName,
|
|
26
|
+
key: capabilities.accessKey,
|
|
27
|
+
// debug: true,
|
|
28
|
+
// execArgv: ['--inspect-brk'],
|
|
29
|
+
services: PLATFORM === 'browserstack'
|
|
30
|
+
? ['browserstack']
|
|
31
|
+
: PLATFORM === 'saucelabs'
|
|
32
|
+
? ['sauce']
|
|
33
|
+
: [],
|
|
34
|
+
|
|
35
|
+
//runner: 'local',
|
|
36
|
+
specs: require(SUITE_FILE).tests,
|
|
37
|
+
|
|
38
|
+
maxInstances: 1,
|
|
39
|
+
capabilities: [capabilities],
|
|
40
|
+
|
|
41
|
+
logLevel: 'info',
|
|
42
|
+
coloredLogs: true,
|
|
43
|
+
screenshotPath: './errorShots/',
|
|
44
|
+
bail: 0,
|
|
45
|
+
//baseUrl: 'https://example.com',
|
|
46
|
+
waitforTimeout: 90000,
|
|
47
|
+
connectionRetryTimeout: 90000,
|
|
48
|
+
connectionRetryCount: 3,
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
framework: 'mocha',
|
|
53
|
+
reporters: ['spec'],
|
|
54
|
+
maxInstances: 10,
|
|
55
|
+
updateJob: false,
|
|
56
|
+
mochaOpts: {
|
|
57
|
+
ui: 'bdd',
|
|
58
|
+
timeout: 300000
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[90m2025-02-17T09:51:31.710Z[39m [32mDEBUG[39m [97m@wdio/browserstack-service[39m Sending SDK event with data {
|
|
2
|
+
userName: 'subhrasubudhi_uf8nhj',
|
|
3
|
+
accessKey: 'DUGGqze7p9QMZb84y66s',
|
|
4
|
+
event_type: 'SDKTestAttempted',
|
|
5
|
+
detectedFramework: 'WebdriverIO-mocha',
|
|
6
|
+
event_properties: {
|
|
7
|
+
language_framework: 'WebdriverIO_mocha',
|
|
8
|
+
referrer: 'WebdriverIO-mocha/9.0.8',
|
|
9
|
+
language: 'WebdriverIO',
|
|
10
|
+
languageVersion: 'v20.15.0',
|
|
11
|
+
buildName: 'undefined',
|
|
12
|
+
buildIdentifier: 'undefined',
|
|
13
|
+
os: 'Darwin',
|
|
14
|
+
hostname: 'Subhras-MacBook-Pro.local',
|
|
15
|
+
productMap: {
|
|
16
|
+
observability: true,
|
|
17
|
+
accessibility: false,
|
|
18
|
+
percy: false,
|
|
19
|
+
automate: true,
|
|
20
|
+
app_automate: false
|
|
21
|
+
},
|
|
22
|
+
product: [ 'observability', 'automate' ]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
[90m2025-02-17T09:51:32.118Z[39m [32mDEBUG[39m [97m@wdio/browserstack-service[39m Funnel Event Response: "{\"message\":\"SDK Event recorded successfully\"}"
|
|
26
|
+
[90m2025-02-17T09:51:32.118Z[39m [32mDEBUG[39m [97m@wdio/browserstack-service[39m Funnel event success
|
|
27
|
+
[90m2025-02-17T09:51:32.118Z[39m [32mDEBUG[39m [97m@wdio/browserstack-service[39m app is not defined in browserstack-service config, skipping ...
|
|
28
|
+
[90m2025-02-17T09:51:32.119Z[39m [32mDEBUG[39m [97m@wdio/browserstack-service[39m Sending launch start event
|
|
29
|
+
[90m2025-02-17T09:51:33.444Z[39m [32mDEBUG[39m [97m@wdio/browserstack-service[39m [Start_Build] Success response: {"build_hashed_id":"wtqx3b2xf78ipajozv9ywenfyvrwb8upk23lfojk","jwt":"eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJicm93c2Vyc3RhY2tfb2IiLCJzdWIiOiI2MTA1MDM2IiwiZ3JvdXBfaWQiOjQ2OTIyNTksInVzZXJfaWQiOjYxMDUwMzYsImJ1aWxkX2hhc2hlZF9pZCI6Ind0cXgzYjJ4Zjc4aXBham96djl5d2VuZnl2cndiOHVwazIzbGZvamsiLCJob29rX2FzX3Rlc3QiOiIxIiwiYnVpbGRfbmFtZSI6IldFQkRSSVZFUklPIiwicHJvZHVjdF9tYXAiOiJ7XCJvYnNlcnZhYmlsaXR5XCI6dHJ1ZSxcIm9yaWdpbkZyb21Qcm9kdWN0TWFwXCI6XCJVbmtub3duR3JpZFwiLFwiYnN0YWNrQXV0b21hdGlvblwiOmZhbHNlLFwicHJvZHVjdEZpbHRlclNvdXJjZVwiOmZhbHNlLFwiY2FkXCI6dHJ1ZX0iLCJncnJfcmVnaW9uIjoiIiwic2lnbmluZ19rZXlfaGFzaCI6IjdkZjZlNjgzYzY3MDkxYjZiY2FiNDk1ZTNmN2YyYWExNjljNzVmMzFmYmFmYTUwZjQ3MDI0YzgxYjllNzA1M2QiLCJpYXQiOjE3Mzk3ODU4OTMsImV4cCI6MTc0MDEzMTQ5M30.9mvwQDShuQgqYmwsn765M1LtnBdD2yoBwqssVKAkF38","allow_screenshots":true}
|
|
30
|
+
[90m2025-02-17T09:51:33.444Z[39m [96mINFO[39m [97m@wdio/browserstack-service[39m browserstackLocal is not enabled - skipping...
|
|
31
|
+
[90m2025-02-17T09:51:39.078Z[39m [32mDEBUG[39m [97m@wdio/browserstack-service[39m Inside OnComplete hook..
|
|
32
|
+
[90m2025-02-17T09:51:39.078Z[39m [32mDEBUG[39m [97m@wdio/browserstack-service[39m Sending stop launch event
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"userName":"subhrasubudhi_uf8nhj","accessKey":"RFVHR3F6ZTdwOVFNWmI4NHk2NnM=","event_type":"SDKTestSuccessful","detectedFramework":"WebdriverIO-mocha","event_properties":{"language_framework":"WebdriverIO_mocha","referrer":"WebdriverIO-mocha/9.0.8","language":"WebdriverIO","languageVersion":"v20.15.0","buildName":"undefined","buildIdentifier":"undefined","os":"Darwin","hostname":"Subhras-MacBook-Pro.local","productMap":{"observability":true,"accessibility":false,"percy":false,"automate":true,"app_automate":false},"product":["observability","automate"],"productUsage":{"testObservability":{"enabled":true,"manuallySet":false,"events":{"buildEvents":{"started":{"isTriggered":true},"finished":{"isTriggered":true,"status":"failed","error":"Token/buildID is undefined, build creation might have failed"}},"testEvents":{"started":{"triggeredCount":0,"sentCount":0,"failedCount":0},"finished":{"triggeredCount":0,"sentCount":0,"failedCount":0}},"hookEvents":{"started":{"triggeredCount":0,"sentCount":0,"failedCount":0},"finished":{"triggeredCount":0,"sentCount":0,"failedCount":0}},"logEvents":{"triggeredCount":0,"sentCount":0,"failedCount":0},"cbtSessionEvents":{"triggeredCount":0,"sentCount":0,"failedCount":0}}}}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "froth-webdriverio-framework",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.67",
|
|
4
4
|
"readme": "WebdriverIO Integration",
|
|
5
5
|
"description": "WebdriverIO and BrowserStack App Automate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@wdio/local-runner": "^9.0.9",
|
|
32
32
|
"@wdio/mocha-framework": "^8.36.1",
|
|
33
33
|
"@wdio/spec-reporter": "^8.36.1",
|
|
34
|
-
"appium": "^
|
|
34
|
+
"appium": "^2.15.0",
|
|
35
35
|
"appium-uiautomator2-driver": "^2.2.0",
|
|
36
36
|
"assert": "^2.1.0",
|
|
37
37
|
"axios": "^1.7.7",
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
"crypto-js": "^4.2.0",
|
|
42
42
|
"deepmerge": "^4.3.1",
|
|
43
43
|
"form-data": "^4.0.0",
|
|
44
|
+
"fs": "^0.0.1-security",
|
|
45
|
+
"js-yaml": "^4.1.0",
|
|
44
46
|
"mysql2": "^3.10.2",
|
|
45
47
|
"node-fetch": "^3.3.2",
|
|
46
48
|
"node-localstorage": "^3.0.5",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
app: "bs://ac6af6ff949d8b320a5a668244442f38a9f3edce"
|
|
2
|
+
userName: subhrasubudhi_uf8nhj
|
|
3
|
+
accessKey: DUGGqze7p9QMZb84y66s
|
|
4
|
+
platformName: android
|
|
5
|
+
platformVersion: "12.0"
|
|
6
|
+
deviceName: Samsung Galaxy S22 Ultra
|
|
7
|
+
|
|
8
|
+
buildIdentifier: ${BUILD_NUMBER}
|
|
9
|
+
|
|
10
|
+
interactiveDebugging: true
|
|
11
|
+
deviceOrientation: "landscape"
|
|
12
|
+
#deviceOrientation: "portrait"
|
|
13
|
+
networkLogs: true
|
|
14
|
+
debug: true
|
|
15
|
+
appProfiling: true
|
|
16
|
+
|
|
17
|
+
|
package/api/getDBdetails.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// Function to get data from the API using the Bearer token
|
|
3
|
-
const getLoginToken = require('./loginapi')
|
|
4
|
-
|
|
5
|
-
async function getDbDetails(frothUrl, token, id) {
|
|
6
|
-
|
|
7
|
-
let jsondata = {};
|
|
8
|
-
if (id != 0 || id != null || id != undefined) {
|
|
9
|
-
const url = `${frothUrl}/api/dbconnection-retrieve/${id}/`;
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
console.log("URL: " + url)
|
|
13
|
-
const response = await fetch(url, {
|
|
14
|
-
method: 'GET',
|
|
15
|
-
headers: {
|
|
16
|
-
'Authorization': `Bearer ${token}`,
|
|
17
|
-
'Content-Type': 'application/json'
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
if (response.ok) {
|
|
22
|
-
jsondata = await response.json();
|
|
23
|
-
console.log("jsondata:" + JSON.stringify(jsondata))
|
|
24
|
-
return jsondata;
|
|
25
|
-
|
|
26
|
-
} else if (response.status === 401) { // Unauthorized, token expired
|
|
27
|
-
// Call login function to obtain a new token
|
|
28
|
-
const newToken = await getLoginToken(BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD")); // You need to implement the login function
|
|
29
|
-
// Retry the request with the new token
|
|
30
|
-
return getDbDetails(frothUrl, newToken, id);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const errorText = await response.text();
|
|
34
|
-
console.error(`Data fetch failed response in getDbDetails: ${response.status}`);
|
|
35
|
-
// throw new Error(`HTTP error! status: ${response.status}`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error('Error fetching data:', error);
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
console.error('Error fetching data: Invalid ID or no suite id is linked to execution');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// async function main() {
|
|
51
|
-
// try {
|
|
52
|
-
// const frothUrl = "devapi.frothtestops.com";
|
|
53
|
-
// const username = "subhra.subudhi@roboticodigital.com";
|
|
54
|
-
// const password = "V2VsY29tZUAxMjM=";
|
|
55
|
-
|
|
56
|
-
// const token = await getLoginToken(frothUrl, username, password);
|
|
57
|
-
// if (!token) {
|
|
58
|
-
// throw new Error('Login failed, no token obtained');
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
|
-
// const id = 106;
|
|
62
|
-
// const data = await getSuiteDetails(frothUrl, token, id);
|
|
63
|
-
// console.log("Retrieved JSON Data:", data);
|
|
64
|
-
// } catch (error) {
|
|
65
|
-
// console.error('Error in main function:', error);
|
|
66
|
-
// }
|
|
67
|
-
// }
|
|
68
|
-
|
|
69
|
-
// main();
|
|
70
|
-
module.exports = { getDbDetails }
|