froth-webdriverio-framework 5.0.13 → 5.0.14
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.
|
@@ -9,7 +9,6 @@ const exeDetails = require("../froth_api_calls/getexecutionDetails")
|
|
|
9
9
|
const { fail } = require("assert");
|
|
10
10
|
const { error } = require('console');
|
|
11
11
|
const HTMLReportGenerator = require('wdio-json-html-reporter').HTMLReportGenerator;
|
|
12
|
-
global.Util = require('./globalUtilShim');
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
//const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
@@ -35,6 +34,7 @@ const commonconfig = {
|
|
|
35
34
|
await setAllDetails.setSuiteDetails();
|
|
36
35
|
await setAllDetails.setTestDataDetails();
|
|
37
36
|
console.log("on prepare:", JSON.stringify(capabilities))
|
|
37
|
+
|
|
38
38
|
// console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
|
|
39
39
|
} catch (e) {
|
|
40
40
|
console.log("====> Error in onPrepare:", e);
|
|
@@ -45,6 +45,7 @@ const commonconfig = {
|
|
|
45
45
|
|
|
46
46
|
beforeSession: async function (config, capabilities, specs) {
|
|
47
47
|
try {
|
|
48
|
+
|
|
48
49
|
let syntaxFailed = false;
|
|
49
50
|
|
|
50
51
|
console.log('==== BEFORE SESSION HOOK ====');
|
|
@@ -164,21 +165,7 @@ const commonconfig = {
|
|
|
164
165
|
console.log('==== BEFORE HOOK FOR MOBILE ====');
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
const Module = require('module');
|
|
168
|
-
const originalRequire = Module.prototype.require;
|
|
169
|
-
|
|
170
|
-
Module.prototype.require = function (path) {
|
|
171
|
-
// Intercept only for the Utils file
|
|
172
|
-
if (path.includes('froth_common_actions/Utils')) {
|
|
173
|
-
console.log('⚡ Overriding require for:', path);
|
|
174
|
-
return require('./globalUtilShim'); // <-- path relative to wdio.conf.js
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return originalRequire.apply(this, arguments);
|
|
178
|
-
};
|
|
179
168
|
|
|
180
|
-
// Optionally also expose globally
|
|
181
|
-
global.Util = require('./globalUtilShim');
|
|
182
169
|
},
|
|
183
170
|
|
|
184
171
|
/**
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const deepmerge = require('deepmerge')
|
|
2
|
+
//global.Util=require('./patch_require'); // Ensure this is imported first
|
|
2
3
|
const fs = require('fs');
|
|
3
4
|
const yaml = require('js-yaml');
|
|
4
5
|
const path = require('path');
|
|
5
6
|
const commonconfig = require('./commonconfig');
|
|
6
7
|
console.log('=====wdios common config===== ');
|
|
7
8
|
const { JSONReporter, HTMLReportGenerator } = require('wdio-json-html-reporter');
|
|
9
|
+
//require("./patch_require"); // Ensure this is imported first
|
|
8
10
|
|
|
9
11
|
// Select platform at runtime
|
|
10
12
|
const PLATFORM = process.env.PLATFORM || 'browserstack';
|
|
@@ -18,6 +20,8 @@ const resultdetails = {
|
|
|
18
20
|
excution_time: null, // Execution time in milliseconds
|
|
19
21
|
};
|
|
20
22
|
|
|
23
|
+
|
|
24
|
+
|
|
21
25
|
// Load YAML file
|
|
22
26
|
//const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
|
|
23
27
|
|
|
@@ -140,7 +144,7 @@ exports.config = deepmerge(commonconfig,
|
|
|
140
144
|
|
|
141
145
|
framework: 'mocha',
|
|
142
146
|
reporters: ['spec',
|
|
143
|
-
|
|
147
|
+
[JSONReporter, { outputDir: reportDir, outputFile: `./reports/${process.env.EXECUTION_ID}/test-results-${timestamp}.json`, screenshotOption: 'OnFailure' }],
|
|
144
148
|
],
|
|
145
149
|
|
|
146
150
|
maxInstances: 10,
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const possiblePaths = [
|
|
5
|
-
path.resolve(process.cwd(), 'node_modules/froth-webdriverio-framework/froth_common_actions/Utils'),
|
|
6
|
-
path.resolve(process.cwd(), '../DEPENDENCY/node_modules/froth-webdriverio-framework/froth_common_actions/Utils'),
|
|
7
|
-
path.resolve(process.cwd(), '../../DEPENDENCY/node_modules/froth-webdriverio-framework/froth_common_actions/Utils'),
|
|
8
|
-
];
|
|
9
|
-
let loaded = false;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (const filePath of possiblePaths) {
|
|
13
|
-
if (fs.existsSync(filePath + '.js')) {
|
|
14
|
-
global.Util = require(filePath);
|
|
15
|
-
console.log(`✅ Global Util loaded from: ${filePath}`);
|
|
16
|
-
loaded = true;
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (!loaded) {
|
|
22
|
-
try {
|
|
23
|
-
// fallback to node_modules package (cloud CI)
|
|
24
|
-
global.Util = require('froth-webdriverio-framework/froth_common_actions/Utils');
|
|
25
|
-
console.log('✅ Global Util loaded from npm package');
|
|
26
|
-
loaded = true;
|
|
27
|
-
} catch (err) {
|
|
28
|
-
console.error('❌ Could not load froth_common_actions/Utils from known paths or npm package');
|
|
29
|
-
throw err;
|
|
30
|
-
}
|
|
31
|
-
}else
|
|
32
|
-
console.log('✅ Global Util already defined');
|
|
33
|
-
|
|
34
|
-
console.log("global Util loaded from:", global.Util);
|
|
35
|
-
|
|
36
|
-
module.exports = global.Util;
|