froth-webdriverio-framework 4.0.58 → 4.0.60

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.
@@ -3,37 +3,80 @@ const fs = require('fs');
3
3
  const yaml = require('js-yaml');
4
4
  const path = require('path');
5
5
  const commonconfig = require('./commonconfig');
6
- const exeDetails = require('../froth_api_calls/getexecutionDetails');
7
- let capabilities;
8
- let SUITE_FILE;
6
+ console.log('=====wdios common config===== ');
7
+
8
+ // Select platform at runtime
9
+ const PLATFORM = process.env.PLATFORM || 'browserstack';
10
+ console.log('====>PLATFORM:', PLATFORM);
11
+
12
+ const configFile = process.env.YML_NAME ;
13
+
9
14
  const resultdetails = {
10
15
  comments: [],
11
16
  excution_status: null, // Pass/Fail
12
17
  excution_time: null, // Execution time in milliseconds
13
18
  };
14
19
 
20
+ // Load YAML file
21
+ //const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
15
22
 
16
- console.log('=====wdios common config===== ');
17
- // Select platform at runtime
18
- const PLATFORM = process.env.PLATFORM || 'browserstack';
19
- console.log('====>PLATFORM:', PLATFORM);
23
+ let capabilities;
24
+
25
+ try {
26
+ capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
27
+ } catch (e) {
28
+ 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`;
29
+ console.error(errorMsg);
30
+ resultdetails.comments.push(errorMsg);
31
+ resultdetails.excution_status = 'FAIL';
20
32
 
21
- // Load YAML file
22
- function loadCapabilities() {
23
- const configFile = process.env.YML_NAME;
24
33
  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}`);
34
+ exeDetails.updateExecuitonDetails(
35
+ process.env.ORGANISATION_DOMAIN_URL,
36
+ process.env.API_TOKEN,
37
+ process.env.EXECUTION_ID,
38
+ resultdetails
39
+ );
40
+ setTimeout(() => {
41
+ console.log("30 seconds passed.");
42
+ // You can call your API or exit the process here
43
+ }, 30000);
44
+ console.log('Execution details updated successfully.');
45
+ } catch (err) {
46
+ console.error('Failed to update execution details:', err.message);
28
47
  }
48
+ process.exit(1);
29
49
  }
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}`);
50
+ console.log('====>capabilities:', capabilities);
51
+
52
+ const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
53
+ console.log('====>SUITE_FILE:', SUITE_FILE);
54
+
55
+ if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
56
+ 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`;
57
+
58
+ console.error(errorMsg);
59
+ resultdetails.comments.push(errorMsg);
60
+ resultdetails.excution_status = 'FAIL';
61
+
62
+ // Fire API call in background (non-blocking)
63
+
64
+ try {
65
+ exeDetails.updateExecuitonDetails(
66
+ process.env.ORGANISATION_DOMAIN_URL,
67
+ process.env.API_TOKEN,
68
+ process.env.EXECUTION_ID,
69
+ resultdetails
70
+ );
71
+ setTimeout(() => {
72
+ console.log("30 seconds passed.");
73
+ // You can call your API or exit the process here
74
+ }, 30000);
75
+ console.log('Execution details updated successfully.');
76
+ } catch (err) {
77
+ console.error('Failed to update execution details:', err.message);
35
78
  }
36
- return SUITE_FILE;
79
+ process.exit(1);
37
80
  }
38
81
 
39
82
  function setupPrerequisites() {
@@ -45,96 +88,14 @@ function setupPrerequisites() {
45
88
 
46
89
  console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
47
90
 
48
- process.env.BS_SESSION_TYPE = ['android', 'ios'].includes(capabilities.platformName) ? 'app-automate' : 'automate';
91
+ process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
49
92
  capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
50
93
 
51
94
  }
52
95
 
53
96
  }
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
- //wait for somtime before calling this methof
120
-
121
- exeDetails.updateExecuitonDetails(
122
- process.env.ORGANISATION_DOMAIN_URL,
123
- process.env.API_TOKEN,
124
- process.env.EXECUTION_ID,
125
- resultdetails
126
- ).catch(err => {
127
- console.error('Failed to update execution details:', err.message);
128
- });
129
-
130
- setTimeout(() => {
131
- console.log('Updating execution details...');
132
- }
133
- , 30000);
134
- process.exit(1);
135
- }
136
97
 
137
- //await setupPrerequisites();
98
+ const specificConfig = setupPrerequisites();
138
99
 
139
100
 
140
101
  exports.config = deepmerge(commonconfig,
@@ -173,6 +134,4 @@ exports.config = deepmerge(commonconfig,
173
134
  ui: 'bdd',
174
135
  timeout: 300000
175
136
  }
176
- });
177
-
178
-
137
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "4.0.58",
3
+ "version": "4.0.60",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",