froth-webdriverio-framework 1.0.49 → 1.0.50

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,18 +8,9 @@ async function getBSSessionDetails(sessiontype,bs_username,bs_pwd) {
8
8
 
9
9
 
10
10
  try {
11
- const sessionId = browser.sessionId;
12
- console.log(`Session ID: ${sessionId}`);
13
-
14
- // const sessionInfo = await browser.execute(() => {
15
- // return window._browserstack_executor({
16
- // action: 'getSessionDetails'
17
- // });
18
- // });
19
-
20
- // console.log('BrowserStack session info:', sessionInfo);
11
+ const sessionid= BUFFER.getItem("SESSION_ID");
21
12
 
22
- const url = `https://api.browserstack.com/${sessiontype}/sessions/${sessionId}.json`;
13
+ const url = `https://api.browserstack.com/${sessiontype}/sessions/${sessionid}.json`;
23
14
 
24
15
  const response = await fetch(url, {
25
16
  method: 'GET',
@@ -12,7 +12,6 @@ const commonconfig = {
12
12
  onPrepare: async function (capabilities, specs) {
13
13
  // This code runs before the test suite starts
14
14
  // console.log("organisation url" + process.env.ORGANISATION_DOMAIN_URL);
15
- BUFFER.clear();
16
15
  await setAllDetails.setEnvVariables();
17
16
  await setAllDetails.setLoginToken();
18
17
  await setAllDetails.setExecutionDetails();
@@ -30,6 +29,9 @@ const commonconfig = {
30
29
  beforeSuite: async function (suite) {
31
30
  try {
32
31
  console.log("Running suite:", suite.title);
32
+ const sessionId = browser.sessionId;
33
+ BUFFER.setItem("SESSION_ID", sessionId)
34
+ console.log('Session ID: ' + BUFFER.getItem("SESSION_ID"));
33
35
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
34
36
  console.log("ALL JSON DATA IN BUFFER:" + JSON.stringify(BUFFER));
35
37
  const resultdetails = {};
@@ -93,20 +95,28 @@ const commonconfig = {
93
95
  * @param {Array.<Object>} capabilities list of capabilities details
94
96
  * @param {Array.<String>} specs List of spec file paths that ran
95
97
  */
96
- after: async function (result, capabilities, specs) {
98
+ after: function (result, capabilities, specs) {
97
99
  console.log('All tests are done.');
98
100
  //const resultdata = result === 0 ? 'Pass' : 'Fail';
99
101
  //console.log(`Result: ${resultdata}`);
102
+ // const resultdata = result === 0 ? 'PASSED' : 'FAILED'
103
+ BUFFER.setItem("RESULT_DATA", result);
100
104
 
101
- const resultdetails = {}
105
+
106
+ console.log('Local storage has been cleared.');
107
+
108
+ },
109
+ aftersession: async function (config, capabilities, specs) {
110
+
111
+ console.log('This is the aftersession hook');
102
112
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
103
- resultdetails.excution_status = result === 0 ? 'PASSED' : 'FAILED'
113
+ const resultdetails = {}
114
+ resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") === 0 ? 'PASSED' : 'FAILED'
104
115
  console.log("Total Duration:" + BUFFER.getItem("TOTAL_DURATION"));
105
116
  resultdetails.excution_time = convertMillisecondsToTime(BUFFER.getItem("TOTAL_DURATION"))
106
117
  exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("LOGIN_TOKEN"), BUFFER.getItem("EXECUTION_ID"), resultdetails)
107
118
  BUFFER.clear();
108
- console.log('Local storage has been cleared.');
109
-
119
+ // Perform any cleanup or post-test actions here
110
120
  },
111
121
 
112
122
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",