froth-webdriverio-framework 6.0.25 → 6.0.27

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.
@@ -0,0 +1,34 @@
1
+ const path = require('path');
2
+
3
+ const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
4
+ console.log('====>SUITE_FILE:', SUITE_FILE);
5
+
6
+ exports.config = {
7
+ user: process.env.BROWSERSTACK_USERNAME || 'naveen_OSt3Pw',
8
+ key: process.env.BROWSERSTACK_ACCESS_KEY || Buffer.from('QjlSeDI4TVRLRnpSSjJRRVZLMWM=', 'base64').toString('utf-8'),
9
+
10
+ updateJob: false,
11
+ specs: require(SUITE_FILE).tests,
12
+ exclude: [],
13
+
14
+ logLevel: 'warn',
15
+ coloredLogs: true,
16
+ screenshotPath: './errorShots/',
17
+ baseUrl: '',
18
+ waitforTimeout: 10000,
19
+ connectionRetryTimeout: 120000,
20
+ connectionRetryCount: 3,
21
+ hostname: 'hub.browserstack.com',
22
+ services: [['browserstack']],
23
+
24
+ // before: function () {
25
+ // var chai = require('chai');
26
+ // global.expect = chai.expect;
27
+ // chai.Should();
28
+ // },
29
+ framework: 'mocha',
30
+ mochaOpts: {
31
+ ui: 'bdd',
32
+ timeout: 60000,
33
+ },
34
+ };
@@ -76,38 +76,38 @@ const commonconfig = {
76
76
  process.exit(1);
77
77
  }
78
78
  // set the capability like media and app and bs local
79
- if (process.env.PLATFORM === 'browserstack') {
80
- /// console.log("capabilities:", capabilities);
81
- capabilities.browserstackLocal = process.env.BROWSERSTACK_LOCAL;
82
- // capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
83
- if (capabilities.platformName === 'android' || capabilities.platformName === 'ios') {
84
- capabilities.app = process.env.BROWSERSTACK_APP_PATH;
85
- if (capabilities.app === undefined || capabilities.app === null || capabilities.app === '') {
86
- console.error("🚨 Error: BROWSERSTACK_APP_PATH is not defined or empty.");
87
- resultdetails.excution_status = 'FAILED';
88
- resultdetails.comments.push("BROWSERSTACK_APP_PATH is not defined or empty.");
89
- await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails);
90
- process.exit(1); // Stop execution if app path is not set
91
- } else {
92
- console.log("App Path:", capabilities.app);
93
- console.log("Browserstack Local:", capabilities.browserstackLocal);
94
- }
95
- }
96
-
97
- try {
98
- let mediaFiles = process.env.MEDIA_FILES ? JSON.parse(process.env.MEDIA_FILES) : [];
99
- console.log("Size of Media Files:", Array.isArray(mediaFiles) ? mediaFiles.length : "Invalid data");
100
-
101
- if (Array.isArray(mediaFiles) && mediaFiles.length > 0) {
102
- console.log("Media Files:", JSON.parse(process.env.MEDIA_FILES));
103
- capabilities['browserstack.uploadMedia'] = JSON.parse(process.env.MEDIA_FILES);
104
- }
105
- } catch (error) {
106
- console.error("Error parsing MEDIA_FILES:", error);
107
- }
108
-
109
- console.log(`Running tests on after app,bslocal,mediafiles: ${JSON.stringify(capabilities)}`);
110
- }
79
+ // if (process.env.PLATFORM === 'browserstack') {
80
+ // /// console.log("capabilities:", capabilities);
81
+ // capabilities.browserstackLocal = process.env.BROWSERSTACK_LOCAL;
82
+ // // capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
83
+ // if (capabilities.platformName === 'android' || capabilities.platformName === 'ios') {
84
+ // capabilities.app = process.env.BROWSERSTACK_APP_PATH;
85
+ // if (capabilities.app === undefined || capabilities.app === null || capabilities.app === '') {
86
+ // console.error("🚨 Error: BROWSERSTACK_APP_PATH is not defined or empty.");
87
+ // resultdetails.excution_status = 'FAILED';
88
+ // resultdetails.comments.push("BROWSERSTACK_APP_PATH is not defined or empty.");
89
+ // await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails);
90
+ // process.exit(1); // Stop execution if app path is not set
91
+ // } else {
92
+ // console.log("App Path:", capabilities.app);
93
+ // console.log("Browserstack Local:", capabilities.browserstackLocal);
94
+ // }
95
+ // }
96
+
97
+ // try {
98
+ // let mediaFiles = process.env.MEDIA_FILES ? JSON.parse(process.env.MEDIA_FILES) : [];
99
+ // console.log("Size of Media Files:", Array.isArray(mediaFiles) ? mediaFiles.length : "Invalid data");
100
+
101
+ // if (Array.isArray(mediaFiles) && mediaFiles.length > 0) {
102
+ // console.log("Media Files:", JSON.parse(process.env.MEDIA_FILES));
103
+ // capabilities['browserstack.uploadMedia'] = JSON.parse(process.env.MEDIA_FILES);
104
+ // }
105
+ // } catch (error) {
106
+ // console.error("Error parsing MEDIA_FILES:", error);
107
+ // }
108
+
109
+ // console.log(`Running tests on after app,bslocal,mediafiles: ${JSON.stringify(capabilities)}`);
110
+ // }
111
111
 
112
112
  } catch (error) {
113
113
  console.error('🚨 Error in beforeSession:', error);
@@ -1,170 +1,35 @@
1
- const deepmerge = require('deepmerge')
2
- const fs = require('fs');
3
- const yaml = require('js-yaml');
4
- const path = require('path');
5
- const commonconfig = require('./commonconfig');
6
- console.log('=====wdios common config===== ');
7
- // Select platform at runtime
8
- const PLATFORM = process.env.PLATFORM || 'browserstack';
9
- console.log('====>PLATFORM:', PLATFORM);
10
-
11
- const configFile = process.env.YML_NAME;
12
-
13
- const resultdetails = {
14
- comments: [],
15
- excution_status: null, // Pass/Fail
16
- excution_time: null, // Execution time in milliseconds
17
- };
18
-
19
- // Load YAML file
20
- //const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
21
-
22
- let capabilities;
23
-
24
- try {
25
- capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
26
- // Merge chrome-specific options if applicable
27
-
28
- } catch (e) {
29
- 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`;
30
- console.error(errorMsg);
31
- resultdetails.comments.push(errorMsg);
32
- resultdetails.excution_status = 'FAIL';
33
-
34
- try {
35
- exeDetails.updateExecuitonDetails(
36
- process.env.ORGANISATION_DOMAIN_URL,
37
- process.env.API_TOKEN,
38
- process.env.EXECUTION_ID,
39
- resultdetails
40
- );
41
- setTimeout(() => {
42
- console.log("30 seconds passed.");
43
- // You can call your API or exit the process here
44
- }, 30000);
45
- console.log('Execution details updated successfully.');
46
- } catch (err) {
47
- console.error('Failed to update execution details:', err.message);
48
- }
49
- process.exit(1);
50
- }
51
- console.log('====>capabilities:', capabilities);
52
-
53
- const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
54
- console.log('====>SUITE_FILE:', SUITE_FILE);
55
-
56
- if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
57
- 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`;
58
-
59
- console.error(errorMsg);
60
- resultdetails.comments.push(errorMsg);
61
- resultdetails.excution_status = 'FAIL';
62
-
63
- // Fire API call in background (non-blocking)
64
-
65
- try {
66
- exeDetails.updateExecuitonDetails(
67
- process.env.ORGANISATION_DOMAIN_URL,
68
- process.env.API_TOKEN,
69
- process.env.EXECUTION_ID,
70
- resultdetails
71
- );
72
- setTimeout(() => {
73
- console.log("30 seconds passed.");
74
- // You can call your API or exit the process here
75
- }, 30000);
76
- console.log('Execution details updated successfully.');
77
- } catch (err) {
78
- console.error('Failed to update execution details:', err.message);
79
- }
80
- process.exit(1);
81
- }
82
-
83
- function setupPrerequisites() {
84
- console.log("inside this fuction first ");
85
- if (PLATFORM === 'browserstack') {
86
- process.env.BROWSERSTACK_USERNAME = capabilities.userName;
87
- capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
88
- process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey
89
-
90
- console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
91
- process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
92
- capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
93
-
1
+ const { config: baseConfig } = require('./baseconfig.js');
2
+
3
+ const parallelConfig = {
4
+ maxInstances: 10,
5
+ commonCapabilities: {
6
+ 'bstack:options': {
7
+ buildName: 'browserstack build',
8
+ source: 'webdriverio:sample-master:v1.2'
94
9
  }
95
-
96
- }
97
-
98
- const specificConfig = setupPrerequisites();
99
-
100
-
101
- exports.config = deepmerge(commonconfig,
102
-
10
+ },
11
+ services: [
12
+ [
13
+ 'browserstack',
14
+ { buildIdentifier: '#${BUILD_NUMBER}' },
15
+ ],
16
+ ],
17
+ capabilities: [
103
18
  {
104
- user: 'naveen_OSt3Pw',//process.env.BROWSERSTACK_USERNAME,
105
- key: 'B9Rx28MTKFzRJ2QEVK1c',//process.env.BROWSERSTACK_ACCESS_KEY,
106
- // debug: true,
107
- // execArgv: ['--inspect-brk'],
108
- services: PLATFORM === 'browserstack'
109
- ? ['browserstack']
110
- : PLATFORM === 'saucelabs'
111
- ? ['sauce']
112
- : [],
113
-
114
- runner: 'local',
115
- specs: require(SUITE_FILE).tests,
116
-
117
- maxInstances: 1,
118
- // capabilities: [capabilities],
119
- capabilities: [{
120
- platformName: "android",
121
-
122
- // ❗ automationName MUST be present for Appium/W3C
123
- "appium:automationName": "UIAutomator2",
124
-
125
- // ❗ App path stays under Appium namespace
126
- "appium:app": "bs://30fdf3a163d0bad126f64a3d5713e9ab0086a41e",
127
-
128
- // Vendor capabilities must go inside bstack:options
129
- "bstack:options": {
130
- userName: "naveen_OSt3Pw",
131
- accessKey: "B9Rx28MTKFzRJ2QEVK1c",
132
-
133
- deviceName: "Samsung Galaxy S22 Ultra",
134
- platformVersion: "12.0",
135
-
136
- buildName: "yesshop_319_20251208",
137
- buildIdentifier: "${BUILD_NUMBER}",
138
-
139
- projectName: "Yesshop Automation",
140
- sessionName: "Prepaid Reload",
141
-
142
- debug: true,
143
- networkLogs: true,
144
-
145
- // ❗ This must be inside bstack:options
146
- browserstackLocal: false,
19
+ browserName: 'chrome',
20
+ browserVersion: 'latest',
21
+ 'bstack:options': {
22
+ os: 'Windows',
23
+ osVersion: '10',
24
+ },
25
+ }
26
+ ],
27
+ };
147
28
 
148
- // Extra flags (optional)
149
- interactiveDebugging: true,
150
- deviceOrientation: "portrait"
151
- }
152
- }],
153
- logLevel: 'info',
154
- coloredLogs: true,
155
- screenshotPath: './errorShots/',
156
- bail: 0,
157
- //baseUrl: 'https://example.com',
158
- waitforTimeout: 90000,
159
- connectionRetryTimeout: 90000,
160
- connectionRetryCount: 3,
29
+ exports.config = { ...baseConfig, ...parallelConfig };
161
30
 
162
- framework: 'mocha',
163
- reporters: ['spec'],
164
- maxInstances: 10,
165
- updateJob: false,
166
- mochaOpts: {
167
- ui: 'bdd',
168
- timeout: 300000
169
- }
170
- });
31
+ // Code to support common capabilities
32
+ exports.config.capabilities.forEach(function (caps) {
33
+ for (var i in exports.config.commonCapabilities)
34
+ caps[i] = { ...caps[i], ...exports.config.commonCapabilities[i]};
35
+ });
@@ -0,0 +1,146 @@
1
+ const deepmerge = require('deepmerge')
2
+ const fs = require('fs');
3
+ const yaml = require('js-yaml');
4
+ const path = require('path');
5
+ const commonconfig = require('./commonconfig');
6
+ console.log('=====wdios common config===== ');
7
+ // Select platform at runtime
8
+ const PLATFORM = process.env.PLATFORM || 'browserstack';
9
+ console.log('====>PLATFORM:', PLATFORM);
10
+
11
+ const configFile = process.env.YML_NAME;
12
+
13
+ const resultdetails = {
14
+ comments: [],
15
+ excution_status: null, // Pass/Fail
16
+ excution_time: null, // Execution time in milliseconds
17
+ };
18
+
19
+ // Load YAML file
20
+ //const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
21
+
22
+ let capabilities;
23
+
24
+ try {
25
+ capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
26
+ // Merge chrome-specific options if applicable
27
+
28
+ } catch (e) {
29
+ 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`;
30
+ console.error(errorMsg);
31
+ resultdetails.comments.push(errorMsg);
32
+ resultdetails.excution_status = 'FAIL';
33
+
34
+ try {
35
+ exeDetails.updateExecuitonDetails(
36
+ process.env.ORGANISATION_DOMAIN_URL,
37
+ process.env.API_TOKEN,
38
+ process.env.EXECUTION_ID,
39
+ resultdetails
40
+ );
41
+ setTimeout(() => {
42
+ console.log("30 seconds passed.");
43
+ // You can call your API or exit the process here
44
+ }, 30000);
45
+ console.log('Execution details updated successfully.');
46
+ } catch (err) {
47
+ console.error('Failed to update execution details:', err.message);
48
+ }
49
+ process.exit(1);
50
+ }
51
+ console.log('====>capabilities:', capabilities);
52
+
53
+ const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
54
+ console.log('====>SUITE_FILE:', SUITE_FILE);
55
+
56
+ if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
57
+ 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`;
58
+
59
+ console.error(errorMsg);
60
+ resultdetails.comments.push(errorMsg);
61
+ resultdetails.excution_status = 'FAIL';
62
+
63
+ // Fire API call in background (non-blocking)
64
+
65
+ try {
66
+ exeDetails.updateExecuitonDetails(
67
+ process.env.ORGANISATION_DOMAIN_URL,
68
+ process.env.API_TOKEN,
69
+ process.env.EXECUTION_ID,
70
+ resultdetails
71
+ );
72
+ setTimeout(() => {
73
+ console.log("30 seconds passed.");
74
+ // You can call your API or exit the process here
75
+ }, 30000);
76
+ console.log('Execution details updated successfully.');
77
+ } catch (err) {
78
+ console.error('Failed to update execution details:', err.message);
79
+ }
80
+ process.exit(1);
81
+ }
82
+
83
+ function setupPrerequisites() {
84
+ console.log("inside this fuction first ");
85
+ if (PLATFORM === 'browserstack') {
86
+ process.env.BROWSERSTACK_USERNAME = capabilities.userName;
87
+ capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
88
+ process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey
89
+
90
+ console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
91
+ process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
92
+ capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
93
+
94
+ }
95
+
96
+ }
97
+
98
+ const specificConfig = setupPrerequisites();
99
+
100
+
101
+ exports.config = deepmerge(commonconfig,
102
+
103
+ {
104
+ user: process.env.BROWSERSTACK_USERNAME,
105
+ key: process.env.BROWSERSTACK_ACCESS_KEY,
106
+ // debug: true,
107
+ // execArgv: ['--inspect-brk'],
108
+ services: PLATFORM === 'browserstack'
109
+ ? ['browserstack']
110
+ : PLATFORM === 'saucelabs'
111
+ ? ['sauce']
112
+ : [],
113
+
114
+ //runner: 'local',
115
+ specs: require(SUITE_FILE).tests,
116
+
117
+ maxInstances: 1,
118
+ // capabilities: [capabilities],
119
+ capabilities: [{
120
+ // capabilities for local Appium web tests on an Android Emulator
121
+ platformName: 'Android',
122
+ browserName: 'Chrome',
123
+ 'appium:app': 'bs://30fdf3a163d0bad126f64a3d5713e9ab0086a41e',
124
+ 'appium:deviceName': 'Samsung Galaxy S22 Ultra',
125
+ 'appium:platformVersion': '12.0',
126
+ 'appium:automationName': 'UiAutomator2'
127
+ }],
128
+
129
+ logLevel: 'info',
130
+ coloredLogs: true,
131
+ screenshotPath: './errorShots/',
132
+ bail: 0,
133
+ //baseUrl: 'https://example.com',
134
+ waitforTimeout: 90000,
135
+ connectionRetryTimeout: 90000,
136
+ connectionRetryCount: 3,
137
+
138
+ framework: 'mocha',
139
+ reporters: ['spec'],
140
+ maxInstances: 10,
141
+ updateJob: false,
142
+ mochaOpts: {
143
+ ui: 'bdd',
144
+ timeout: 300000
145
+ }
146
+ });