froth-webdriverio-framework 5.0.4 → 5.0.5

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,6 +52,7 @@ let switchToWindowByTitle = null;
52
52
  let switchToWindowByIndex = null;
53
53
 
54
54
  let captureLoadNavigation = null;
55
+ let amendBrowserStackLog = null;
55
56
 
56
57
  if (process.env.LOCATION == null || process.env.LOCATION == 'local') {
57
58
  basepath = ".";
@@ -109,6 +110,8 @@ dismissAlert = require(basepath + '/alert.js').dismissalert;
109
110
 
110
111
  generateJWT = require(basepath + '/jwt').generateJWTToken;
111
112
  captureLoadNavigation= require(basepath + '/captureNavigationTime').captureLoadNavigationTime;
113
+
114
+ amendBrowserStackLog= require(basepath + '../froth_api_calls/browsersatckSessionInfo').amend2Browserstack;
112
115
  //export the variabels
113
116
  module.exports = {
114
117
  scrollToEnd,
@@ -151,5 +154,6 @@ module.exports = {
151
154
  generateJWT,
152
155
  switchToWindowByTitle,
153
156
  switchToWindowByIndex,
154
- captureLoadNavigation
157
+ captureLoadNavigation,
158
+ amendBrowserStackLog
155
159
  };
@@ -6,6 +6,7 @@ const amendToBrowserstack = require("../froth_api_calls/browsersatckSessionInfo"
6
6
  * @param {string} pageName - (Optional) Custom name for the page
7
7
  */
8
8
  async function captureLoadNavigationTime(pageName = '') {
9
+ let pageLoadTime;
9
10
  try {
10
11
  // Try modern API first
11
12
  let perfEntries = await browser.execute(() => {
@@ -15,7 +16,7 @@ async function captureLoadNavigationTime(pageName = '') {
15
16
  }
16
17
  return null;
17
18
  });
18
- let pageLoadTime;
19
+
19
20
 
20
21
  if (perfEntries && perfEntries.loadEventEnd) {
21
22
  pageLoadTime = perfEntries.loadEventEnd;
@@ -35,7 +36,7 @@ async function captureLoadNavigationTime(pageName = '') {
35
36
  .replace(/\s+/g, ' ') // collapse multiple spaces
36
37
  .trim(); // remove leading/trailing spaces
37
38
 
38
- // const pageLoadTime = perfEntries.loadEventEnd; // Already relative to startTime
39
+ pageLoadTime = perfEntries.loadEventEnd; // Already relative to startTime
39
40
  await amendToBrowserstack(`⏱ Page Load Time for ${title}: ${pageLoadTime} ms`, "info");
40
41
 
41
42
  console.log(`⏱ Page Load Time for ${title}: ${pageLoadTime} ms`);
@@ -43,6 +44,7 @@ async function captureLoadNavigationTime(pageName = '') {
43
44
  console.error('Error capturing navigation timing:', error);
44
45
  }
45
46
 
47
+ return pageLoadTime;
46
48
  }
47
49
 
48
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",