froth-webdriverio-framework 5.0.11 → 5.0.13
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.
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// Function to verify text in Android app
|
|
2
|
-
import assert from 'assert';
|
|
2
|
+
//import assert from 'assert';
|
|
3
|
+
const assert=require("assert");
|
|
4
|
+
|
|
3
5
|
const amendToBrowserstack = require("../froth_api_calls/browsersatckSessionInfo").amend2Browserstack;
|
|
4
6
|
|
|
5
7
|
async function assertText(elementSelector, expectedText) {
|
|
@@ -9,9 +9,8 @@ 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
|
-
require('
|
|
12
|
+
global.Util = require('./globalUtilShim');
|
|
13
13
|
|
|
14
|
-
let Util;
|
|
15
14
|
|
|
16
15
|
//const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
17
16
|
let starttime;
|
|
@@ -165,12 +164,21 @@ const commonconfig = {
|
|
|
165
164
|
console.log('==== BEFORE HOOK FOR MOBILE ====');
|
|
166
165
|
}
|
|
167
166
|
|
|
168
|
-
|
|
167
|
+
const Module = require('module');
|
|
168
|
+
const originalRequire = Module.prototype.require;
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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);
|
|
173
178
|
};
|
|
179
|
+
|
|
180
|
+
// Optionally also expose globally
|
|
181
|
+
global.Util = require('./globalUtilShim');
|
|
174
182
|
},
|
|
175
183
|
|
|
176
184
|
/**
|
|
@@ -6,15 +6,31 @@ const possiblePaths = [
|
|
|
6
6
|
path.resolve(process.cwd(), '../DEPENDENCY/node_modules/froth-webdriverio-framework/froth_common_actions/Utils'),
|
|
7
7
|
path.resolve(process.cwd(), '../../DEPENDENCY/node_modules/froth-webdriverio-framework/froth_common_actions/Utils'),
|
|
8
8
|
];
|
|
9
|
+
let loaded = false;
|
|
10
|
+
|
|
9
11
|
|
|
10
12
|
for (const filePath of possiblePaths) {
|
|
11
13
|
if (fs.existsSync(filePath + '.js')) {
|
|
12
14
|
global.Util = require(filePath);
|
|
13
15
|
console.log(`✅ Global Util loaded from: ${filePath}`);
|
|
16
|
+
loaded = true;
|
|
14
17
|
break;
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
if (!
|
|
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;
|