froth-webdriverio-framework 4.0.72 → 5.0.1

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.
@@ -47,18 +47,18 @@ function generateJWTToken(payload) {
47
47
  //console.log('Signed and encoded JWT', jwt)
48
48
 
49
49
 
50
- function main() {
51
- // JWT Payload
52
- const payload = {
53
- iss: "YTLC_TEST_AUTOMATION_APP",
54
- iat: currentTimestamp, // Issued at
55
- exp: currentTimestamp + 200, // Expiry time: 30 seconds from issuance
56
- user_agent: {
57
- id: "janga.reddy@ytl.com"
58
- }
59
- };
50
+ // function main() {
51
+ // // JWT Payload
52
+ // const payload = {
53
+ // iss: "YTLC_TEST_AUTOMATION_APP",
54
+ // iat: currentTimestamp, // Issued at
55
+ // exp: currentTimestamp + 200, // Expiry time: 30 seconds from issuance
56
+ // user_agent: {
57
+ // id: "janga.reddy@ytl.com"
58
+ // }
59
+ // };
60
60
 
61
- console.log('JWT signed token:', generateJWTToken(payload));
62
- }
63
- main()
61
+ // console.log('JWT signed token:', generateJWTToken(payload));
62
+ // }
63
+ //main()
64
64
  module.exports = { generateJWTToken}
@@ -203,20 +203,20 @@ async function RANDOM(template, datatype) {
203
203
  }
204
204
 
205
205
  // Example function to test the template replacement
206
- async function main() {
206
+ // async function main() {
207
207
 
208
- let template = "SUBHRASUBUDHI {CTMSTMP} @GMAQIL.COM";
209
- let result = await RANDOM(template, 'STRING');
210
- console.log(result);
211
- console.log(typeof result);
212
- // template = "{RANDOMREGEX[\\\\d{5}(-\\\\\d{4})?][10]}";
213
- // result = await RANDOM(template, 'STRING');
214
- // console.log(result);
215
- // console.log(typeof result);
208
+ // let template = "SUBHRASUBUDHI {CTMSTMP} @GMAQIL.COM";
209
+ // let result = await RANDOM(template, 'STRING');
210
+ // console.log(result);
211
+ // console.log(typeof result);
212
+ // // template = "{RANDOMREGEX[\\\\d{5}(-\\\\\d{4})?][10]}";
213
+ // // result = await RANDOM(template, 'STRING');
214
+ // // console.log(result);
215
+ // // console.log(typeof result);
216
216
 
217
- }
217
+ // }
218
218
 
219
- main();
219
+ //main();
220
220
  module.exports = {
221
221
  RNDNUMBER,
222
222
  RNDFLOAT,
@@ -249,6 +249,7 @@ const commonconfig = {
249
249
  console.log("====> Total Duration taken for the suite:" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
250
250
  console.log("====> Execution Status from results" + resultdetails.excution_status);
251
251
  // Capture WebDriver session errors
252
+
252
253
  if (result !== 0) {
253
254
  if (resultdetails.comments.length === 0) {
254
255
  resultdetails.comments.push("❌ WebDriver session failed or timed out.");
@@ -264,6 +265,18 @@ const commonconfig = {
264
265
 
265
266
  },
266
267
 
268
+ onError: async function (error) {
269
+ console.error('==== ON ERROR HOOK ====');
270
+ console.error('====> Error occurred:', error.message);
271
+ if (error.message.includes('Automate testing time expired')) {
272
+ console.log('❌ Global error: Session timed out on BrowserStack.');
273
+ resultdetails.excution_status = 'FAILED';
274
+ resultdetails.comments.push(`Global error: Session timed out on BrowserStack.Please check ths session: ${result}`);
275
+
276
+ await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
277
+ process.exit(1); // Stop execution if session timed out
278
+ }
279
+ },
267
280
  afterSession: async function (config, capabilities, specs) {
268
281
  console.log('==== AFTER SESSION HOOK ====');
269
282
  console.log('====> This is the aftersession hook');
@@ -323,8 +336,6 @@ const commonconfig = {
323
336
  console.log('Total Tests:', results.total);
324
337
  console.log('Passed:', results.passed);
325
338
  console.log('Failed:', results.failed);
326
- console.log('Skipped:', results.skipped);
327
- console.log('Execution Time:', results.duration);
328
339
  console.log('Exit Code:', exitCode);
329
340
 
330
341
  console.log('==== ALL TESTS ARE COMPLETED ====');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "4.0.72",
3
+ "version": "5.0.1",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",