froth-webdriverio-framework 5.0.10 → 5.0.12

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,6 +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
+ global.Util = require('./globalUtilShim');
13
+
12
14
  let Util;
13
15
 
14
16
  //const isBrowserStackEnabled = process.env.BROWSERSTACK;
@@ -165,34 +167,10 @@ const commonconfig = {
165
167
 
166
168
  console.log("🔧 Initializing environment setup...");
167
169
 
168
- // Define all possible locations of Utils.js
169
- const possiblePaths = [
170
- // 🟢 Cloud setup — npm installed inside project
171
- path.resolve(process.cwd(), 'node_modules/froth-webdriverio-framework/froth_common_actions/Utils'),
172
-
173
- // 🟢 Local setup — dependency folder outside project
174
- path.resolve(process.cwd(), '../DEPENDENCY/node_modules/froth-webdriverio-framework/froth_common_actions/Utils'),
175
-
176
- // 🟢 Another possible relative structure (if nested differently)
177
- path.resolve(process.cwd(), '../../DEPENDENCY/node_modules/froth-webdriverio-framework/froth_common_actions/Utils'),
178
- ];
179
-
180
- // Try to locate and load the Utils module
181
- for (const filePath of possiblePaths) {
182
- if (fs.existsSync(filePath + '.js')) {
183
- Util = require(filePath);
184
- global.Util = Util;
185
- console.log(`✅ Utils loaded successfully from: ${filePath}`);
186
- break;
187
- }
188
- }
189
-
190
- if (!global.Util) {
191
- console.error('❌ Could not find froth_common_actions/Utils in expected paths:');
192
- possiblePaths.forEach(p => console.error(' - ' + p));
193
- throw new Error('Failed to load Utils. Check dependency installation path.');
194
- }
195
-
170
+ global.require = (p) => {
171
+ if (p.includes('froth_common_actions/Utils')) return global.Util;
172
+ return module.constructor.prototype.require.call(this, p);
173
+ };
196
174
  },
197
175
 
198
176
  /**
@@ -0,0 +1,34 @@
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
+ }
32
+ console.log("global Util loaded from:", global.Util && global.Util.constructor.name);
33
+
34
+ module.exports = global.Util;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "5.0.10",
3
+ "version": "5.0.12",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "deepmerge": "^4.3.1",
44
44
  "express": "^5.1.0",
45
45
  "form-data": "^4.0.0",
46
- "froth-webdriverio-framework": "^5.0.9",
46
+ "froth-webdriverio-framework": "^5.0.10",
47
47
  "fs": "^0.0.1-security",
48
48
  "js-yaml": "^4.1.0",
49
49
  "mysql2": "^3.10.2",