froth-webdriverio-framework 4.0.51 → 4.0.53

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,18 +3,72 @@ const fs = require('fs');
3
3
  const yaml = require('js-yaml');
4
4
  const path = require('path');
5
5
  const commonconfig = require('./commonconfig');
6
- console.log('=====wdios common config===== ');
6
+ const exeDetails = require('../froth_api_calls/getexecutionDetails');
7
+
8
+ const resultdetails = {
9
+ comments: [],
10
+ excution_status: null, // Pass/Fail
11
+ excution_time: null, // Execution time in milliseconds
12
+ };
13
+
7
14
 
15
+ console.log('=====wdios common config===== ');
8
16
  // Select platform at runtime
9
17
  const PLATFORM = process.env.PLATFORM || 'browserstack';
10
- const configFile = process.env.YML_NAME || '../ymls/browserstack/android/android_caps.yml';
18
+ const configFile = process.env.YML_NAME;
11
19
  console.log('====>PLATFORM:', PLATFORM);
12
20
  // Load YAML file
13
- const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
21
+ let capabilities;
22
+
23
+ try {
24
+ capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
25
+ } catch (e) {
26
+ 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`;
27
+ console.error(errorMsg);
28
+ resultdetails.comments.push(errorMsg);
29
+
30
+ setTimeout(() => {
31
+ exeDetails.updateExecuitonDetails(
32
+ process.env.ORGANISATION_DOMAIN_URL,
33
+ process.env.API_TOKEN,
34
+ process.env.EXECUTION_ID,
35
+ resultdetails
36
+ ).catch(err => {
37
+ console.error('Failed to update execution details:', err.message);
38
+ });
39
+ }, 10000);
40
+
41
+ process.exit(1);
42
+ }
43
+
14
44
  console.log('====>capabilities:', capabilities);
15
45
  const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
46
+
47
+
16
48
  console.log('====>SUITE_FILE:', SUITE_FILE);
17
49
 
50
+ if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
51
+ 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`;
52
+
53
+ console.error(errorMsg);
54
+ resultdetails.comments.push(errorMsg);
55
+
56
+ // Fire API call in background (non-blocking)
57
+ setTimeout(() => {
58
+ exeDetails.updateExecuitonDetails(
59
+ process.env.ORGANISATION_DOMAIN_URL,
60
+ process.env.API_TOKEN,
61
+ process.env.EXECUTION_ID,
62
+ resultdetails
63
+ ).catch(err => {
64
+ console.error('Failed to update execution details:', err.message);
65
+ });
66
+ }, 10000);
67
+
68
+ // Exit with failure
69
+ process.exit(1);
70
+ }
71
+
18
72
 
19
73
  function setupPrerequisites() {
20
74
  console.log("inside this fuction first ");
@@ -22,24 +76,24 @@ function setupPrerequisites() {
22
76
  process.env.BROWSERSTACK_USERNAME = capabilities.userName;
23
77
  capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
24
78
  process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey
25
-
79
+
26
80
  console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
27
81
 
28
- process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
82
+ process.env.BS_SESSION_TYPE = ['android', 'ios'].includes(capabilities.platformName) ? 'app-automate' : 'automate';
29
83
  capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
30
84
 
31
85
  }
32
-
86
+
33
87
  }
34
88
 
35
- const specificConfig = setupPrerequisites();
89
+ setupPrerequisites();
36
90
 
37
91
 
38
92
  exports.config = deepmerge(commonconfig,
39
93
 
40
94
  {
41
- user: process.env.BROWSERSTACK_USERNAME,
42
- key: process.env.BROWSERSTACK_ACCESS_KEY ,
95
+ user: process.env.BROWSERSTACK_USERNAME,
96
+ key: process.env.BROWSERSTACK_ACCESS_KEY,
43
97
  // debug: true,
44
98
  // execArgv: ['--inspect-brk'],
45
99
  services: PLATFORM === 'browserstack'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "4.0.51",
3
+ "version": "4.0.53",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",