froth-webdriverio-framework 5.0.12 → 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,9 +9,7 @@ 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;
15
13
 
16
14
  //const isBrowserStackEnabled = process.env.BROWSERSTACK;
17
15
  let starttime;
@@ -36,6 +34,7 @@ const commonconfig = {
36
34
  await setAllDetails.setSuiteDetails();
37
35
  await setAllDetails.setTestDataDetails();
38
36
  console.log("on prepare:", JSON.stringify(capabilities))
37
+
39
38
  // console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
40
39
  } catch (e) {
41
40
  console.log("====> Error in onPrepare:", e);
@@ -46,6 +45,7 @@ const commonconfig = {
46
45
 
47
46
  beforeSession: async function (config, capabilities, specs) {
48
47
  try {
48
+
49
49
  let syntaxFailed = false;
50
50
 
51
51
  console.log('==== BEFORE SESSION HOOK ====');
@@ -165,12 +165,7 @@ const commonconfig = {
165
165
  console.log('==== BEFORE HOOK FOR MOBILE ====');
166
166
  }
167
167
 
168
- console.log("🔧 Initializing environment setup...");
169
168
 
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
- };
174
169
  },
175
170
 
176
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
- [JSONReporter, { outputDir: reportDir,outputFile: `./reports/${process.env.EXECUTION_ID}/test-results-${timestamp}.json`, screenshotOption: 'OnFailure' }],
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,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "5.0.12",
3
+ "version": "5.0.14",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",
@@ -1,34 +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
- }
32
- console.log("global Util loaded from:", global.Util && global.Util.constructor.name);
33
-
34
- module.exports = global.Util;