froth-webdriverio-framework 2.0.43 → 2.0.45

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.
@@ -1,55 +1,44 @@
1
1
  const deepmerge = require('deepmerge')
2
2
  const commonconfig = require('./commonconfig');
3
3
  const isBrowserStackEnabled = process.env.BROWSERSTACK;
4
-
5
- const commonmobconfig = deepmerge.all([commonconfig, {
6
-
7
-
8
- // user: process.env.BROWSERSTACK_USERNAME,
9
- // key: Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'),
10
- ...(isBrowserStackEnabled && {
11
- user: process.env.BROWSERSTACK_USERNAME,
12
- key: Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'),
13
- commonCapabilities: {
14
- 'bstack:options': {
15
- projectName: process.env.PROJECTNAME || "roboticodigital",
16
- sessionName: 'Automation test session',
17
- debug: true,
18
- networkLogs: true
19
- }
4
+ console.log("isBrowserStackEnabled", isBrowserStackEnabled);
5
+
6
+ const browserStackConfig = isBrowserStackEnabled === true ? {
7
+ user: process.env.BROWSERSTACK_USERNAME,
8
+ key: Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'),
9
+ commonCapabilities: {
10
+ 'bstack:options': {
11
+ projectName: process.env.PROJECTNAME || "roboticodigital",
12
+ sessionName: 'Automation test session',
13
+ debug: true,
14
+ networkLogs: true
20
15
  }
21
- }),
22
- logLevel: 'info',
23
- coloredLogs: true,
24
- screenshotPath: './errorShots/',
25
- baseUrl: '',
26
- waitforTimeout: 90000,
27
- connectionRetryTimeout: 90000,
28
- connectionRetryCount: 2,
29
-
30
- framework: 'mocha',
31
- mochaOpts: {
32
- ui: 'bdd',
33
- timeout: 90000
16
+ }
17
+ } : {};
18
+
19
+ const commonmobconfig = deepmerge.all([
20
+ commonconfig,
21
+ {
22
+ logLevel: 'info',
23
+ coloredLogs: true,
24
+ screenshotPath: './errorShots/',
25
+ baseUrl: '',
26
+ waitforTimeout: 90000,
27
+ connectionRetryTimeout: 90000,
28
+ connectionRetryCount: 2,
29
+
30
+ framework: 'mocha',
31
+ mochaOpts: {
32
+ ui: 'bdd',
33
+ timeout: 90000
34
+ },
35
+
36
+ maxInstances: 10,
37
+
38
+ updateJob: false,
39
+ reporters: ['spec'],
34
40
  },
35
-
36
- maxInstances: 10,
37
-
38
- updateJob: false,
39
- reporters: [
40
- 'spec'
41
- ],
42
- // commonCapabilities: {
43
- // 'bstack:options': {
44
- // projectName: process.env.PROJECTNAME || "roboticodigital",
45
- // // buildName: "Automation Build",
46
- // sessionName: 'Automation test session',
47
- // debug: true,
48
- // networkLogs: true
49
- // }
50
- // },
51
-
52
-
53
- }]);
41
+ browserStackConfig // Add BrowserStack config conditionally
42
+ ]);
54
43
 
55
44
  module.exports = commonmobconfig;
@@ -5,7 +5,8 @@ const path = require('path');
5
5
  const exeDetails = require("../api/getexecutionDetails")
6
6
  const getBSSessionDetails = require("../api/browsersatckSessionInfo")
7
7
  const isBrowserStackEnabled = process.env.BROWSERSTACK;
8
-
8
+ let starttime;
9
+ let endtime;
9
10
 
10
11
  // Description: This file contains the common configuration for the webdriverio framework.
11
12
  const commonconfig = {
@@ -32,6 +33,7 @@ const commonconfig = {
32
33
  beforeSuite: async function (suite) {
33
34
  try {
34
35
  console.log("Running suite:", suite.title);
36
+ starttime = new Date().getTime();
35
37
  // const sessionId = browser.sessionId;
36
38
  // BUFFER.setItem("SESSION_ID", sessionId)
37
39
  if (isBrowserStackEnabled) {
@@ -124,16 +126,19 @@ const commonconfig = {
124
126
  },
125
127
 
126
128
  afterSession: async function (config, capabilities, specs) {
127
-
128
129
  console.log('This is the aftersession hook');
129
- // await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'));
130
+ // Perform any cleanup or post-test actions here
131
+
132
+ endtime = new Date().getTime();
133
+ let totalDuration = endtime - starttime;
134
+ console.log("Total Duration:" + totalDuration);
130
135
  if (isBrowserStackEnabled)
131
136
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
132
-
137
+
133
138
  const resultdetails = {}
134
139
  resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
135
- console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
136
- resultdetails.excution_time = await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
140
+ console.log("Total Duration:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? totalDuration:BUFFER.getItem("FROTH_TOTAL_DURATION"));
141
+ resultdetails.excution_time = await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION")=== 0 ? totalDuration:BUFFER.getItem("FROTH_TOTAL_DURATION"))
137
142
  await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
138
143
  BUFFER.clear();
139
144
  // Perform any cleanup or post-test actions here
@@ -150,7 +155,7 @@ async function secondsToTime(secs) {
150
155
  if (hours < 10) hours = '0' + hours;
151
156
  if (minutes < 10) minutes = '0' + minutes;
152
157
  if (seconds < 10) seconds = '0' + seconds;
153
-
158
+ console.log("Time:" + hours + ':' + minutes + ':' + seconds);
154
159
  return hours + ':' + minutes + ':' + seconds;
155
160
  }
156
161
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "2.0.43",
3
+ "version": "2.0.45",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",