froth-webdriverio-framework 7.0.19 → 7.0.21

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.
@@ -52,11 +52,9 @@ async function encryptData(data, secretKey) {
52
52
  }
53
53
 
54
54
 
55
-
56
-
57
55
  async function decrpytData(encryptedData) {
58
56
  try {
59
- if (!encryptedData) return null
57
+ // if (!encryptedData) return null
60
58
 
61
59
  // Base64 → Uint8Array
62
60
  const encryptedBytes = Uint8Array.from(atob(encryptedData), c =>
@@ -72,11 +70,12 @@ async function decrpytData(encryptedData) {
72
70
  const encryptedPayload = new Uint8Array(ciphertext.length + tag.length)
73
71
  encryptedPayload.set(ciphertext)
74
72
  encryptedPayload.set(tag, ciphertext.length)
75
-
73
+ const rawValue = "froth-testops@rd"
74
+ const paddedKey = rawValue.padEnd(32, "_") // MUST be 32 bytes
76
75
  // Import key
77
76
  const key = await crypto.subtle.importKey(
78
77
  "raw",
79
- new TextEncoder().encode(config.encryptKeyValue),
78
+ new TextEncoder().encode(paddedKey),
80
79
  { name: "AES-GCM" },
81
80
  false,
82
81
  ["decrypt"]
@@ -15,6 +15,7 @@ function isValidId(id) {
15
15
  }
16
16
 
17
17
  async function handleResponse(response, context) {
18
+
18
19
  if (response.ok) {
19
20
  return response.json();
20
21
  }
@@ -41,12 +42,20 @@ async function getExecuitonDetails(frothUrl, token, id) {
41
42
  console.log('GET:', url);
42
43
 
43
44
  try {
44
- const response = await fetch(url, {
45
+ let response = await fetch(url, {
45
46
  method: 'GET',
46
47
  headers: DEFAULT_HEADERS(token)
47
48
  });
49
+
50
+
51
+ let data = await handleResponse(response, 'getExecuitonDetails');
52
+ // let responseData = await response.json()
48
53
 
49
- const data = await handleResponse(response, 'getExecuitonDetails');
54
+ data = await aes.decrpytData(data.data)
55
+ console.log("after decrypting",data)
56
+
57
+ data = JSON.parse(data)
58
+ console.log("json parsing",data)
50
59
  if (!data) return null;
51
60
 
52
61
  const jsondata = {
@@ -256,30 +265,32 @@ async function updateScriptExecutionStatus(
256
265
 
257
266
  /* ===================== EXPORTS ===================== */
258
267
 
268
+
269
+
270
+ async function main() {
271
+ try {
272
+ const frothUrl = "https://api.frothtestops.com";
273
+ // const username = "subhra.subudhi@roboticodigital.com";
274
+ // const password = "V2VsY29tZUAxMjM=";
275
+
276
+ // const token = await getLoginToken(frothUrl, username, password);
277
+ // if (!token) {
278
+ // throw new Error('Login failed, no token obtained');
279
+ // }
280
+ const token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzY3MTc4MTk2LCJpYXQiOjE3NjcxNzQ1OTYsImp0aSI6Ijg2MzA3ZjU0YjZhNzRkZDY5ZjY0MTc2YjM5MWUyMTNiIiwidXNlcl9pZCI6MX0.lwp38e7P-toi7k1EaFdgHi5Eu4B-Ps8Y0epN1d5I_Cc'
281
+ const id = 133;
282
+ const data = await getExecuitonDetails(frothUrl, token, id);
283
+ console.log("Retrieved JSON Data:", data);
284
+ } catch (error) {
285
+ console.error('Error in main function:', error);
286
+ }
287
+ }
288
+
289
+ main();
290
+
259
291
  module.exports = {
260
292
  getExecuitonDetails,
261
293
  updateExecuitonDetails,
262
294
  updateScriptExecutionStatus,
263
295
  update_CICDRUNID_ReportUrl
264
- };
265
-
266
- // async function main() {
267
- // try {
268
- // const frothUrl = "devapi.frothtestops.com";
269
- // // const username = "subhra.subudhi@roboticodigital.com";
270
- // // const password = "V2VsY29tZUAxMjM=";
271
-
272
- // // const token = await getLoginToken(frothUrl, username, password);
273
- // // if (!token) {
274
- // // throw new Error('Login failed, no token obtained');
275
- // // }
276
- // const token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzcyNTgyMzk5LCJpYXQiOjE3NjQ3NjU3OTQsImp0aSI6IjRhOWUyNjlkNWZhMzRlYzQ4NjZhZjk5MTc3Y2MwNzZiIiwidXNlcl9pZCI6NH0.1a_KwJvW3LOoBgzWMZBCoyGnA3eNm_XYeiah6Ql_EoA'
277
- // const id = 147;
278
- // const data = await getExecuitonDetails(frothUrl, token, id);
279
- // console.log("Retrieved JSON Data:", data);
280
- // } catch (error) {
281
- // console.error('Error in main function:', error);
282
- // }
283
- // }
284
-
285
- // main();
296
+ };
@@ -151,7 +151,10 @@ const commonHooks = {
151
151
  /** Media upload */
152
152
  if (process.env.MEDIA_FILES) {
153
153
  try {
154
- bsOpts['browserstack.uploadMedia'] = JSON.parse(process.env.MEDIA_FILES);
154
+ const media = JSON.parse(process.env.MEDIA_FILES);
155
+ console.log('Total items:', media.length);
156
+ if (media.length > 0)
157
+ bsOpts['browserstack.uploadMedia'] = JSON.parse(process.env.MEDIA_FILES);
155
158
  } catch {
156
159
  console.warn('⚠️ MEDIA_FILES is not valid JSON');
157
160
  }
@@ -161,7 +164,7 @@ const commonHooks = {
161
164
  }
162
165
  console.log('final cinfig dteials :' + JSON.stringify(capabilities))
163
166
 
164
- // console.log("config details " + JSON.stringify(config))
167
+ // console.log("config details " + JSON.stringify(config))
165
168
 
166
169
 
167
170
  } catch (error) {
@@ -262,7 +265,7 @@ const commonHooks = {
262
265
  const endTime = Date.now();
263
266
  const totalTime = endTime - suiteStartTime; // Full WDIO+CI elapsed time
264
267
  resultdetails.excution_time = await msToTime(totalTime);
265
- console.log("Exit code after session===>"+exitCode)
268
+ console.log("Exit code after session===>" + exitCode)
266
269
  resultdetails.excution_status = exitCode === 0 ? 'PASSED' : 'FAILED';
267
270
 
268
271
  console.log('Comments being sent:', resultdetails.comments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "7.0.19",
3
+ "version": "7.0.21",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",