froth-webdriverio-framework 6.0.41 → 6.0.43

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.
Files changed (36) hide show
  1. package/browserstack.err +1 -0
  2. package/buffer_storage/FROTHE_SUITE_DETAILS +1 -0
  3. package/buffer_storage/FROTH_EXECUTION_ID +1 -0
  4. package/buffer_storage/FROTH_LOGIN_TOKEN +1 -0
  5. package/buffer_storage/FROTH_TOTAL_DURATION +1 -0
  6. package/buffer_storage/ORGANISATION_DOMAIN_URL +1 -0
  7. package/froth_common_actions/Utils.js +167 -0
  8. package/froth_common_actions/alert.js +49 -0
  9. package/froth_common_actions/apicall.js +179 -0
  10. package/froth_common_actions/assert.js +85 -0
  11. package/froth_common_actions/captureNavigationTime.js +53 -0
  12. package/froth_common_actions/click.js +57 -0
  13. package/froth_common_actions/dropDown.js +34 -0
  14. package/froth_common_actions/jwt.js +64 -0
  15. package/froth_common_actions/logData.js +73 -0
  16. package/froth_common_actions/random.js +230 -0
  17. package/froth_common_actions/scroll.js +104 -0
  18. package/froth_common_actions/storeToBuffer.js +45 -0
  19. package/froth_common_actions/swicthWindowTab.js +36 -0
  20. package/froth_common_actions/swipe.js +219 -0
  21. package/froth_configs/base.config.js +26 -0
  22. package/froth_configs/browserstack/mobile.config.js +43 -0
  23. package/froth_configs/browserstack/web.config.js +25 -0
  24. package/froth_configs/commonconfig.js +1 -0
  25. package/froth_configs/commonhook.js +12 -0
  26. package/froth_configs/local/mobile.config.js +11 -0
  27. package/froth_configs/local/web.config.js +8 -0
  28. package/froth_configs/setallDatailinBuffer.js +101 -0
  29. package/froth_configs/wdio.common.conf copy.js +57 -0
  30. package/froth_configs/wdio.common.conf.js +88 -54
  31. package/local.log +8 -0
  32. package/log/key-metrics.json +3093 -0
  33. package/log/sdk-cli-debug.log +130 -0
  34. package/log/sdk-cli.log +10043 -0
  35. package/log/sdk-debug-utility.log +0 -0
  36. package/package.json +8 -5
@@ -0,0 +1,219 @@
1
+ async function swipeleft(selector, xoffset, speedinsec) {
2
+ try {
3
+ console.log('Swiping left');
4
+
5
+ if (xoffset == null) {
6
+ driver.swipeLeft(selector, speedinsec);
7
+ } else {
8
+ driver.swipeLeft(selector, xoffset, speedinsec);
9
+ }
10
+ } catch (error) {
11
+ console.error(error.message);
12
+ }
13
+
14
+ }
15
+
16
+ async function swiperight(selector, xoffset, speedinsec) {
17
+ try {
18
+ console.log('Swiping right');
19
+
20
+ if (xoffset == null) {
21
+ driver.swipeRight(selector, speedinsec);
22
+ } else {
23
+ driver.swipeRight(selector, xoffset, speedinsec);
24
+ }
25
+ } catch (error) {
26
+ console.error(error.message);
27
+ }
28
+
29
+ }
30
+
31
+ async function swipeup(selector, yoffset, speedinsec) {
32
+ try {
33
+ console.log('Swiping up');
34
+
35
+ if (yoffset == null) {
36
+ driver.swipeUp(selector, speedinsec);
37
+ } else {
38
+ driver.swipeUp(selector, yoffset, speedinsec);
39
+ }
40
+ } catch (error) {
41
+ console.error(error.message);
42
+ }
43
+ }
44
+
45
+ async function swipedown(selector, yoffset, speedinsec) {
46
+ try {
47
+ console.log('Swiping down');
48
+
49
+ if (yoffset == null) {
50
+ driver.swipeDown(selector, speedinsec);
51
+ } else {
52
+ driver.swipeDown(selector, yoffset, speedinsec);
53
+ }
54
+ } catch (error) {
55
+ console.error(error.message);
56
+ }
57
+ }
58
+
59
+ async function swipewithcoordinates(StartX, StartY, EndX, EndY) {
60
+
61
+ await driver.performActions([
62
+ {
63
+ type: "pointer",
64
+ id: "finger1",
65
+ parameters: { pointerType: "touch" },
66
+ actions: [
67
+ { type: "pointerMove", duration: 0, x: StartX, y: StartY },
68
+ { type: "pointerDown", button: 0 },
69
+ { type: "pause", duration: 300 },
70
+ { type: "pointerMove", duration: 1000, x: EndX, y: EndY },
71
+ { type: "pointerUp", button: 0 }
72
+ ],
73
+ }
74
+ ]);
75
+ }
76
+ async function swipetofit() {
77
+ // Get screen size dynamically
78
+ const screenSize = await driver.getWindowRect();
79
+ const screenWidth = screenSize.width;
80
+ const screenHeight = screenSize.height;
81
+
82
+ console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
83
+
84
+ // Define approximate positions for corners
85
+ const topRightStartX = screenWidth * 0.88; // Top-right corner
86
+ const topRightStartY = screenHeight * 0.44;
87
+
88
+ const topRightEndX = screenWidth * 0.96; // Expand to the right
89
+ const topRightEndY = screenHeight * 0.39; // Move upwards slightly
90
+
91
+ const bottomLeftStartX = screenWidth * 0.12; // Bottom-left corner
92
+ const bottomLeftStartY = screenHeight * 0.69;
93
+
94
+ const bottomLeftEndX = screenWidth * 0.014; // Expand to the left
95
+ const bottomLeftEndY = screenHeight * 0.73; // Move down slightly
96
+
97
+ console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
98
+ console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
99
+
100
+ // Resize from top-right corner
101
+ await driver.performActions([
102
+ {
103
+ type: "pointer",
104
+ id: "finger1",
105
+ parameters: { pointerType: "touch" },
106
+ actions: [
107
+ { type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
108
+ { type: "pointerDown", button: 0 },
109
+ { type: "pause", duration: 300 },
110
+ { type: "pointerMove", duration: 1000, x: topRightEndX, y: topRightEndY },
111
+ { type: "pointerUp", button: 0 }
112
+ ],
113
+ }
114
+ ]);
115
+
116
+ // Resize from bottom-left corner
117
+ await driver.performActions([
118
+ {
119
+ type: "pointer",
120
+ id: "finger2",
121
+ parameters: { pointerType: "touch" },
122
+ actions: [
123
+ { type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
124
+ { type: "pointerDown", button: 0 },
125
+ { type: "pause", duration: 300 },
126
+ { type: "pointerMove", duration: 1000, x: bottomLeftEndX, y: bottomLeftEndY },
127
+ { type: "pointerUp", button: 0 }
128
+ ],
129
+ }
130
+ ]);
131
+
132
+ console.log("✅ Crop overlay resized from two corners successfully!");
133
+ }
134
+
135
+ // async function swipetofit(TopRStartXpct, TopRStartYpct, TopREndXpct, TopREndYpct, BottomLStartXpct, BottomLStartYpct, BottomLEndXpct, BottomLEndYpct) {
136
+
137
+ // let topRightStartX; // Top-right corner
138
+ // let topRightStartY;
139
+
140
+ // let topRightEndX; // Expand to the right
141
+ // let topRightEndY; // Move upwards slightly
142
+
143
+ // let bottomLeftStartX; // Bottom-left corner
144
+ // let bottomLeftStartY;
145
+
146
+ // let bottomLeftEndX; // Expand to the left
147
+ // let bottomLeftEndY;
148
+
149
+ // // Get screen size dynamically
150
+ // const screenSize = await driver.getWindowRect();
151
+ // const screenWidth = screenSize.width;
152
+ // const screenHeight = screenSize.height;
153
+
154
+ // console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
155
+ // // Define approximate positions for corners
156
+
157
+ // if (TopRStartXpct === null) {// default calucaltion
158
+ // topRightStartX = screenWidth * 0.88; // Top-right corner
159
+ // topRightStartY = screenHeight * 0.44;
160
+
161
+ // topRightEndX = screenWidth * 0.96; // Expand to the right
162
+ // topRightEndY = screenHeight * 0.39; // Move upwards slightly
163
+
164
+ // bottomLeftStartX = screenWidth * 0.12; // Bottom-left corner
165
+ // bottomLeftStartY = screenHeight * 0.69;
166
+
167
+ // bottomLeftEndX = screenWidth * 0.014; // Expand to the left
168
+ // bottomLeftEndY = screenHeight * 0.73;
169
+ // } else {
170
+ // topRightStartX = screenWidth * (TopRStartXpct / 100); // Top-right corner
171
+ // topRightStartY = screenHeight * (TopRStartYpct / 100);
172
+
173
+ // topRightEndX = screenWidth * (TopREndXpct / 100); // Expand to the right
174
+ // topRightEndY = screenHeight * (TopREndYpct / 100); // Move upwards slightly
175
+
176
+ // bottomLeftStartX = screenWidth * (BottomLStartXpct / 100); // Bottom-left corner
177
+ // bottomLeftStartY = screenHeight * (BottomLStartYpct / 100);
178
+
179
+ // bottomLeftEndX = screenWidth * (BottomLEndXpct / 100); // Expand to the left
180
+ // bottomLeftEndY = screenHeight * (BottomLEndYpct / 100); // Move down slightly
181
+ // }
182
+ // console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
183
+ // console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
184
+
185
+ // // Resize from top-right corner
186
+ // await driver.performActions([
187
+ // {
188
+ // type: "pointer",
189
+ // id: "finger1",
190
+ // parameters: { pointerType: "touch" },
191
+ // actions: [
192
+ // { type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
193
+ // { type: "pointerDown", button: 0 },
194
+ // { type: "pause", duration: 300 },
195
+ // { type: "pointerMove", duration: 1000, x: topRightEndX, y: topRightEndY },
196
+ // { type: "pointerUp", button: 0 }
197
+ // ],
198
+ // }
199
+ // ]);
200
+
201
+ // // Resize from bottom-left corner
202
+ // await driver.performActions([
203
+ // {
204
+ // type: "pointer",
205
+ // id: "finger2",
206
+ // parameters: { pointerType: "touch" },
207
+ // actions: [
208
+ // { type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
209
+ // { type: "pointerDown", button: 0 },
210
+ // { type: "pause", duration: 300 },
211
+ // { type: "pointerMove", duration: 1000, x: bottomLeftEndX, y: bottomLeftEndY },
212
+ // { type: "pointerUp", button: 0 }
213
+ // ],
214
+ // }
215
+ // ]);
216
+
217
+ // console.log("✅ Crop overlay resized from two corners successfully!");
218
+ // }
219
+ module.exports = { swipeleft, swipedown, swiperight, swipeup, swipetofit, swipewithcoordinates };
@@ -0,0 +1,26 @@
1
+ const path = require('path');
2
+ const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
3
+ console.log('====>SUITE_FILE:', SUITE_FILE);
4
+
5
+ module.exports = {
6
+ specs: require(SUITE_FILE).tests,
7
+ exclude: [],
8
+
9
+
10
+ logLevel: 'info',
11
+ coloredLogs: true,
12
+ screenshotPath: './errorShots/',
13
+ baseUrl: '',
14
+
15
+
16
+ waitforTimeout: 10000,
17
+ connectionRetryTimeout: 90000,
18
+ connectionRetryCount: 3,
19
+
20
+
21
+ framework: 'mocha',
22
+ mochaOpts: {
23
+ ui: 'bdd',
24
+ timeout: 20000
25
+ }
26
+ };
@@ -0,0 +1,43 @@
1
+
2
+ const commonHooks = require('../commonhook');
3
+ const isLocal = process.env.LOCAL === 'true';
4
+ console.log('====> BrowserStack Local enabled:', isLocal);
5
+
6
+
7
+ module.exports = (bsCaps, isLocal = false, appPath) => ({
8
+
9
+ ...commonHooks,
10
+ user: bsCaps.userName,
11
+ key: bsCaps.accessKey,
12
+
13
+ services: [
14
+ [
15
+ 'browserstack',
16
+ {
17
+ buildIdentifier: process.env.BUILD_NUMBER || 'local-build',
18
+ browserstackLocal: isLocal,
19
+ opts: {
20
+ forcelocal: isLocal,
21
+ localIdentifier: `wdio-${process.pid}`,
22
+ },
23
+ app: appPath,
24
+ },
25
+ ],
26
+ ],
27
+
28
+
29
+ capabilities: [{
30
+ 'bstack:options': {
31
+ projectName: 'BrowserStack Samples',
32
+ buildName: 'browserstack build',
33
+ sessionName: 'Mobile Test',
34
+ deviceName: bsCaps.deviceName || 'Samsung Galaxy S22 Ultra',
35
+ osVersion: bsCaps.platformVersion || '12.0',
36
+ debug: bsCaps.debug,
37
+ networkLogs: bsCaps.networkLogs,
38
+ interactiveDebugging: bsCaps.interactiveDebugging
39
+ }
40
+ }],
41
+
42
+ updateJob: false
43
+ });
@@ -0,0 +1,25 @@
1
+ module.exports = (bsCaps) => ({
2
+ user: bsCaps.userName,
3
+ key: bsCaps.accessKey,
4
+
5
+
6
+ services: [
7
+ [
8
+ 'browserstack',
9
+ {
10
+ browserstackLocal: isLocal,
11
+ opts: { forcelocal: isLocal }
12
+ }
13
+ ]
14
+ ],
15
+
16
+
17
+ capabilities: [{
18
+ browserName: process.env.BROWSER || 'chrome',
19
+ 'bstack:options': {
20
+ os: 'Windows',
21
+ osVersion: '11',
22
+ buildName: 'BS Web Build'
23
+ }
24
+ }]
25
+ });
@@ -8,6 +8,7 @@ const exeDetails = require("../froth_api_calls/getexecutionDetails")
8
8
  const getBSSessionDetails = require("../froth_api_calls/browsersatckSessionInfo").getBSSessionDetails;
9
9
  const { fail } = require("assert");
10
10
  const { error } = require('console');
11
+ global.Util=require('../froth_common_actions/Utils');
11
12
  //const isBrowserStackEnabled = process.env.BROWSERSTACK;
12
13
  let starttime;
13
14
  let endtime;
@@ -0,0 +1,12 @@
1
+
2
+ const setAllDetails = require('./setallDatailinBuffer');
3
+
4
+ module.exports = {
5
+ onPrepare: async () => {
6
+ console.log('==== ON PREPARE HOOK ====');
7
+ await setAllDetails.setSuiteDetails();
8
+ await setAllDetails.setTestDataDetails();
9
+
10
+ console.log('✅ App & media updated before execution');
11
+ }
12
+ };
@@ -0,0 +1,11 @@
1
+ module.exports = () => ({
2
+ services: ['appium'],
3
+
4
+
5
+ capabilities: [{
6
+ platformName: 'Android',
7
+ 'appium:deviceName': 'Android Emulator',
8
+ 'appium:automationName': 'UiAutomator2',
9
+ 'appium:app': process.env.LOCAL_APP_PATH
10
+ }]
11
+ });
@@ -0,0 +1,8 @@
1
+ module.exports = () => ({
2
+ services: ['chromedriver'],
3
+
4
+
5
+ capabilities: [{
6
+ browserName: 'chrome'
7
+ }]
8
+ });
@@ -0,0 +1,101 @@
1
+ const getLoginToken = require("../froth_api_calls/loginapi");
2
+ const exeDetails = require("../froth_api_calls/getexecutionDetails")
3
+ const getSuiteDetails = require("../froth_api_calls/getsuiteDetails");
4
+ const getDataById = require("../froth_api_calls/readTestdata");
5
+
6
+ async function generateBuildNumber() {
7
+ try {
8
+ const now = await new Date();
9
+ const timestamp = await formatDate(now); // Format date as needed
10
+
11
+ // Construct the build number with timestamp and counter
12
+ const buildNumber = `${timestamp}`;
13
+ process.env.BUILD_NUMBER = buildNumber;
14
+ console.log("Generated Build Number:", buildNumber);
15
+ // Increment the counter for the next build
16
+ } catch (error) {
17
+ console.log("error in generateBuildNumber")
18
+ }
19
+ //return buildNumber;
20
+ }
21
+
22
+ async function formatDate(date) {
23
+ const year = await date.getFullYear();
24
+ const month = await padZero(date.getMonth() + 1); // Month is zero-indexed
25
+ const day = await padZero(date.getDate());
26
+ const hours = await padZero(date.getHours());
27
+ const minutes = await padZero(date.getMinutes());
28
+ const seconds = await padZero(date.getSeconds());
29
+
30
+ return `${year}${month}${day}_${hours}${minutes}${seconds}`;
31
+ }
32
+
33
+ async function padZero(num) {
34
+ return await num.toString().padStart(2, '0');
35
+ }
36
+
37
+ async function setEnvVariables() {
38
+ await generateBuildNumber();
39
+ await BUFFER.setItem("FROTH_TOTAL_DURATION", 0);
40
+ await BUFFER.setItem("FROTH_EXECUTION_ID", process.env.EXECUTION_ID || 1);
41
+ await BUFFER.setItem("ORGANISATION_DOMAIN_URL", process.env.ORGANISATION_DOMAIN_URL || "https://devapi.frothtestops.com");
42
+ await BUFFER.setItem("FROTH_LOGIN_TOKEN", process.env.API_TOKEN)
43
+ console.log("api token in set evn variable :" + BUFFER.getItem("FROTH_LOGIN_TOKEN"))
44
+ console.log("CICD_RUN_ID in set evn variable :" + process.env.CICD_RUN_ID)
45
+ }
46
+
47
+ async function setLoginToken() {
48
+ try {
49
+
50
+ const getToken = await getLoginToken(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD"));
51
+ process.env.FROTH_LOGIN_TOKEN = getToken;
52
+ BUFFER.setItem("FROTH_LOGIN_TOKEN", getToken)
53
+
54
+ } catch (error) {
55
+ // console.error('Error in main function:', error);
56
+ }
57
+ }
58
+
59
+ async function setExecutionDetails() {
60
+ let getExeDetails;
61
+ try {
62
+ getExeDetails = await exeDetails.getExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"));
63
+ process.env.AUTOMATION_SUITE_ID = getExeDetails.automation_suite_id;
64
+ // process.env.EXEC_BROWSERSTACK_LOCAL =
65
+ // String(getExeDetails.browser_stack_local);
66
+ // process.env.BROWSERSTACK_APP_PATH = getExeDetails.app_url;
67
+ process.env.MEDIA_FILES = JSON.stringify(getExeDetails.mediaurls);
68
+ console.log("Execution Details:", JSON.stringify(getExeDetails));
69
+
70
+ } catch (error) {
71
+ // console.error('Error in main function:', error);
72
+ } return getExeDetails;
73
+ }
74
+
75
+
76
+ async function setSuiteDetails() {
77
+ try {
78
+ const getSuiteDetail = await getSuiteDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), process.env.AUTOMATION_SUITE_ID);
79
+ BUFFER.setItem("FROTHE_SUITE_DETAILS", JSON.stringify(getSuiteDetail.script_details))
80
+ process.env.TESTDATA_ID = getSuiteDetail.test_data_id;
81
+ return getSuiteDetail;
82
+
83
+ } catch (error) {
84
+ // console.error('Error in main function:', error);
85
+ }
86
+ }
87
+ async function setTestDataDetails() {
88
+ try {
89
+ const jsonobject = await getDataById(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), process.env.TESTDATA_ID);
90
+
91
+ } catch (error) {
92
+ // console.error('Error in main function:', error);
93
+ }
94
+ }
95
+ module.exports = {
96
+ setEnvVariables,
97
+ setLoginToken,
98
+ setExecutionDetails,
99
+ setSuiteDetails,
100
+ setTestDataDetails
101
+ };
@@ -0,0 +1,57 @@
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
+ exports.config = {
6
+ user: process.env.BROWSERSTACK_USERNAME || 'naveen_OSt3Pw',
7
+ key: process.env.BROWSERSTACK_ACCESS_KEY || 'B9Rx28MTKFzRJ2QEVK1c',
8
+ services: [
9
+ [
10
+ 'browserstack',
11
+ {
12
+ buildIdentifier: '${BUILD_NUMBER}',
13
+ browserstackLocal: true,
14
+ opts: { forcelocal: true, localIdentifier: "webdriverio-appium-app-browserstack-android-repo" },
15
+ app: process.env.BROWSERSTACK_APP_PATH || 'bs://30fdf3a163d0bad126f64a3d5713e9ab0086a41e'
16
+ }
17
+ ]
18
+ ],
19
+
20
+ capabilities: [{
21
+ 'bstack:options': {
22
+ projectName: "BrowserStack Samples",
23
+ buildName: 'browserstack build',
24
+ sessionName: 'BStack local webdriverio-appium',
25
+ deviceName: 'Samsung Galaxy S22 Ultra',
26
+ osVersion: "12.0",
27
+ debug: true,
28
+ networkLogs: true,
29
+ source: 'webdriverio:appium-sample-sdk:v1.0',
30
+ interactiveDebugging: true,
31
+ 'appium:autoWebview': false
32
+ }
33
+ }],
34
+
35
+ updateJob: false,
36
+ // specs: [
37
+ // '/Users/subhrasubudhi/WORKSPACES/WEBDRIVERIO/SAMPLE_BS_LOCAL_PROJECT/android/examples/run-local-test/specs/local_test.js'
38
+ // ],
39
+
40
+ specs: require(SUITE_FILE).tests,
41
+
42
+ exclude: [],
43
+
44
+ logLevel: 'info',
45
+ coloredLogs: true,
46
+ screenshotPath: './errorShots/',
47
+ baseUrl: '',
48
+ waitforTimeout: 10000,
49
+ connectionRetryTimeout: 90000,
50
+ connectionRetryCount: 3,
51
+
52
+ framework: 'mocha',
53
+ mochaOpts: {
54
+ ui: 'bdd',
55
+ timeout: 20000
56
+ }
57
+ };
@@ -1,57 +1,91 @@
1
+ const deepmerge = require('deepmerge');
2
+ const baseConfig = require('./base.config');
3
+ const PLATFORM = process.env.PLATFORM || 'browserstack';
1
4
  const path = require('path');
5
+ const fs = require('fs');
6
+ const yaml = require('js-yaml');
7
+ const setAllDetails = require('./setallDatailinBuffer');
8
+ const { LocalStorage } = require('node-localstorage');
9
+ global.BUFFER = new LocalStorage('./buffer_storage');
10
+ let envConfig;
11
+ let bsCaps;
12
+ let local = false;
13
+ let appPath = '';
14
+ // --------------------
15
+ // Step 1: Fetch execution details BEFORE config loads
16
+ // --------------------
17
+ function loadExecutionDetails() {
18
+ try {
19
+ console.log("Inside the lcoal execution deatils")
20
+ setAllDetails.setEnvVariables();
21
+ const getExeDetails = setAllDetails.setExecutionDetails();
22
+ // ✅ SAFE: App assignment only
23
+ // appPath=getExeDetails.app_url;
24
+ appPath = 'bs://30fdf3a163d0bad126f64a3d5713e9ab0086a41e';
2
25
 
3
- const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
4
- console.log('====>SUITE_FILE:', SUITE_FILE);
5
- exports.config = {
6
- user: process.env.BROWSERSTACK_USERNAME || 'naveen_OSt3Pw',
7
- key: process.env.BROWSERSTACK_ACCESS_KEY || 'B9Rx28MTKFzRJ2QEVK1c',
8
- services: [
9
- [
10
- 'browserstack',
11
- {
12
- buildIdentifier: '${BUILD_NUMBER}',
13
- browserstackLocal: false,
14
- opts: { forcelocal: false, localIdentifier: "webdriverio-appium-app-browserstack-android-repo" },
15
- app: process.env.BROWSERSTACK_APP_PATH || 'bs://30fdf3a163d0bad126f64a3d5713e9ab0086a41e'
16
- }
17
- ]
18
- ],
19
-
20
- capabilities: [{
21
- 'bstack:options': {
22
- projectName: "BrowserStack Samples",
23
- buildName: 'browserstack build',
24
- sessionName: 'BStack local webdriverio-appium',
25
- deviceName: 'Samsung Galaxy S22 Ultra',
26
- osVersion: "12.0",
27
- debug: true,
28
- networkLogs: true,
29
- source: 'webdriverio:appium-sample-sdk:v1.0',
30
- interactiveDebugging: true,
31
- 'appium:autoWebview': false
32
- }
33
- }],
34
-
35
- updateJob: false,
36
- // specs: [
37
- // '/Users/subhrasubudhi/WORKSPACES/WEBDRIVERIO/SAMPLE_BS_LOCAL_PROJECT/android/examples/run-local-test/specs/local_test.js'
38
- // ],
39
-
40
- specs: require(SUITE_FILE).tests,
41
-
42
- exclude: [],
43
-
44
- logLevel: 'info',
45
- coloredLogs: true,
46
- screenshotPath: './errorShots/',
47
- baseUrl: '',
48
- waitforTimeout: 10000,
49
- connectionRetryTimeout: 90000,
50
- connectionRetryCount: 3,
51
-
52
- framework: 'mocha',
53
- mochaOpts: {
54
- ui: 'bdd',
55
- timeout: 20000
26
+ // Map API flag → LOCAL
27
+ local =
28
+ String(getExeDetails.browser_stack_local) === 'true' ? 'true' : 'false';
29
+ // local=false;
30
+ console.log('✅ Execution details loaded, LOCAL:', local);
31
+ console.log('✅ App URL:', process.env.BROWSERSTACK_APP_PATH);
32
+ } catch (error) {
33
+ console.error('❌ Failed to load execution details:', error.message);
34
+ process.exit(1);
56
35
  }
57
- };
36
+ }
37
+
38
+ loadExecutionDetails();
39
+
40
+ try {
41
+ const configFile = process.env.YML_NAME;
42
+ if (!configFile) {
43
+ throw new Error('YML_NAME environment variable is not set');
44
+ }
45
+ const ymlPath = path.resolve(process.cwd(), configFile);
46
+ bsCaps = yaml.load(fs.readFileSync(ymlPath, 'utf8'));
47
+ // Merge chrome-specific options if applicable
48
+
49
+ } catch (e) {
50
+ console.error('❌ Failed to load capability YAML:', err.message);
51
+ process.exit(1);
52
+ }
53
+ console.log('====>capabilities:', bsCaps);
54
+ const platformName = (bsCaps.platformName || 'web').toLowerCase();
55
+
56
+ process.env.BS_SESSION_TYPE =
57
+ platformName === 'android' || platformName === 'ios'
58
+ ? 'app-automate'
59
+ : 'automate';
60
+
61
+ // Normalize OS for config selection
62
+ const OS =
63
+ platformName === 'android' || platformName === 'ios'
64
+ ? 'mobile'
65
+ : 'web';
66
+
67
+ console.log('====> PLATFORM :', PLATFORM);
68
+ console.log('====> OS :', OS);
69
+ console.log('====> PLATFORM NAME :', platformName);
70
+ console.log('====> BS SESSION TYPE :', process.env.BS_SESSION_TYPE);
71
+
72
+
73
+
74
+ // --------------------
75
+ // Load env-specific config
76
+ // --------------------
77
+ if (PLATFORM === 'browserstack') {
78
+ envConfig =
79
+ OS === 'web'
80
+ ? require('./browserstack/web.config')
81
+ : require('./browserstack/mobile.config');
82
+ } else {
83
+ envConfig =
84
+ OS === 'web'
85
+ ? require('./local/web.config')
86
+ : require('./local/mobile.config');
87
+ }
88
+
89
+
90
+ exports.config = deepmerge(baseConfig, envConfig(bsCaps, local, appPath));
91
+
package/local.log ADDED
@@ -0,0 +1,8 @@
1
+
2
+
3
+ Sat Dec 13 2025 17:21:35:889 GMT+0800 (+08) -- [WARNING] Skipping initialisation of configuration console because: port already in use by another Binary
4
+ Sat Dec 13 2025 17:21:38:172 GMT+0800 (+08) -- [SUCCESS] You can now access your local server(s) in our remote browser
5
+
6
+ Sat Dec 13 2025 17:21:38:646 GMT+0800 (+08) -- Press Ctrl-C to exit
7
+
8
+