froth-webdriverio-framework 3.0.111 → 3.0.113

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 (31) hide show
  1. package/{api → froth_api_calls}/browsersatckSessionInfo.js +8 -4
  2. package/{api → froth_api_calls}/getexecutionDetails.js +41 -26
  3. package/{api → froth_api_calls}/getsuiteDetails.js +14 -13
  4. package/{api → froth_api_calls}/loginapi.js +2 -4
  5. package/{api → froth_api_calls}/readTestdata.js +6 -4
  6. package/{commonMethods → froth_common_actions}/Utils.js +21 -9
  7. package/{commonMethods → froth_common_actions}/alert.js +3 -3
  8. package/{commonMethods → froth_common_actions}/apicall.js +17 -5
  9. package/{commonMethods → froth_common_actions}/click.js +24 -1
  10. package/{commonMethods → froth_common_actions}/jwt.js +1 -1
  11. package/{commonMethods → froth_common_actions}/scroll.js +23 -1
  12. package/froth_common_actions/swipe.js +219 -0
  13. package/{config → froth_configs}/commonconfig.js +66 -37
  14. package/{config → froth_configs}/setallDatailinBuffer.js +19 -16
  15. package/froth_configs/wdio.common.conf.js +74 -0
  16. package/package.json +5 -6
  17. package/.github/workflows/main.yml +0 -23
  18. package/commonMethods/swipe.js +0 -59
  19. package/config/android.conf.js +0 -49
  20. package/config/api.conf.bs.js +0 -76
  21. package/config/api.conf.js +0 -77
  22. package/config/common.mobile.conf.js +0 -45
  23. package/config/injectimage.js +0 -4
  24. package/config/ios.conf.js +0 -47
  25. package/config/web.conf.bs.js +0 -76
  26. package/config/web.conf.js +0 -70
  27. /package/{api → froth_api_calls}/aesEncryption.js +0 -0
  28. /package/{commonMethods → froth_common_actions}/assert.js +0 -0
  29. /package/{commonMethods → froth_common_actions}/dropDown.js +0 -0
  30. /package/{commonMethods → froth_common_actions}/random.js +0 -0
  31. /package/{commonMethods → froth_common_actions}/storeToBuffer.js +0 -0
@@ -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 };
@@ -1,45 +1,65 @@
1
- const setAllDetails = require("./setallDatailinBuffer")
1
+ const path = require('path');
2
2
  const { LocalStorage } = require('node-localstorage');
3
3
  global.BUFFER = new LocalStorage('./storage');
4
- const path = require('path');
5
- const exeDetails = require("../api/getexecutionDetails")
6
- const getBSSessionDetails = require("../api/browsersatckSessionInfo").getBSSessionDetails;
4
+ const setAllDetails = require("./setallDatailinBuffer")
5
+ const exeDetails = require("../froth_api_calls/getexecutionDetails")
6
+ const getBSSessionDetails = require("../froth_api_calls/browsersatckSessionInfo").getBSSessionDetails;
7
7
  const { fail } = require("assert");
8
- const isBrowserStackEnabled = process.env.BROWSERSTACK;
8
+ //const isBrowserStackEnabled = process.env.BROWSERSTACK;
9
9
  let starttime;
10
10
  let endtime;
11
+ console.log('===== common config===== ');
11
12
 
12
13
  // Description: This file contains the common configuration for the webdriverio framework.
13
14
  const commonconfig = {
14
15
 
15
16
 
16
17
  onPrepare: async function (capabilities, specs) {
17
- try{
18
- // This code runs before the test suite starts
19
- await setAllDetails.setEnvVariables();
20
- await setAllDetails.setLoginToken();
21
- await setAllDetails.setExecutionDetails();
22
- // await setAllDetails.setIntegrationsDetails();
23
- await setAllDetails.setSuiteDetails();
24
- await setAllDetails.setTestDataDetails();
25
- // console.log(JSON.stringify(capabilities))
26
- // console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
27
- }catch(e){
28
- console.log("====> Error in onPrepare:",e);
18
+ try {
19
+ console.log('==== ON PREPARE HOOK ====');
20
+ // This code runs before the test suite starts
21
+ await setAllDetails.setEnvVariables();
22
+ // await setAllDetails.setLoginToken();
23
+ await setAllDetails.setExecutionDetails();
24
+
25
+ // await setAllDetails.setIntegrationsDetails();
26
+ await setAllDetails.setSuiteDetails();
27
+ await setAllDetails.setTestDataDetails();
28
+ console.log("on prepare:", JSON.stringify(capabilities))
29
+ // console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
30
+ } catch (e) {
31
+ console.log("====> Error in onPrepare:", e);
29
32
 
30
33
  }
31
34
  },
32
35
 
33
36
 
34
- beforeSession: async function (config, capabilities,specs ) {
35
- console.log('====> This is the beforesession hook');
37
+ beforeSession: async function (config, capabilities, specs) {
38
+ console.log('==== BEFORE SESSION HOOK ====');
36
39
  // Perform any setup or pre-test actions here
37
- // console.log("Capabilities:", capabilities);
38
- console.log("Specs:", specs.length);
39
- const specdat=specs
40
- console.log("specdat:", specdat);
41
- console.log("length:", specdat.length);
42
- // console.log("Config:", config);
40
+ // console.log("Capabilities:", capabilities);
41
+
42
+ console.log("specdat:", specs);
43
+ console.log("length:", specs.length);
44
+
45
+ if (process.env.PLATFORM === 'browserstack') {
46
+ /// console.log("capabilities:", capabilities);
47
+ capabilities.browserstackLocal = process.env.BROWSERSTACK_LOCAL;
48
+ // capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
49
+ if (capabilities.platformName === 'android' || capabilities.platformName === 'ios')
50
+ capabilities.app = process.env.BROWSERSTACK_APP_PATH;
51
+
52
+
53
+ if (process.env.MEDIA_FILES) {
54
+ console.log("Media Files:", JSON.parse(process.env.MEDIA_FILES));
55
+ console.log("Size of Media Files:", process.env.MEDIA_FILES.length);
56
+ if (process.env.MEDIA_FILES.length > 0)
57
+ capabilities['browserstack.uploadMedia'] = JSON.parse(process.env.MEDIA_FILES);
58
+ }
59
+
60
+ console.log(`Running tests on after app,bslocal,mediafiles: ${JSON.stringify(capabilities)}`);
61
+ }
62
+
43
63
  },
44
64
  /**
45
65
  * Gets executed before the suite starts (in Mocha/Jasmine only).
@@ -47,16 +67,17 @@ const commonconfig = {
47
67
  */
48
68
  beforeSuite: async function (suite) {
49
69
  try {
70
+ console.log('==== BEFORE SUITE HOOK ====');
71
+
50
72
  console.log(`====> Test suite has been started ' ${suite.title}' `,);
51
73
 
52
74
  starttime = new Date().getTime();
53
75
 
54
- if (isBrowserStackEnabled) {
55
- console.log("BrowserStack is enabled");
76
+ if (process.env.PLATFORM === 'browserstack')
56
77
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
57
- }
78
+
58
79
  const resultdetails = {};
59
- exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
80
+ await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
60
81
 
61
82
  } catch (e) {
62
83
  console.log("Error in beforeSuite:", e);
@@ -69,6 +90,7 @@ const commonconfig = {
69
90
  * @param {object} context scope object the test was executed with
70
91
  */
71
92
  beforeTest: function (test, context) {
93
+ console.log('==== BEFORE TEST HOOK ====');
72
94
  console.log(`====> Test Started '${test.title}'`);
73
95
 
74
96
  // console.log("File Name:", test.file);
@@ -87,6 +109,8 @@ const commonconfig = {
87
109
  * @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
88
110
  */
89
111
  afterTest: async function (test, context, { error, result, duration, passed, retries }) {
112
+ console.log('==== AFTER TEST HOOK ====');
113
+
90
114
  console.log(`====> Test name finished '${test.title}'`);
91
115
 
92
116
  const fileName = path.basename(test.file);
@@ -108,7 +132,7 @@ const commonconfig = {
108
132
  // scriptresult = "FAILED"
109
133
  }
110
134
  let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
111
- let script_platform = BUFFER.getItem(fileName.replace(".js", "")+"_PLATFORM")
135
+ let script_platform = BUFFER.getItem(fileName.replace(".js", "") + "_PLATFORM")
112
136
 
113
137
  await exeDetails.updateScriptExecutionStatus(
114
138
  BUFFER.getItem("ORGANISATION_DOMAIN_URL"),
@@ -123,6 +147,8 @@ const commonconfig = {
123
147
  * @param {object} suite suite details
124
148
  */
125
149
  afterSuite: function (suite) {
150
+ console.log('==== AFTER SUITE HOOK ====');
151
+
126
152
  console.log(`====> Test suite has completed '${suite.title}'`);
127
153
  },
128
154
  /**
@@ -133,6 +159,8 @@ const commonconfig = {
133
159
  * @param {Array.<String>} specs List of spec file paths that ran
134
160
  */
135
161
  after: async function (result, config, capabilities, specs) {
162
+ console.log('==== AFTER HOOK ====');
163
+
136
164
  console.log('====> All tests are completed.' + result);
137
165
 
138
166
  BUFFER.setItem("RESULT_DATA", result);
@@ -149,9 +177,11 @@ const commonconfig = {
149
177
  },
150
178
 
151
179
  afterSession: async function (config, capabilities, specs) {
180
+ console.log('==== AFTER SESSION HOOK ====');
181
+
152
182
  console.log('====> This is the aftersession hook');
153
183
  // Perform any cleanup or post-test actions here
154
- console.log("Capabilities:", capabilities);
184
+ // console.log("Capabilities:", capabilities);
155
185
  console.log("Specs:", specs);
156
186
  console.log("Config:", config);
157
187
 
@@ -159,7 +189,7 @@ const commonconfig = {
159
189
  let totalDuration = endtime - starttime;
160
190
  console.log("====> Total Duration in after session based on start time and end time:" + totalDuration);
161
191
 
162
- if (isBrowserStackEnabled)
192
+ if (process.env.PLATFORM === 'browserstack')
163
193
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
164
194
 
165
195
  const resultdetails = {}
@@ -175,19 +205,18 @@ const commonconfig = {
175
205
  },
176
206
 
177
207
  onComplete: async function (exitCode, config, capabilities, results) {
178
-
179
- console.log('====> This is the onComplete hook', results);
208
+ console.log('==== ON COMPLETE HOOK ====');
180
209
 
181
- console.log('====> Test Results Summary ');
182
- console.log('----------------------------');
210
+ console.log('====> Results:', results);
183
211
 
212
+ console.log('==== Test Results Summary ======');
184
213
  console.log('Total Tests:', results.total);
185
214
  console.log('Passed:', results.passed);
186
215
  console.log('Failed:', results.failed);
187
216
  console.log('Skipped:', results.skipped);
188
217
  console.log('Execution Time:', results.duration);
189
218
  console.log('Exit Code:', exitCode);
190
- console.log('====> All tests are done, exiting the browser session.');
219
+ console.log('==== ALL TESTS ARE COMPLETED ====');
191
220
 
192
221
  }
193
222
 
@@ -1,9 +1,8 @@
1
- const getLoginToken = require("../api/loginapi");
2
- const exeDetails = require("../api/getexecutionDetails")
3
- //const getintegrationdetails = require("../api/getintegrationDetails");
4
- const getSuiteDetails = require("../api/getsuiteDetails");
5
- const getDataById = require("../api/readTestdata");
6
-
1
+ const getLoginToken = require("../froth_api_calls/loginapi");
2
+ const exeDetails = require("../froth_api_calls/getexecutionDetails")
3
+ //const getintegrationdetails = require("../froth_api_calls/getintegrationDetails");
4
+ const getSuiteDetails = require("../froth_api_calls/getsuiteDetails");
5
+ const getDataById = require("../froth_api_calls/readTestdata");
7
6
 
8
7
  async function generateBuildNumber() {
9
8
  try {
@@ -42,16 +41,17 @@ async function setEnvVariables() {
42
41
  BUFFER.setItem("FROTH_EXECUTION_ID", process.env.EXECUTION_ID || 1);
43
42
  BUFFER.setItem("FROTH_INTEGRATION_ID", process.env.INTEGRATION_ID || 1);
44
43
  BUFFER.setItem("ORGANISATION_DOMAIN_URL", process.env.ORGANISATION_DOMAIN_URL || "https://devapi.frothtestops.com");
45
- BUFFER.setItem("SERVICE_USER", "frothbot@roboticodigital.com");
46
- BUFFER.setItem("SERVICE_PASSWORD", "WVUVh7fZ+zMyJqtoe846cEHL0gXJWUk99KzUPu7d6AQUBIw0Ytn01QYObWMDMPma");
47
-
44
+ // BUFFER.setItem("SERVICE_USER", "frothbot@roboticodigital.com");
45
+ // BUFFER.setItem("SERVICE_PASSWORD", "Frothtestops@555");
46
+ BUFFER.setItem("FROTH_LOGIN_TOKEN", process.env.API_TOKEN)
47
+ console.log("api token in set evn variable :" + BUFFER.getItem("FROTH_LOGIN_TOKEN"))
48
48
 
49
49
  }
50
50
 
51
51
  async function setLoginToken() {
52
52
  try {
53
53
 
54
- const getToken = await getLoginToken(BUFFER.getItem("ORGANISATION_DOMAIN_URL") , BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD"));
54
+ const getToken = await getLoginToken(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD"));
55
55
  process.env.FROTH_LOGIN_TOKEN = getToken;
56
56
  BUFFER.setItem("FROTH_LOGIN_TOKEN", getToken)
57
57
 
@@ -63,7 +63,11 @@ async function setLoginToken() {
63
63
  async function setExecutionDetails() {
64
64
  try {
65
65
  const getExeDetails = await exeDetails.getExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"));
66
- BUFFER.setItem("AUTOMATION_SUITE_ID", getExeDetails.automation_suite_id);
66
+ process.env.AUTOMATION_SUITE_ID = getExeDetails.automation_suite_id;
67
+ process.env.BROWSERSTACK_LOCAL = getExeDetails.browser_stack_local;
68
+ process.env.BROWSERSTACK_APP_PATH = getExeDetails.app_url;
69
+ process.env.MEDIA_FILES = JSON.stringify(getExeDetails.mediaurls);
70
+ console.log("Execution Details:", JSON.stringify(getExeDetails));
67
71
 
68
72
  } catch (error) {
69
73
  // console.error('Error in main function:', error);
@@ -73,9 +77,9 @@ async function setExecutionDetails() {
73
77
 
74
78
  async function setSuiteDetails() {
75
79
  try {
76
- const getSuiteDetail = await getSuiteDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("AUTOMATION_SUITE_ID"));
77
- process.env.BROWSERSTACK_APP_PATH = getSuiteDetail.browser_stack_urls;
78
- BUFFER.setItem("TESTDATA_ID", getSuiteDetail.test_data_id);
80
+ const getSuiteDetail = await getSuiteDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), process.env.AUTOMATION_SUITE_ID);
81
+ // process.env.BROWSERSTACK_APP_PATH = getSuiteDetail.browser_stack_urls;
82
+ process.env.TESTDATA_ID = getSuiteDetail.test_data_id;
79
83
 
80
84
 
81
85
  } catch (error) {
@@ -84,7 +88,7 @@ async function setSuiteDetails() {
84
88
  }
85
89
  async function setTestDataDetails() {
86
90
  try {
87
- const jsonobject = await getDataById(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("TESTDATA_ID"));
91
+ const jsonobject = await getDataById(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), process.env.TESTDATA_ID);
88
92
 
89
93
  } catch (error) {
90
94
  // console.error('Error in main function:', error);
@@ -94,7 +98,6 @@ module.exports = {
94
98
  setEnvVariables,
95
99
  setLoginToken,
96
100
  setExecutionDetails,
97
- //setIntegrationsDetails,
98
101
  setSuiteDetails,
99
102
  setTestDataDetails
100
103
  };
@@ -0,0 +1,74 @@
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
+
8
+ // Select platform at runtime
9
+ const PLATFORM = process.env.PLATFORM || 'browserstack';
10
+ const configFile = process.env.YML_NAME || '../ymls/browserstack/android/android_caps.yml';
11
+ console.log('====>PLATFORM:', PLATFORM);
12
+ // Load YAML file
13
+ const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
14
+ console.log('====>capabilities:', capabilities);
15
+ const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
16
+ console.log('====>SUITE_FILE:', SUITE_FILE);
17
+
18
+
19
+ function setupPrerequisites() {
20
+ console.log("inside this fuction first ");
21
+ if (PLATFORM === 'browserstack') {
22
+ process.env.BROWSERSTACK_USERNAME = capabilities.userName;
23
+ capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
24
+ process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey
25
+ console.log('capabilities.platformName:', capabilities.platformName);
26
+ process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
27
+ capabilities.buildName = process.env.BROWSERSTACK_BUILD_NAME;
28
+
29
+ }
30
+
31
+ }
32
+
33
+ const specificConfig = setupPrerequisites();
34
+
35
+
36
+ exports.config = deepmerge(commonconfig,
37
+
38
+ {
39
+ user: process.env.BROWSERSTACK_USERNAME,
40
+ key: process.env.BROWSERSTACK_ACCESS_KEY ,
41
+ // debug: true,
42
+ // execArgv: ['--inspect-brk'],
43
+ services: PLATFORM === 'browserstack'
44
+ ? ['browserstack']
45
+ : PLATFORM === 'saucelabs'
46
+ ? ['sauce']
47
+ : [],
48
+
49
+ //runner: 'local',
50
+ specs: require(SUITE_FILE).tests,
51
+
52
+ maxInstances: 1,
53
+ capabilities: [capabilities],
54
+
55
+ logLevel: 'info',
56
+ coloredLogs: true,
57
+ screenshotPath: './errorShots/',
58
+ bail: 0,
59
+ //baseUrl: 'https://example.com',
60
+ waitforTimeout: 90000,
61
+ connectionRetryTimeout: 90000,
62
+ connectionRetryCount: 3,
63
+
64
+ framework: 'mocha',
65
+ reporters: ['spec'],
66
+ maxInstances: 10,
67
+ updateJob: false,
68
+ mochaOpts: {
69
+ ui: 'bdd',
70
+ timeout: 300000
71
+ }
72
+ });
73
+
74
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "3.0.111",
3
+ "version": "3.0.113",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",
@@ -31,21 +31,20 @@
31
31
  "@wdio/local-runner": "^9.0.9",
32
32
  "@wdio/mocha-framework": "^8.36.1",
33
33
  "@wdio/spec-reporter": "^8.36.1",
34
- "appium": "^1.22.3",
35
- "appium-uiautomator2-driver": "^2.2.0",
34
+ "appium": "^2.15.0",
35
+ "appium-uiautomator2-driver": "^4.0.1",
36
36
  "assert": "^2.1.0",
37
37
  "axios": "^1.7.7",
38
38
  "browserstack-local": "^1.5.5",
39
39
  "chai": "^5.1.1",
40
- "crypto": "^1.0.1",
41
40
  "crypto-js": "^4.2.0",
42
41
  "deepmerge": "^4.3.1",
43
42
  "form-data": "^4.0.0",
43
+ "fs": "^0.0.1-security",
44
+ "js-yaml": "^4.1.0",
44
45
  "mysql2": "^3.10.2",
45
46
  "node-fetch": "^3.3.2",
46
47
  "node-localstorage": "^3.0.5",
47
- "pg": "^8.12.0",
48
- "pg-promise": "^11.9.0",
49
48
  "randexp": "^0.5.3",
50
49
  "ts-node": "^10.9.2",
51
50
  "typescript": "^5.4.5"
@@ -1,23 +0,0 @@
1
- name: npm_package
2
-
3
- on:
4
- workflow_dispatch:
5
-
6
- jobs:
7
- release:
8
- name: release
9
- runs-on: ubuntu-latest
10
- steps:
11
- - name: Checkout code
12
- uses: actions/checkout@v2
13
- - name: Setup Node.js
14
- uses: actions/setup-node@v2
15
- with:
16
- node-version: '12.x'
17
- registry-url: https://registry.npmjs.org
18
-
19
- - name: Publish to npm
20
- run: npm publish --access public
21
- env:
22
- NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
23
-