froth-webdriverio-framework 6.0.75 → 6.0.77

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.
@@ -25,7 +25,7 @@ async function getBSBuildDetails(sessionType, bsUsername, bsPassword) {
25
25
 
26
26
  return data[0].automation_build.hashed_id;
27
27
  } else if (response.status === 401) {
28
- console.error("Unauthorized: token expired");
28
+ console.error("Unauthorized: token expired to login Browserstack for getting session info");
29
29
  } else {
30
30
  const errorText = await response.text();
31
31
  console.error(`Failed to fetch build details: ${response.status}, ${errorText}`);
@@ -66,7 +66,7 @@ async function getBSSessionDetails(sessionType, bsUsername, bsPassword) {
66
66
 
67
67
  console.log(`Public URL: ${publicUrl}`);
68
68
  } else if (response.status === 401) {
69
- console.error("Unauthorized: token expired");
69
+ console.error("Unauthorized: token expired to login Browserstack");
70
70
  } else {
71
71
  const errorText = await response.text();
72
72
  console.error(`Failed to fetch session details: ${response.status}, ${errorText}`);
@@ -149,10 +149,29 @@ async function updateExecuitonDetails(frothUrl, token, id, resultdetails) {
149
149
  headers: { 'Authorization': `Bearer ${token}` },
150
150
  body: formData
151
151
  });
152
+ // Log raw response info
153
+ console.log('📤 API Response Status:', response.status);
154
+ console.log('📤 API Response Headers:', JSON.stringify([...response.headers]));
155
+ let responseText;
156
+ try {
157
+ responseText = await response.text();
158
+ console.log('📤 API Response Body (text):', responseText);
159
+ } catch (err) {
160
+ console.error('❌ Error reading response body:', err.message);
161
+ }
162
+
163
+ // Then handle response as JSON if needed
164
+ let data;
165
+ try {
166
+ data = JSON.parse(responseText);
167
+ } catch {
168
+ data = null;
169
+ }
152
170
 
171
+ console.log('📤 Parsed Response:', data);
153
172
 
154
- const data = await handleResponse(response, 'updateExecuitonDetails');
155
- if (!data) return;
173
+ const result = await handleResponse(response, 'updateExecuitonDetails');
174
+ if (!result) return;
156
175
 
157
176
  BUFFER.setItem('FROTH_UPDATE_EXECUTION', 'TRUE');
158
177
  console.log('✅ Execution details updated');
@@ -31,7 +31,7 @@ module.exports = (bsCaps) => {
31
31
  'bstack:options': {
32
32
  os: bsCaps.os,
33
33
  osVersion: bsCaps.osVersion,
34
- // buildName: 'Web_Build-',
34
+ buildName: 'Web_Build-',
35
35
  debug: bsCaps.debug,
36
36
  networkLogs: bsCaps.networkLogs,
37
37
  interactiveDebugging: bsCaps.interactiveDebugging,
@@ -86,7 +86,8 @@ async function failExecution(reason) {
86
86
  const commonHooks = {
87
87
 
88
88
  /* ========== ON PREPARE ========== */
89
- onPrepare: async () => {
89
+ onPrepare: async (config) => {
90
+
90
91
  suiteStartTime = Date.now();
91
92
  registerGlobalErrorHandlers();
92
93
 
@@ -127,6 +128,10 @@ const commonHooks = {
127
128
 
128
129
  if (process.env.PLATFORM === 'browserstack' || process.env.PLATFORM === 'browserstacklocal') {
129
130
  const bsOpts = capabilities['bstack:options'] || {};
131
+ process.env.BROWSERSTACK_USERNAME = bsOpts.userName
132
+ process.env.BROWSERSTACK_ACCESS_KEY = bsOpts.accessKey
133
+ console.log('✅ BS_USERNAME set from capabilities:', process.env.BROWSERSTACK_USERNAME);
134
+
130
135
  if (process.env.BS_SESSION_TYPE === 'app-automate') {
131
136
  const appPath = process.env.BROWSERSTACK_APP_PATH;
132
137
  if (!appPath) {
@@ -194,7 +199,8 @@ const commonHooks = {
194
199
 
195
200
  if (!passed) {
196
201
  resultdetails.comments.push(`${test.title} - ${error?.message || 'Failed'}`);
197
- }
202
+ } else
203
+ resultdetails.comments.push(`${test.title} - 'Passed'}`);
198
204
 
199
205
  const suiteDetails = JSON.parse(BUFFER.getItem('FROTHE_SUITE_DETAILS'));
200
206
  const script = suiteDetails.find(s => s.scriptName === fileName.replace('.js', ''));
@@ -223,21 +229,7 @@ const commonHooks = {
223
229
  console.log('==== AFTER SESSION ====');
224
230
  // Do not calculate time here; we will use WDIO's total duration in onComplete
225
231
  console.log('⏱ Leaving execution time calculation for onComplete hook');
226
- // const endTime = Date.now();
227
- // if (!suiteStartTime) suiteStartTime = endTime;
228
-
229
- // const totalTime = Math.max(endTime - suiteStartTime, totalTestDuration);
230
- // // resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
231
- // resultdetails.excution_time = msToTime(totalTime);
232
232
 
233
- // console.log('⏱ Final execution time:', resultdetails.excution_time);
234
-
235
- // console.log('📤 Updating DB with final execution details');
236
- // console.log('Status:', resultdetails.excution_status);
237
- // console.log('Duration:', resultdetails.excution_time);
238
-
239
- // await safeUpdateExecution();
240
- // BUFFER.clear();
241
233
  },
242
234
 
243
235
  /* ========== ON ERROR ========== */
@@ -261,7 +253,6 @@ const commonHooks = {
261
253
  },
262
254
  /* ========== ON COMPLETE ========== */
263
255
  onComplete: async (exitCode, _, __, results) => {
264
- console.log('==== ON COMPLETE ====');
265
256
  console.log('==== ON COMPLETE ====');
266
257
  console.log(`Total: ${results.total || 0}, Passed: ${results.passed || 0}, Failed: ${results.failed || 0}`);
267
258
 
@@ -18,6 +18,7 @@ try {
18
18
  }
19
19
  const ymlPath = path.resolve(process.cwd(), configFile);
20
20
  bsCaps = yaml.load(fs.readFileSync(ymlPath, 'utf8'));
21
+
21
22
  // Merge chrome-specific options if applicable
22
23
 
23
24
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "6.0.75",
3
+ "version": "6.0.77",
4
4
  "readme": "WendriverIO Integration with [BrowserStack](https://www.browserstack.com)",
5
5
  "description": "Selenium examples for WebdriverIO and BrowserStack App Automate",
6
6
  "scripts": {