froth-webdriverio-framework 4.0.53 → 4.0.55
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.
|
@@ -4,7 +4,8 @@ const yaml = require('js-yaml');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const commonconfig = require('./commonconfig');
|
|
6
6
|
const exeDetails = require('../froth_api_calls/getexecutionDetails');
|
|
7
|
-
|
|
7
|
+
let capabilities;
|
|
8
|
+
let SUITE_FILE;
|
|
8
9
|
const resultdetails = {
|
|
9
10
|
comments: [],
|
|
10
11
|
excution_status: null, // Pass/Fail
|
|
@@ -15,45 +16,106 @@ const resultdetails = {
|
|
|
15
16
|
console.log('=====wdios common config===== ');
|
|
16
17
|
// Select platform at runtime
|
|
17
18
|
const PLATFORM = process.env.PLATFORM || 'browserstack';
|
|
18
|
-
const configFile = process.env.YML_NAME;
|
|
19
19
|
console.log('====>PLATFORM:', PLATFORM);
|
|
20
|
+
|
|
20
21
|
// Load YAML file
|
|
21
|
-
|
|
22
|
+
function loadCapabilities() {
|
|
23
|
+
const configFile = process.env.YML_NAME;
|
|
24
|
+
try {
|
|
25
|
+
return yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
throw new Error(`Capability file missing or unreadable at ${process.env.YML_NAME}: ${e.message}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function checkSuiteFile() {
|
|
31
|
+
SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
|
|
32
|
+
console.log('====>SUITE_FILE:', SUITE_FILE);
|
|
33
|
+
if (!fs.existsSync(SUITE_FILE)) {
|
|
34
|
+
throw new Error(`Suite file does not exist at ${SUITE_FILE}`);
|
|
35
|
+
}
|
|
36
|
+
return SUITE_FILE;
|
|
37
|
+
}
|
|
22
38
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
function setupPrerequisites() {
|
|
40
|
+
console.log("inside this fuction first ");
|
|
41
|
+
if (PLATFORM === 'browserstack') {
|
|
42
|
+
process.env.BROWSERSTACK_USERNAME = capabilities.userName;
|
|
43
|
+
capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
|
|
44
|
+
process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey
|
|
29
45
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
).catch(err => {
|
|
37
|
-
console.error('Failed to update execution details:', err.message);
|
|
38
|
-
});
|
|
39
|
-
}, 10000);
|
|
46
|
+
console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
|
|
47
|
+
|
|
48
|
+
process.env.BS_SESSION_TYPE = ['android', 'ios'].includes(capabilities.platformName) ? 'app-automate' : 'automate';
|
|
49
|
+
capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
|
|
50
|
+
|
|
51
|
+
}
|
|
40
52
|
|
|
41
|
-
process.exit(1);
|
|
42
53
|
}
|
|
54
|
+
// let capabilities;
|
|
55
|
+
|
|
56
|
+
// try {
|
|
57
|
+
// capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
|
|
58
|
+
// } catch (e) {
|
|
59
|
+
// const errorMsg = `The capability file does not exist in the currently configured repository at path: ${path.resolve(process.cwd(), configFile)}: ${e.message},Please update the Capability by editing the file`;
|
|
60
|
+
// console.error(errorMsg);
|
|
61
|
+
// resultdetails.comments.push(errorMsg);
|
|
62
|
+
|
|
63
|
+
// try {
|
|
64
|
+
// await exeDetails.updateExecuitonDetails(
|
|
65
|
+
// process.env.ORGANISATION_DOMAIN_URL,
|
|
66
|
+
// process.env.API_TOKEN,
|
|
67
|
+
// process.env.EXECUTION_ID,
|
|
68
|
+
// resultdetails
|
|
69
|
+
// );
|
|
70
|
+
// console.log('Execution details updated successfully.');
|
|
71
|
+
// } catch (err) {
|
|
72
|
+
// console.error('Failed to update execution details:', err.message);
|
|
73
|
+
// }
|
|
74
|
+
// process.exit(1);
|
|
75
|
+
// }
|
|
76
|
+
|
|
77
|
+
//console.log('====>capabilities:', capabilities);
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
// if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
|
|
82
|
+
// let errorMsg = `The suite file does not exist in the currently configured repository at path: ${SUITE_FILE}. Please update the SUITE by editing the file`;
|
|
43
83
|
|
|
44
|
-
console.
|
|
45
|
-
|
|
84
|
+
// console.error(errorMsg);
|
|
85
|
+
// resultdetails.comments.push(errorMsg);
|
|
46
86
|
|
|
87
|
+
// // Fire API call in background (non-blocking)
|
|
47
88
|
|
|
48
|
-
|
|
89
|
+
// try {
|
|
90
|
+
// await exeDetails.updateExecuitonDetails(
|
|
91
|
+
// process.env.ORGANISATION_DOMAIN_URL,
|
|
92
|
+
// process.env.API_TOKEN,
|
|
93
|
+
// process.env.EXECUTION_ID,
|
|
94
|
+
// resultdetails
|
|
95
|
+
// );
|
|
96
|
+
// console.log('Execution details updated successfully.');
|
|
97
|
+
// } catch (err) {
|
|
98
|
+
// console.error('Failed to update execution details:', err.message);
|
|
99
|
+
// }
|
|
100
|
+
// process.exit(1);
|
|
101
|
+
// }
|
|
49
102
|
|
|
50
|
-
if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
|
|
51
|
-
let errorMsg = `The suite file does not exist in the currently configured repository at path: ${SUITE_FILE}. Please update the SUITE by editing the file`;
|
|
52
103
|
|
|
53
|
-
|
|
54
|
-
|
|
104
|
+
// Now main synchronous part:
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
try {
|
|
108
|
+
capabilities = loadCapabilities();
|
|
109
|
+
checkSuiteFile();
|
|
110
|
+
setupPrerequisites();
|
|
111
|
+
} catch (err) {
|
|
112
|
+
// Synchronous throw to fail fast
|
|
113
|
+
// Update execution details async outside or in CI pipeline
|
|
114
|
+
console.error(err.message);
|
|
115
|
+
|
|
116
|
+
resultdetails.comments.push(err.message);
|
|
117
|
+
resultdetails.excution_status = 'FAIL';
|
|
55
118
|
|
|
56
|
-
// Fire API call in background (non-blocking)
|
|
57
119
|
setTimeout(() => {
|
|
58
120
|
exeDetails.updateExecuitonDetails(
|
|
59
121
|
process.env.ORGANISATION_DOMAIN_URL,
|
|
@@ -63,30 +125,12 @@ if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
|
|
|
63
125
|
).catch(err => {
|
|
64
126
|
console.error('Failed to update execution details:', err.message);
|
|
65
127
|
});
|
|
66
|
-
},
|
|
128
|
+
}, 0);
|
|
67
129
|
|
|
68
|
-
// Exit with failure
|
|
69
130
|
process.exit(1);
|
|
70
131
|
}
|
|
71
132
|
|
|
72
|
-
|
|
73
|
-
function setupPrerequisites() {
|
|
74
|
-
console.log("inside this fuction first ");
|
|
75
|
-
if (PLATFORM === 'browserstack') {
|
|
76
|
-
process.env.BROWSERSTACK_USERNAME = capabilities.userName;
|
|
77
|
-
capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
|
|
78
|
-
process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey
|
|
79
|
-
|
|
80
|
-
console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
|
|
81
|
-
|
|
82
|
-
process.env.BS_SESSION_TYPE = ['android', 'ios'].includes(capabilities.platformName) ? 'app-automate' : 'automate';
|
|
83
|
-
capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
setupPrerequisites();
|
|
133
|
+
//await setupPrerequisites();
|
|
90
134
|
|
|
91
135
|
|
|
92
136
|
exports.config = deepmerge(commonconfig,
|