froth-webdriverio-framework 4.0.52 → 4.0.54
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/froth_configs/wdio.common.conf.js +103 -33
- package/package.json +1 -1
|
@@ -4,47 +4,39 @@ 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
|
-
|
|
8
|
-
|
|
9
|
-
// Select platform at runtime
|
|
10
|
-
const PLATFORM = process.env.PLATFORM || 'browserstack';
|
|
11
|
-
const configFile = process.env.YML_NAME || '../ymls/browserstack/android/android_caps.yml';
|
|
12
|
-
console.log('====>PLATFORM:', PLATFORM);
|
|
13
|
-
// Load YAML file
|
|
14
|
-
const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
|
|
15
|
-
console.log('====>capabilities:', capabilities);
|
|
16
|
-
const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
|
|
17
|
-
console.log('====>SUITE_FILE:', SUITE_FILE);
|
|
18
|
-
|
|
7
|
+
let capabilities;
|
|
8
|
+
let SUITE_FILE;
|
|
19
9
|
const resultdetails = {
|
|
20
10
|
comments: [],
|
|
21
11
|
excution_status: null, // Pass/Fail
|
|
22
12
|
excution_time: null, // Execution time in milliseconds
|
|
23
13
|
};
|
|
24
|
-
if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
|
|
25
|
-
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`;
|
|
26
14
|
|
|
27
|
-
console.error(errorMsg);
|
|
28
|
-
resultdetails.comments.push(errorMsg);
|
|
29
15
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
process.env.API_TOKEN,
|
|
35
|
-
process.env.EXECUTION_ID,
|
|
36
|
-
resultdetails
|
|
37
|
-
).catch(err => {
|
|
38
|
-
console.error('Failed to update execution details:', err.message);
|
|
39
|
-
});
|
|
40
|
-
}, 10000);
|
|
16
|
+
console.log('=====wdios common config===== ');
|
|
17
|
+
// Select platform at runtime
|
|
18
|
+
const PLATFORM = process.env.PLATFORM || 'browserstack';
|
|
19
|
+
console.log('====>PLATFORM:', PLATFORM);
|
|
41
20
|
|
|
42
|
-
|
|
43
|
-
|
|
21
|
+
// Load YAML file
|
|
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;
|
|
44
37
|
}
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
function setupPrerequisites() {
|
|
39
|
+
async function setupPrerequisites() {
|
|
48
40
|
console.log("inside this fuction first ");
|
|
49
41
|
if (PLATFORM === 'browserstack') {
|
|
50
42
|
process.env.BROWSERSTACK_USERNAME = capabilities.userName;
|
|
@@ -53,14 +45,92 @@ function setupPrerequisites() {
|
|
|
53
45
|
|
|
54
46
|
console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
|
|
55
47
|
|
|
56
|
-
process.env.BS_SESSION_TYPE =
|
|
48
|
+
process.env.BS_SESSION_TYPE = ['android', 'ios'].includes(capabilities.platformName) ? 'app-automate' : 'automate';
|
|
57
49
|
capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
|
|
58
50
|
|
|
59
51
|
}
|
|
60
52
|
|
|
61
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`;
|
|
83
|
+
|
|
84
|
+
// console.error(errorMsg);
|
|
85
|
+
// resultdetails.comments.push(errorMsg);
|
|
86
|
+
|
|
87
|
+
// // Fire API call in background (non-blocking)
|
|
88
|
+
|
|
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
|
+
// }
|
|
102
|
+
|
|
103
|
+
|
|
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';
|
|
118
|
+
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
exeDetails.updateExecuitonDetails(
|
|
121
|
+
process.env.ORGANISATION_DOMAIN_URL,
|
|
122
|
+
process.env.API_TOKEN,
|
|
123
|
+
process.env.EXECUTION_ID,
|
|
124
|
+
resultdetails
|
|
125
|
+
).catch(err => {
|
|
126
|
+
console.error('Failed to update execution details:', err.message);
|
|
127
|
+
});
|
|
128
|
+
}, 0);
|
|
129
|
+
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
62
132
|
|
|
63
|
-
setupPrerequisites();
|
|
133
|
+
//await setupPrerequisites();
|
|
64
134
|
|
|
65
135
|
|
|
66
136
|
exports.config = deepmerge(commonconfig,
|