froth-webdriverio-framework 7.0.7 → 7.0.9

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.
@@ -93,40 +93,45 @@ async function amend2Browserstack(annotationMessage, level) {
93
93
  try {
94
94
  const MAX_CHUNK_SIZE = 800 * 1024; // 800 KB
95
95
 
96
+ // 1️⃣ Convert to string
96
97
  let messageStr =
97
98
  typeof annotationMessage === "string"
98
99
  ? annotationMessage
99
100
  : JSON.stringify(annotationMessage, null, 2);
100
-
101
- // Escape quotes and newlines for BrowserStack executor
102
- messageStr = messageStr
101
+ console.log("mesage is full: "+messageStr)
102
+ // 2️⃣ Escape for BrowserStack executor (IMPORTANT)
103
+ let escapedMessage = messageStr
103
104
  .replace(/\\/g, "\\\\")
104
105
  .replace(/"/g, '\\"')
105
106
  .replace(/\n/g, "\\n")
106
107
  .replace(/\r/g, "\\r");
107
108
 
109
+ // 3️⃣ Split into chunks
108
110
  const chunks = [];
109
- for (let i = 0; i < messageStr.length; i += MAX_CHUNK_SIZE) {
110
- chunks.push(messageStr.slice(i, i + MAX_CHUNK_SIZE));
111
+ for (let i = 0; i < escapedMessage.length; i += MAX_CHUNK_SIZE) {
112
+ chunks.push(escapedMessage.slice(i, i + MAX_CHUNK_SIZE));
111
113
  }
114
+
112
115
  console.log(
113
- `BrowserStack Annotation → total size: ${escapedMessage.length} chars, chunks: ${chunks.length}`
116
+ `BrowserStack Annotation → total chars: ${escapedMessage.length}, chunks: ${chunks.length}`
114
117
  );
115
118
 
119
+ // 4️⃣ Print + send chunks
116
120
  for (let i = 0; i < chunks.length; i++) {
117
121
  const chunkMessage =
118
122
  chunks.length > 1
119
- ? `PART ${i + 1}/${chunks.length}: ${chunks[i]}`
123
+ ? `PART ${i + 1}/${chunks.length}\n${chunks[i]}`
120
124
  : chunks[i];
121
125
 
122
- // 🔍 PRINT CHUNK LOCALLY
126
+ // 🔍 LOCAL LOG
123
127
  console.log("=======================================");
124
128
  console.log(`BrowserStack Chunk ${i + 1}/${chunks.length}`);
125
129
  console.log(chunkMessage);
126
130
  console.log("=======================================");
127
131
 
132
+ // 🚀 SEND TO BROWSERSTACK (WDIO-safe)
128
133
  if (process.env.PLATFORM === "browserstack") {
129
- await driver.executeScript(
134
+ await driver.execute(
130
135
  `browserstack_executor: {"action":"annotate","arguments":{"data":"${chunkMessage}","level":"${level}"}}`
131
136
  );
132
137
  }
@@ -137,6 +142,7 @@ async function amend2Browserstack(annotationMessage, level) {
137
142
  }
138
143
  }
139
144
 
145
+
140
146
  // async function amend2Browserstack(annotationMessage, level) {
141
147
  // try {
142
148
  // const MAX_CHUNK_SIZE = 800 * 1024; // 800 KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "7.0.7",
3
+ "version": "7.0.9",
4
4
  "readme": "WendriverIO Integration with [BrowserStack](https://www.browserstack.com)",
5
5
  "description": "Selenium examples for WebdriverIO and BrowserStack App Automate",
6
6
  "scripts": {