froth-webdriverio-framework 3.0.23 → 3.0.25

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.
@@ -8,9 +8,7 @@ const { fail } = require("assert");
8
8
  const isBrowserStackEnabled = process.env.BROWSERSTACK;
9
9
  let starttime;
10
10
  let endtime;
11
- let passedTests = 0;
12
- let failedTests = 0;
13
- let totalTests = 0;
11
+
14
12
  // Description: This file contains the common configuration for the webdriverio framework.
15
13
  const commonconfig = {
16
14
 
@@ -34,10 +32,13 @@ const commonconfig = {
34
32
  */
35
33
  beforeSuite: async function (suite) {
36
34
  try {
37
- console.log("Running suite:", suite.title);
35
+ console.log(`========= Test suite: ' ${suite.title}' has been started=========`,);
36
+ const specCount = suite.specs.total
37
+
38
+ console.log(`========= Number of specs in the suite: ${specCount}`);
39
+
38
40
  starttime = new Date().getTime();
39
- // const sessionId = browser.sessionId;
40
- // BUFFER.setItem("SESSION_ID", sessionId)
41
+
41
42
  if (isBrowserStackEnabled === true) {
42
43
  console.log("BrowserStack is enabled");
43
44
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
@@ -56,17 +57,12 @@ const commonconfig = {
56
57
  * @param {object} context scope object the test was executed with
57
58
  */
58
59
  beforeTest: function (test, context) {
59
- console.log("Test Name:", test.title);
60
- totalTests++;
60
+ console.log(`========= Test '${test.title}' Started ========= `);
61
+
61
62
  // console.log("File Name:", test.file);
62
63
 
63
64
  },
64
65
 
65
- afterStep: function (test, context, { error, result, duration, passed, retries }) {
66
- // if (passed) {
67
- // browser.takeScreenshot();
68
- // }
69
- },
70
66
 
71
67
  /**
72
68
  * Function to be executed after a test (in Mocha/Jasmine only)
@@ -79,28 +75,25 @@ const commonconfig = {
79
75
  * @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
80
76
  */
81
77
  afterTest: async function (test, context, { error, result, duration, passed, retries }) {
82
- console.log(`Test '${test.title}' finished.`);
78
+ console.log(`========= Test name '${test.title}' finished.========`);
83
79
 
84
80
  const fileName = path.basename(test.file);
85
- console.log('Test File Name:', fileName);
81
+ console.log('========= Test File Name:', fileName);
86
82
  // BUFFER.setItem("FROTH_TOTAL_DURATION", Number(BUFFER.getItem("FROTH_TOTAL_DURATION")) + duration)
87
- console.log(`Duration: ${duration}ms`);
88
- console.log(`Passed: ${passed}`);
83
+ console.log(`========= Total Duration for this test: ${duration}ms`);
84
+ console.log(`========= Status of test: ${passed}`);
89
85
  let scriptresult = "NOT RUN";
90
86
 
91
87
  if (passed) {
92
88
  scriptresult = "PASSED"
93
- passedTests++;
94
89
  }
95
90
  else {
96
91
  scriptresult = "FAILED"
97
- failedTests++;
98
92
  }
99
93
  if (error) {
100
- console.error(`Error: ${error.message}`);
94
+ console.error(`========= Error occured while executing the test: ${error.message}`);
101
95
  // scriptresult = "FAILED"
102
96
  }
103
- console.log('---------------------------------------');
104
97
  let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
105
98
  await exeDetails.updateScriptExecutionStatus(
106
99
  BUFFER.getItem("ORGANISATION_DOMAIN_URL"),
@@ -114,7 +107,7 @@ const commonconfig = {
114
107
  * @param {object} suite suite details
115
108
  */
116
109
  afterSuite: function (suite) {
117
- console.log(`Test suite '${suite.title}' has ended.`);
110
+ console.log(`========= Test suite '${suite.title}' has completed.`);
118
111
  },
119
112
  /**
120
113
  * Gets executed after all tests are done. You still have access to all global variables from
@@ -124,32 +117,36 @@ const commonconfig = {
124
117
  * @param {Array.<String>} specs List of spec file paths that ran
125
118
  */
126
119
  after: async function (result, config, capabilities, specs) {
127
- console.log('All tests are done.' + result);
128
- console.log("specs ran :" + specs);
120
+ console.log('========= All tests are completed.' + result);
121
+
129
122
  BUFFER.setItem("RESULT_DATA", result);
130
- console.log("result data :" + BUFFER.getItem("RESULT_DATA"))
123
+ console.log("========= Result data :" + BUFFER.getItem("RESULT_DATA"))
124
+
131
125
  const resultdetails = {}
132
126
  resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
133
- console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
134
- console.log("Results" + resultdetails.excution_status);
127
+ console.log("========= Total Duration taken for the suite:" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
128
+ console.log("========= Execution Status from results" + resultdetails.excution_status);
129
+
135
130
  resultdetails.excution_time = await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
136
131
  await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
137
132
 
138
133
  },
139
134
 
140
135
  afterSession: async function (config, capabilities, specs) {
141
- console.log('This is the aftersession hook');
136
+ console.log('========= This is the aftersession hook');
142
137
  // Perform any cleanup or post-test actions here
143
138
 
144
139
  endtime = new Date().getTime();
145
140
  let totalDuration = endtime - starttime;
146
- console.log("Total Duration:" + totalDuration);
141
+ console.log("========= Total Duration in after session based on start time and end time:" + totalDuration);
142
+
147
143
  if (isBrowserStackEnabled)
148
144
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
149
145
 
150
146
  const resultdetails = {}
151
147
  resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
152
- console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION")));
148
+ console.log("========= Total Duration calculation:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION")));
149
+
153
150
  resultdetails.excution_time = BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
154
151
  await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
155
152
  BUFFER.clear();
@@ -157,14 +154,20 @@ const commonconfig = {
157
154
  },
158
155
 
159
156
  onComplete: async function (exitCode, config, capabilities, results) {
160
- console.log('This is the onComplete hook', results);
161
-
157
+ console.log('========= This is the onComplete hook', results);
162
158
  console.log('--- Test Results Summary ---');
163
- console.log(`Total Spec Files: ${totalTests}`);
164
- console.log(`Passed: ${passedTests}`);
165
- console.log(`Failed: ${failedTests}`);
166
- console.log(`Total Time: ${Math.round(finished / 1000)} seconds`);
167
159
  console.log('----------------------------');
160
+ console.log('Total Tests:', results.total);
161
+ console.log('Passed:', results.passed);
162
+ console.log('Failed:', results.failed);
163
+ console.log('Skipped:', results.skipped);
164
+ console.log('----------------------------');
165
+ console.log('Execution Time:', results.duration);
166
+ console.log('----------------------------');
167
+ console.log('Exit Code:', exitCode);
168
+ console.log('----------------------------');
169
+ console.log('========= All tests are done, exiting the browser session.');
170
+
168
171
  }
169
172
 
170
173
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "3.0.23",
3
+ "version": "3.0.25",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",