froth-webdriverio-framework 2.0.43 → 2.0.44
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/config/common.mobile.conf.js +37 -48
- package/config/commonconfig.js +10 -5
- package/package.json +1 -1
|
@@ -1,55 +1,44 @@
|
|
|
1
1
|
const deepmerge = require('deepmerge')
|
|
2
2
|
const commonconfig = require('./commonconfig');
|
|
3
3
|
const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
projectName: process.env.PROJECTNAME || "roboticodigital",
|
|
16
|
-
sessionName: 'Automation test session',
|
|
17
|
-
debug: true,
|
|
18
|
-
networkLogs: true
|
|
19
|
-
}
|
|
4
|
+
console.log("isBrowserStackEnabled", isBrowserStackEnabled);
|
|
5
|
+
|
|
6
|
+
const browserStackConfig = isBrowserStackEnabled === true ? {
|
|
7
|
+
user: process.env.BROWSERSTACK_USERNAME,
|
|
8
|
+
key: Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'),
|
|
9
|
+
commonCapabilities: {
|
|
10
|
+
'bstack:options': {
|
|
11
|
+
projectName: process.env.PROJECTNAME || "roboticodigital",
|
|
12
|
+
sessionName: 'Automation test session',
|
|
13
|
+
debug: true,
|
|
14
|
+
networkLogs: true
|
|
20
15
|
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
}
|
|
17
|
+
} : {};
|
|
18
|
+
|
|
19
|
+
const commonmobconfig = deepmerge.all([
|
|
20
|
+
commonconfig,
|
|
21
|
+
{
|
|
22
|
+
logLevel: 'info',
|
|
23
|
+
coloredLogs: true,
|
|
24
|
+
screenshotPath: './errorShots/',
|
|
25
|
+
baseUrl: '',
|
|
26
|
+
waitforTimeout: 90000,
|
|
27
|
+
connectionRetryTimeout: 90000,
|
|
28
|
+
connectionRetryCount: 2,
|
|
29
|
+
|
|
30
|
+
framework: 'mocha',
|
|
31
|
+
mochaOpts: {
|
|
32
|
+
ui: 'bdd',
|
|
33
|
+
timeout: 90000
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
maxInstances: 10,
|
|
37
|
+
|
|
38
|
+
updateJob: false,
|
|
39
|
+
reporters: ['spec'],
|
|
34
40
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
updateJob: false,
|
|
39
|
-
reporters: [
|
|
40
|
-
'spec'
|
|
41
|
-
],
|
|
42
|
-
// commonCapabilities: {
|
|
43
|
-
// 'bstack:options': {
|
|
44
|
-
// projectName: process.env.PROJECTNAME || "roboticodigital",
|
|
45
|
-
// // buildName: "Automation Build",
|
|
46
|
-
// sessionName: 'Automation test session',
|
|
47
|
-
// debug: true,
|
|
48
|
-
// networkLogs: true
|
|
49
|
-
// }
|
|
50
|
-
// },
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}]);
|
|
41
|
+
browserStackConfig // Add BrowserStack config conditionally
|
|
42
|
+
]);
|
|
54
43
|
|
|
55
44
|
module.exports = commonmobconfig;
|
package/config/commonconfig.js
CHANGED
|
@@ -5,7 +5,8 @@ const path = require('path');
|
|
|
5
5
|
const exeDetails = require("../api/getexecutionDetails")
|
|
6
6
|
const getBSSessionDetails = require("../api/browsersatckSessionInfo")
|
|
7
7
|
const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
8
|
-
|
|
8
|
+
let starttime;
|
|
9
|
+
let endtime;
|
|
9
10
|
|
|
10
11
|
// Description: This file contains the common configuration for the webdriverio framework.
|
|
11
12
|
const commonconfig = {
|
|
@@ -32,6 +33,7 @@ const commonconfig = {
|
|
|
32
33
|
beforeSuite: async function (suite) {
|
|
33
34
|
try {
|
|
34
35
|
console.log("Running suite:", suite.title);
|
|
36
|
+
starttime = new Date().getTime();
|
|
35
37
|
// const sessionId = browser.sessionId;
|
|
36
38
|
// BUFFER.setItem("SESSION_ID", sessionId)
|
|
37
39
|
if (isBrowserStackEnabled) {
|
|
@@ -124,15 +126,18 @@ const commonconfig = {
|
|
|
124
126
|
},
|
|
125
127
|
|
|
126
128
|
afterSession: async function (config, capabilities, specs) {
|
|
127
|
-
|
|
128
129
|
console.log('This is the aftersession hook');
|
|
129
|
-
//
|
|
130
|
+
// Perform any cleanup or post-test actions here
|
|
131
|
+
|
|
132
|
+
endtime = new Date().getTime();
|
|
133
|
+
let totalDuration = endtime - starttime;
|
|
134
|
+
console.log("Total Duration:" + totalDuration);
|
|
130
135
|
if (isBrowserStackEnabled)
|
|
131
136
|
await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
|
|
132
|
-
|
|
137
|
+
|
|
133
138
|
const resultdetails = {}
|
|
134
139
|
resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
|
|
135
|
-
console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
|
|
140
|
+
console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? totalDuration:BUFFER.getItem("FROTH_TOTAL_DURATION"));
|
|
136
141
|
resultdetails.excution_time = await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
|
|
137
142
|
await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
138
143
|
BUFFER.clear();
|