@wdio/browserstack-service 9.4.1 → 9.4.2
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.
- package/build/index.js +282 -256
- package/build/launcher.d.ts.map +1 -1
- package/package.json +7 -7
package/build/index.js
CHANGED
|
@@ -15,70 +15,10 @@ import os5 from "node:os";
|
|
|
15
15
|
import { SevereServiceError } from "webdriverio";
|
|
16
16
|
import * as BrowserstackLocalLauncher from "browserstack-local";
|
|
17
17
|
|
|
18
|
-
// src/performance-tester.ts
|
|
19
|
-
import { createObjectCsvWriter } from "csv-writer";
|
|
20
|
-
import fs4 from "node:fs";
|
|
21
|
-
import { performance, PerformanceObserver } from "node:perf_hooks";
|
|
22
|
-
|
|
23
|
-
// src/util.ts
|
|
24
|
-
import { hostname, platform, type, version, arch } from "node:os";
|
|
25
|
-
import fs3 from "node:fs";
|
|
26
|
-
import zlib from "node:zlib";
|
|
27
|
-
import { format, promisify } from "node:util";
|
|
28
|
-
import path3 from "node:path";
|
|
29
|
-
import util from "node:util";
|
|
30
|
-
import gitRepoInfo from "git-repo-info";
|
|
31
|
-
import gitconfig from "gitconfiglocal";
|
|
32
|
-
import { FormData as FormData2 } from "formdata-node";
|
|
33
|
-
|
|
34
|
-
// src/logPatcher.ts
|
|
35
|
-
import Transport from "winston-transport";
|
|
36
|
-
var LOG_LEVELS = {
|
|
37
|
-
INFO: "INFO",
|
|
38
|
-
ERROR: "ERROR",
|
|
39
|
-
DEBUG: "DEBUG",
|
|
40
|
-
TRACE: "TRACE",
|
|
41
|
-
WARN: "WARN"
|
|
42
|
-
};
|
|
43
|
-
var logPatcher = class extends Transport {
|
|
44
|
-
constructor(opts) {
|
|
45
|
-
super(opts);
|
|
46
|
-
}
|
|
47
|
-
logToTestOps = (level = LOG_LEVELS.INFO, message = [""]) => {
|
|
48
|
-
process.emit(`bs:addLog:${process.pid}`, {
|
|
49
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
50
|
-
level: level.toUpperCase(),
|
|
51
|
-
message: `"${message.join(", ")}"`,
|
|
52
|
-
kind: "TEST_LOG",
|
|
53
|
-
http_response: {}
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
/* Patching this would show user an extended trace on their cli */
|
|
57
|
-
trace = (...message) => {
|
|
58
|
-
this.logToTestOps(LOG_LEVELS.TRACE, message);
|
|
59
|
-
};
|
|
60
|
-
debug = (...message) => {
|
|
61
|
-
this.logToTestOps(LOG_LEVELS.DEBUG, message);
|
|
62
|
-
};
|
|
63
|
-
info = (...message) => {
|
|
64
|
-
this.logToTestOps(LOG_LEVELS.INFO, message);
|
|
65
|
-
};
|
|
66
|
-
warn = (...message) => {
|
|
67
|
-
this.logToTestOps(LOG_LEVELS.WARN, message);
|
|
68
|
-
};
|
|
69
|
-
error = (...message) => {
|
|
70
|
-
this.logToTestOps(LOG_LEVELS.ERROR, message);
|
|
71
|
-
};
|
|
72
|
-
log = (...message) => {
|
|
73
|
-
this.logToTestOps(LOG_LEVELS.INFO, message);
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
var logPatcher_default = logPatcher;
|
|
77
|
-
|
|
78
18
|
// package.json
|
|
79
19
|
var package_default = {
|
|
80
20
|
name: "@wdio/browserstack-service",
|
|
81
|
-
version: "9.4.
|
|
21
|
+
version: "9.4.1",
|
|
82
22
|
description: "WebdriverIO service for better Browserstack integration",
|
|
83
23
|
author: "Adam Bjerstedt <abjerstedt@gmail.com>",
|
|
84
24
|
homepage: "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browserstack-service",
|
|
@@ -110,7 +50,7 @@ var package_default = {
|
|
|
110
50
|
},
|
|
111
51
|
typeScriptVersion: "3.8.3",
|
|
112
52
|
dependencies: {
|
|
113
|
-
"@browserstack/ai-sdk-node": "1.5.
|
|
53
|
+
"@browserstack/ai-sdk-node": "1.5.17",
|
|
114
54
|
"@percy/appium-app": "^2.0.1",
|
|
115
55
|
"@percy/selenium-webdriver": "^2.0.3",
|
|
116
56
|
"@types/gitconfiglocal": "^2.0.1",
|
|
@@ -218,127 +158,155 @@ var MAX_GIT_META_DATA_SIZE_IN_BYTES = 64 * 1024;
|
|
|
218
158
|
var GIT_META_DATA_TRUNCATED = "...[TRUNCATED]";
|
|
219
159
|
|
|
220
160
|
// src/bstackLogger.ts
|
|
221
|
-
import
|
|
222
|
-
import
|
|
161
|
+
import path3 from "node:path";
|
|
162
|
+
import fs4 from "node:fs";
|
|
223
163
|
import chalk from "chalk";
|
|
224
164
|
import logger from "@wdio/logger";
|
|
225
|
-
var log = logger("@wdio/browserstack-service");
|
|
226
|
-
var BStackLogger = class {
|
|
227
|
-
static logFilePath = path.join(process.cwd(), LOGS_FILE);
|
|
228
|
-
static logFolderPath = path.join(process.cwd(), "logs");
|
|
229
|
-
static logFileStream;
|
|
230
|
-
static logToFile(logMessage, logLevel) {
|
|
231
|
-
try {
|
|
232
|
-
if (!this.logFileStream) {
|
|
233
|
-
this.ensureLogsFolder();
|
|
234
|
-
this.logFileStream = fs.createWriteStream(this.logFilePath, { flags: "a" });
|
|
235
|
-
}
|
|
236
|
-
if (this.logFileStream && this.logFileStream.writable) {
|
|
237
|
-
this.logFileStream.write(this.formatLog(logMessage, logLevel));
|
|
238
|
-
}
|
|
239
|
-
} catch (error) {
|
|
240
|
-
log.debug(`Failed to log to file. Error ${error}`);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
static formatLog(logMessage, level) {
|
|
244
|
-
return `${chalk.gray((/* @__PURE__ */ new Date()).toISOString())} ${chalk[COLORS[level]](level.toUpperCase())} ${chalk.whiteBright("@wdio/browserstack-service")} ${logMessage}
|
|
245
|
-
`;
|
|
246
|
-
}
|
|
247
|
-
static info(message) {
|
|
248
|
-
this.logToFile(message, "info");
|
|
249
|
-
log.info(message);
|
|
250
|
-
}
|
|
251
|
-
static error(message) {
|
|
252
|
-
this.logToFile(message, "error");
|
|
253
|
-
log.error(message);
|
|
254
|
-
}
|
|
255
|
-
static debug(message, param) {
|
|
256
|
-
this.logToFile(message, "debug");
|
|
257
|
-
if (param) {
|
|
258
|
-
log.debug(message, param);
|
|
259
|
-
} else {
|
|
260
|
-
log.debug(message);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
static warn(message) {
|
|
264
|
-
this.logToFile(message, "warn");
|
|
265
|
-
log.warn(message);
|
|
266
|
-
}
|
|
267
|
-
static trace(message) {
|
|
268
|
-
this.logToFile(message, "trace");
|
|
269
|
-
log.trace(message);
|
|
270
|
-
}
|
|
271
|
-
static clearLogger() {
|
|
272
|
-
if (this.logFileStream) {
|
|
273
|
-
this.logFileStream.end();
|
|
274
|
-
}
|
|
275
|
-
this.logFileStream = null;
|
|
276
|
-
}
|
|
277
|
-
static clearLogFile() {
|
|
278
|
-
if (fs.existsSync(this.logFilePath)) {
|
|
279
|
-
fs.truncateSync(this.logFilePath);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
static ensureLogsFolder() {
|
|
283
|
-
if (!fs.existsSync(this.logFolderPath)) {
|
|
284
|
-
fs.mkdirSync(this.logFolderPath);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
165
|
|
|
289
|
-
// src/
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
166
|
+
// src/util.ts
|
|
167
|
+
import { hostname, platform, type, version, arch } from "node:os";
|
|
168
|
+
import fs3 from "node:fs";
|
|
169
|
+
import zlib from "node:zlib";
|
|
170
|
+
import { format, promisify } from "node:util";
|
|
171
|
+
import path2 from "node:path";
|
|
172
|
+
import util from "node:util";
|
|
173
|
+
import gitRepoInfo from "git-repo-info";
|
|
174
|
+
import gitconfig from "gitconfiglocal";
|
|
175
|
+
import { FormData as FormData2 } from "formdata-node";
|
|
176
|
+
|
|
177
|
+
// src/logPatcher.ts
|
|
178
|
+
import Transport from "winston-transport";
|
|
179
|
+
var LOG_LEVELS = {
|
|
180
|
+
INFO: "INFO",
|
|
181
|
+
ERROR: "ERROR",
|
|
182
|
+
DEBUG: "DEBUG",
|
|
183
|
+
TRACE: "TRACE",
|
|
184
|
+
WARN: "WARN"
|
|
185
|
+
};
|
|
186
|
+
var logPatcher = class extends Transport {
|
|
187
|
+
constructor(opts) {
|
|
188
|
+
super(opts);
|
|
189
|
+
}
|
|
190
|
+
logToTestOps = (level = LOG_LEVELS.INFO, message = [""]) => {
|
|
191
|
+
process.emit(`bs:addLog:${process.pid}`, {
|
|
192
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
193
|
+
level: level.toUpperCase(),
|
|
194
|
+
message: `"${message.join(", ")}"`,
|
|
195
|
+
kind: "TEST_LOG",
|
|
196
|
+
http_response: {}
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
/* Patching this would show user an extended trace on their cli */
|
|
200
|
+
trace = (...message) => {
|
|
201
|
+
this.logToTestOps(LOG_LEVELS.TRACE, message);
|
|
202
|
+
};
|
|
203
|
+
debug = (...message) => {
|
|
204
|
+
this.logToTestOps(LOG_LEVELS.DEBUG, message);
|
|
205
|
+
};
|
|
206
|
+
info = (...message) => {
|
|
207
|
+
this.logToTestOps(LOG_LEVELS.INFO, message);
|
|
208
|
+
};
|
|
209
|
+
warn = (...message) => {
|
|
210
|
+
this.logToTestOps(LOG_LEVELS.WARN, message);
|
|
211
|
+
};
|
|
212
|
+
error = (...message) => {
|
|
213
|
+
this.logToTestOps(LOG_LEVELS.ERROR, message);
|
|
214
|
+
};
|
|
215
|
+
log = (...message) => {
|
|
216
|
+
this.logToTestOps(LOG_LEVELS.INFO, message);
|
|
297
217
|
};
|
|
298
218
|
};
|
|
299
|
-
var
|
|
300
|
-
|
|
301
|
-
|
|
219
|
+
var logPatcher_default = logPatcher;
|
|
220
|
+
|
|
221
|
+
// src/performance-tester.ts
|
|
222
|
+
import { createObjectCsvWriter } from "csv-writer";
|
|
223
|
+
import fs from "node:fs";
|
|
224
|
+
import { performance, PerformanceObserver } from "node:perf_hooks";
|
|
225
|
+
var PerformanceTester = class {
|
|
226
|
+
static _observer;
|
|
227
|
+
static _csvWriter;
|
|
228
|
+
static _events = [];
|
|
229
|
+
static started = false;
|
|
230
|
+
static startMonitoring(csvName = "performance-report.csv") {
|
|
231
|
+
this._observer = new PerformanceObserver((list) => {
|
|
232
|
+
list.getEntries().forEach((entry) => {
|
|
233
|
+
this._events.push(entry);
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
this._observer.observe({ buffered: true, entryTypes: ["function"] });
|
|
237
|
+
this.started = true;
|
|
238
|
+
this._csvWriter = createObjectCsvWriter({
|
|
239
|
+
path: csvName,
|
|
240
|
+
header: [
|
|
241
|
+
{ id: "name", title: "Function Name" },
|
|
242
|
+
{ id: "time", title: "Execution Time (ms)" }
|
|
243
|
+
]
|
|
244
|
+
});
|
|
302
245
|
}
|
|
303
|
-
|
|
304
|
-
return
|
|
246
|
+
static getPerformance() {
|
|
247
|
+
return performance;
|
|
305
248
|
}
|
|
306
|
-
|
|
307
|
-
|
|
249
|
+
static calculateTimes(methods) {
|
|
250
|
+
const times = {};
|
|
251
|
+
this._events.map((entry) => {
|
|
252
|
+
if (!times[entry.name]) {
|
|
253
|
+
times[entry.name] = 0;
|
|
254
|
+
}
|
|
255
|
+
times[entry.name] += entry.duration;
|
|
256
|
+
});
|
|
257
|
+
const timeTaken = methods.reduce((a, c) => {
|
|
258
|
+
return times[c] + (a || 0);
|
|
259
|
+
}, 0);
|
|
260
|
+
BStackLogger.info(`Time for ${methods} is ${timeTaken}`);
|
|
261
|
+
return timeTaken;
|
|
308
262
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
263
|
+
static async stopAndGenerate(filename = "performance-own.html") {
|
|
264
|
+
if (!this.started) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
await sleep(2e3);
|
|
268
|
+
this._observer.disconnect();
|
|
269
|
+
this.started = false;
|
|
270
|
+
this.generateCSV(this._events);
|
|
271
|
+
const content = this.generateReport(this._events);
|
|
272
|
+
const path14 = process.cwd() + "/" + filename;
|
|
273
|
+
fs.writeFile(path14, content, (err) => {
|
|
274
|
+
if (err) {
|
|
275
|
+
BStackLogger.error(`Error in writing html ${err}`);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
BStackLogger.info(`Performance report is at ${path14}`);
|
|
279
|
+
});
|
|
323
280
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
BStackLogger.error(errorMessage);
|
|
281
|
+
static generateReport(entries) {
|
|
282
|
+
let html = "<!DOCTYPE html><html><head><title>Performance Report</title></head><body>";
|
|
283
|
+
html += "<h1>Performance Report</h1>";
|
|
284
|
+
html += "<table><thead><tr><th>Function Name</th><th>Duration (ms)</th></tr></thead><tbody>";
|
|
285
|
+
entries.forEach((entry) => {
|
|
286
|
+
html += `<tr><td>${entry.name}</td><td>${entry.duration}</td></tr>`;
|
|
287
|
+
});
|
|
288
|
+
html += "</tbody></table></body></html>";
|
|
289
|
+
return html;
|
|
290
|
+
}
|
|
291
|
+
static generateCSV(entries) {
|
|
292
|
+
const times = {};
|
|
293
|
+
entries.map((entry) => {
|
|
294
|
+
if (!times[entry.name]) {
|
|
295
|
+
times[entry.name] = 0;
|
|
340
296
|
}
|
|
341
|
-
|
|
297
|
+
times[entry.name] += entry.duration;
|
|
298
|
+
return {
|
|
299
|
+
name: entry.name,
|
|
300
|
+
time: entry.duration
|
|
301
|
+
};
|
|
302
|
+
});
|
|
303
|
+
const dat = Object.entries(times).map(([key, value]) => {
|
|
304
|
+
return {
|
|
305
|
+
name: key,
|
|
306
|
+
time: value
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
this._csvWriter.writeRecords(dat).then(() => BStackLogger.info("Performance CSV report generated successfully")).catch((error) => console.error(error));
|
|
342
310
|
}
|
|
343
311
|
};
|
|
344
312
|
|
|
@@ -780,7 +748,7 @@ var UsageStats = class _UsageStats {
|
|
|
780
748
|
var usageStats_default = UsageStats;
|
|
781
749
|
|
|
782
750
|
// src/scripts/accessibility-scripts.ts
|
|
783
|
-
import
|
|
751
|
+
import path from "node:path";
|
|
784
752
|
import fs2 from "node:fs";
|
|
785
753
|
import os from "node:os";
|
|
786
754
|
var AccessibilityScripts = class _AccessibilityScripts {
|
|
@@ -790,8 +758,8 @@ var AccessibilityScripts = class _AccessibilityScripts {
|
|
|
790
758
|
getResultsSummary = null;
|
|
791
759
|
saveTestResults = null;
|
|
792
760
|
commandsToWrap = null;
|
|
793
|
-
browserstackFolderPath =
|
|
794
|
-
commandsPath =
|
|
761
|
+
browserstackFolderPath = path.join(os.homedir(), ".browserstack");
|
|
762
|
+
commandsPath = path.join(this.browserstackFolderPath, "commands.json");
|
|
795
763
|
// don't allow to create instances from it other than through `checkAndGetInstance`
|
|
796
764
|
constructor() {
|
|
797
765
|
}
|
|
@@ -1694,7 +1662,7 @@ function getObservabilityBuild(options, bstackBuildName) {
|
|
|
1694
1662
|
if (options.testObservabilityOptions && options.testObservabilityOptions.buildName) {
|
|
1695
1663
|
return options.testObservabilityOptions.buildName;
|
|
1696
1664
|
}
|
|
1697
|
-
return bstackBuildName ||
|
|
1665
|
+
return bstackBuildName || path2.basename(path2.resolve(process.cwd()));
|
|
1698
1666
|
}
|
|
1699
1667
|
function getObservabilityBuildTags(options, bstackBuildTag) {
|
|
1700
1668
|
if (process.env.TEST_OBSERVABILITY_BUILD_TAG) {
|
|
@@ -1891,92 +1859,124 @@ function getObservabilityProduct(options, isAppAutomate) {
|
|
|
1891
1859
|
return isAppAutomate ? "app-automate" : isTurboScale(options) ? "turboscale" : "automate";
|
|
1892
1860
|
}
|
|
1893
1861
|
|
|
1894
|
-
// src/
|
|
1895
|
-
var
|
|
1896
|
-
|
|
1897
|
-
static
|
|
1898
|
-
static
|
|
1899
|
-
static
|
|
1900
|
-
static
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
this.
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
{ id: "time", title: "Execution Time (ms)" }
|
|
1913
|
-
]
|
|
1914
|
-
});
|
|
1862
|
+
// src/bstackLogger.ts
|
|
1863
|
+
var log = logger("@wdio/browserstack-service");
|
|
1864
|
+
var BStackLogger = class {
|
|
1865
|
+
static logFilePath = path3.join(process.cwd(), LOGS_FILE);
|
|
1866
|
+
static logFolderPath = path3.join(process.cwd(), "logs");
|
|
1867
|
+
static logFileStream;
|
|
1868
|
+
static logToFile(logMessage, logLevel) {
|
|
1869
|
+
try {
|
|
1870
|
+
if (!this.logFileStream) {
|
|
1871
|
+
this.ensureLogsFolder();
|
|
1872
|
+
this.logFileStream = fs4.createWriteStream(this.logFilePath, { flags: "a" });
|
|
1873
|
+
}
|
|
1874
|
+
if (this.logFileStream && this.logFileStream.writable) {
|
|
1875
|
+
this.logFileStream.write(this.formatLog(logMessage, logLevel));
|
|
1876
|
+
}
|
|
1877
|
+
} catch (error) {
|
|
1878
|
+
log.debug(`Failed to log to file. Error ${error}`);
|
|
1879
|
+
}
|
|
1915
1880
|
}
|
|
1916
|
-
static
|
|
1917
|
-
return
|
|
1881
|
+
static formatLog(logMessage, level) {
|
|
1882
|
+
return `${chalk.gray((/* @__PURE__ */ new Date()).toISOString())} ${chalk[COLORS[level]](level.toUpperCase())} ${chalk.whiteBright("@wdio/browserstack-service")} ${logMessage}
|
|
1883
|
+
`;
|
|
1918
1884
|
}
|
|
1919
|
-
static
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
if (!times[entry.name]) {
|
|
1923
|
-
times[entry.name] = 0;
|
|
1924
|
-
}
|
|
1925
|
-
times[entry.name] += entry.duration;
|
|
1926
|
-
});
|
|
1927
|
-
const timeTaken = methods.reduce((a, c) => {
|
|
1928
|
-
return times[c] + (a || 0);
|
|
1929
|
-
}, 0);
|
|
1930
|
-
BStackLogger.info(`Time for ${methods} is ${timeTaken}`);
|
|
1931
|
-
return timeTaken;
|
|
1885
|
+
static info(message) {
|
|
1886
|
+
this.logToFile(message, "info");
|
|
1887
|
+
log.info(message);
|
|
1932
1888
|
}
|
|
1933
|
-
static
|
|
1934
|
-
|
|
1935
|
-
|
|
1889
|
+
static error(message) {
|
|
1890
|
+
this.logToFile(message, "error");
|
|
1891
|
+
log.error(message);
|
|
1892
|
+
}
|
|
1893
|
+
static debug(message, param) {
|
|
1894
|
+
this.logToFile(message, "debug");
|
|
1895
|
+
if (param) {
|
|
1896
|
+
log.debug(message, param);
|
|
1897
|
+
} else {
|
|
1898
|
+
log.debug(message);
|
|
1936
1899
|
}
|
|
1937
|
-
await sleep(2e3);
|
|
1938
|
-
this._observer.disconnect();
|
|
1939
|
-
this.started = false;
|
|
1940
|
-
this.generateCSV(this._events);
|
|
1941
|
-
const content = this.generateReport(this._events);
|
|
1942
|
-
const path14 = process.cwd() + "/" + filename;
|
|
1943
|
-
fs4.writeFile(path14, content, (err) => {
|
|
1944
|
-
if (err) {
|
|
1945
|
-
BStackLogger.error(`Error in writing html ${err}`);
|
|
1946
|
-
return;
|
|
1947
|
-
}
|
|
1948
|
-
BStackLogger.info(`Performance report is at ${path14}`);
|
|
1949
|
-
});
|
|
1950
1900
|
}
|
|
1951
|
-
static
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
html += "<table><thead><tr><th>Function Name</th><th>Duration (ms)</th></tr></thead><tbody>";
|
|
1955
|
-
entries.forEach((entry) => {
|
|
1956
|
-
html += `<tr><td>${entry.name}</td><td>${entry.duration}</td></tr>`;
|
|
1957
|
-
});
|
|
1958
|
-
html += "</tbody></table></body></html>";
|
|
1959
|
-
return html;
|
|
1901
|
+
static warn(message) {
|
|
1902
|
+
this.logToFile(message, "warn");
|
|
1903
|
+
log.warn(message);
|
|
1960
1904
|
}
|
|
1961
|
-
static
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1905
|
+
static trace(message) {
|
|
1906
|
+
this.logToFile(message, "trace");
|
|
1907
|
+
log.trace(message);
|
|
1908
|
+
}
|
|
1909
|
+
static clearLogger() {
|
|
1910
|
+
if (this.logFileStream) {
|
|
1911
|
+
this.logFileStream.end();
|
|
1912
|
+
}
|
|
1913
|
+
this.logFileStream = null;
|
|
1914
|
+
}
|
|
1915
|
+
static clearLogFile() {
|
|
1916
|
+
if (fs4.existsSync(this.logFilePath)) {
|
|
1917
|
+
fs4.truncateSync(this.logFilePath);
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
static ensureLogsFolder() {
|
|
1921
|
+
if (!fs4.existsSync(this.logFolderPath)) {
|
|
1922
|
+
fs4.mkdirSync(this.logFolderPath);
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
|
|
1927
|
+
// src/testHub/utils.ts
|
|
1928
|
+
var getProductMap = (config) => {
|
|
1929
|
+
return {
|
|
1930
|
+
"observability": config.testObservability.enabled,
|
|
1931
|
+
"accessibility": config.accessibility,
|
|
1932
|
+
"percy": config.percy,
|
|
1933
|
+
"automate": config.automate,
|
|
1934
|
+
"app_automate": config.appAutomate
|
|
1935
|
+
};
|
|
1936
|
+
};
|
|
1937
|
+
var shouldProcessEventForTesthub = (eventType) => {
|
|
1938
|
+
if (isTrue(process.env[BROWSERSTACK_OBSERVABILITY])) {
|
|
1939
|
+
return true;
|
|
1940
|
+
}
|
|
1941
|
+
if (isTrue(process.env[BROWSERSTACK_ACCESSIBILITY])) {
|
|
1942
|
+
return !["HookRunStarted", "HookRunFinished", "LogCreated"].includes(eventType);
|
|
1943
|
+
}
|
|
1944
|
+
if (isTrue(process.env[BROWSERSTACK_PERCY]) && eventType) {
|
|
1945
|
+
return false;
|
|
1946
|
+
}
|
|
1947
|
+
return Boolean(process.env[BROWSERSTACK_ACCESSIBILITY] || process.env[BROWSERSTACK_OBSERVABILITY] || process.env[BROWSERSTACK_PERCY]);
|
|
1948
|
+
};
|
|
1949
|
+
var handleErrorForObservability = (error) => {
|
|
1950
|
+
process.env[BROWSERSTACK_OBSERVABILITY] = "false";
|
|
1951
|
+
logBuildError(error, "observability");
|
|
1952
|
+
};
|
|
1953
|
+
var handleErrorForAccessibility = (error) => {
|
|
1954
|
+
process.env[BROWSERSTACK_ACCESSIBILITY] = "false";
|
|
1955
|
+
logBuildError(error, "accessibility");
|
|
1956
|
+
};
|
|
1957
|
+
var logBuildError = (error, product = "") => {
|
|
1958
|
+
if (!error || !error.errors) {
|
|
1959
|
+
BStackLogger.error(`${product.toUpperCase()} Build creation failed ${error}`);
|
|
1960
|
+
return;
|
|
1961
|
+
}
|
|
1962
|
+
for (const errorJson of error.errors) {
|
|
1963
|
+
const errorType = errorJson.key;
|
|
1964
|
+
const errorMessage = errorJson.message;
|
|
1965
|
+
if (errorMessage) {
|
|
1966
|
+
switch (errorType) {
|
|
1967
|
+
case "ERROR_INVALID_CREDENTIALS":
|
|
1968
|
+
BStackLogger.error(errorMessage);
|
|
1969
|
+
break;
|
|
1970
|
+
case "ERROR_ACCESS_DENIED":
|
|
1971
|
+
BStackLogger.info(errorMessage);
|
|
1972
|
+
break;
|
|
1973
|
+
case "ERROR_SDK_DEPRECATED":
|
|
1974
|
+
BStackLogger.error(errorMessage);
|
|
1975
|
+
break;
|
|
1976
|
+
default:
|
|
1977
|
+
BStackLogger.error(errorMessage);
|
|
1966
1978
|
}
|
|
1967
|
-
|
|
1968
|
-
return {
|
|
1969
|
-
name: entry.name,
|
|
1970
|
-
time: entry.duration
|
|
1971
|
-
};
|
|
1972
|
-
});
|
|
1973
|
-
const dat = Object.entries(times).map(([key, value]) => {
|
|
1974
|
-
return {
|
|
1975
|
-
name: key,
|
|
1976
|
-
time: value
|
|
1977
|
-
};
|
|
1978
|
-
});
|
|
1979
|
-
this._csvWriter.writeRecords(dat).then(() => BStackLogger.info("Performance CSV report generated successfully")).catch((error) => console.error(error));
|
|
1979
|
+
}
|
|
1980
1980
|
}
|
|
1981
1981
|
};
|
|
1982
1982
|
|
|
@@ -3100,6 +3100,8 @@ var BrowserstackLauncherService = class {
|
|
|
3100
3100
|
PercyLogger.error(`Error while setting up Percy ${err}`);
|
|
3101
3101
|
}
|
|
3102
3102
|
}
|
|
3103
|
+
this._updateCaps(capabilities, "testhubBuildUuid");
|
|
3104
|
+
this._updateCaps(capabilities, "buildProductMap");
|
|
3103
3105
|
if (!this._options.browserstackLocal) {
|
|
3104
3106
|
return BStackLogger.info("browserstackLocal is not enabled - skipping...");
|
|
3105
3107
|
}
|
|
@@ -3390,6 +3392,10 @@ Visit https://observability.browserstack.com/builds/${process.env[BROWSERSTACK_T
|
|
|
3390
3392
|
capability["appium:app"] = value;
|
|
3391
3393
|
} else if (capType === "buildIdentifier" && value) {
|
|
3392
3394
|
capability["bstack:options"] = { buildIdentifier: value };
|
|
3395
|
+
} else if (capType === "testhubBuildUuid") {
|
|
3396
|
+
capability["bstack:options"] = { testhubBuildUuid: testOpsConfig_default.getInstance().buildHashedId };
|
|
3397
|
+
} else if (capType === "buildProductMap") {
|
|
3398
|
+
capability["bstack:options"] = { buildProductMap: getProductMap(this.browserStackConfig) };
|
|
3393
3399
|
}
|
|
3394
3400
|
} else if (capType === "local") {
|
|
3395
3401
|
capability["browserstack.local"] = true;
|
|
@@ -3403,6 +3409,10 @@ Visit https://observability.browserstack.com/builds/${process.env[BROWSERSTACK_T
|
|
|
3403
3409
|
}
|
|
3404
3410
|
} else if (capType === "localIdentifier") {
|
|
3405
3411
|
capability["browserstack.localIdentifier"] = value;
|
|
3412
|
+
} else if (capType === "testhubBuildUuid") {
|
|
3413
|
+
capability["browserstack.testhubBuildUuid"] = testOpsConfig_default.getInstance().buildHashedId;
|
|
3414
|
+
} else if (capType === "buildProductMap") {
|
|
3415
|
+
capability["browserstack.buildProductMap"] = getProductMap(this.browserStackConfig);
|
|
3406
3416
|
}
|
|
3407
3417
|
} else if (capType === "local") {
|
|
3408
3418
|
capability["bstack:options"].local = true;
|
|
@@ -3416,6 +3426,10 @@ Visit https://observability.browserstack.com/builds/${process.env[BROWSERSTACK_T
|
|
|
3416
3426
|
}
|
|
3417
3427
|
} else if (capType === "localIdentifier") {
|
|
3418
3428
|
capability["bstack:options"].localIdentifier = value;
|
|
3429
|
+
} else if (capType === "testhubBuildUuid") {
|
|
3430
|
+
capability["bstack:options"].testhubBuildUuid = testOpsConfig_default.getInstance().buildHashedId;
|
|
3431
|
+
} else if (capType === "buildProductMap") {
|
|
3432
|
+
capability["bstack:options"].buildProductMap = getProductMap(this.browserStackConfig);
|
|
3419
3433
|
}
|
|
3420
3434
|
});
|
|
3421
3435
|
} else if (typeof capabilities === "object") {
|
|
@@ -3429,6 +3443,10 @@ Visit https://observability.browserstack.com/builds/${process.env[BROWSERSTACK_T
|
|
|
3429
3443
|
caps.capabilities["appium:app"] = value;
|
|
3430
3444
|
} else if (capType === "buildIdentifier" && value) {
|
|
3431
3445
|
caps.capabilities["bstack:options"] = { buildIdentifier: value };
|
|
3446
|
+
} else if (capType === "testhubBuildUuid") {
|
|
3447
|
+
caps.capabilities["bstack:options"] = { testhubBuildUuid: testOpsConfig_default.getInstance().buildHashedId };
|
|
3448
|
+
} else if (capType === "buildProductMap") {
|
|
3449
|
+
caps.capabilities["bstack:options"] = { buildProductMap: getProductMap(this.browserStackConfig) };
|
|
3432
3450
|
}
|
|
3433
3451
|
} else if (capType === "local") {
|
|
3434
3452
|
caps.capabilities["browserstack.local"] = true;
|
|
@@ -3442,6 +3460,10 @@ Visit https://observability.browserstack.com/builds/${process.env[BROWSERSTACK_T
|
|
|
3442
3460
|
}
|
|
3443
3461
|
} else if (capType === "localIdentifier") {
|
|
3444
3462
|
caps.capabilities["browserstack.localIdentifier"] = value;
|
|
3463
|
+
} else if (capType === "testhubBuildUuid") {
|
|
3464
|
+
caps.capabilities["browserstack.testhubBuildUuid"] = testOpsConfig_default.getInstance().buildHashedId;
|
|
3465
|
+
} else if (capType === "buildProductMap") {
|
|
3466
|
+
caps.capabilities["browserstack.buildProductMap"] = getProductMap(this.browserStackConfig);
|
|
3445
3467
|
}
|
|
3446
3468
|
} else if (capType === "local") {
|
|
3447
3469
|
caps.capabilities["bstack:options"].local = true;
|
|
@@ -3455,6 +3477,10 @@ Visit https://observability.browserstack.com/builds/${process.env[BROWSERSTACK_T
|
|
|
3455
3477
|
}
|
|
3456
3478
|
} else if (capType === "localIdentifier") {
|
|
3457
3479
|
caps.capabilities["bstack:options"].localIdentifier = value;
|
|
3480
|
+
} else if (capType === "testhubBuildUuid") {
|
|
3481
|
+
caps.capabilities["bstack:options"].testhubBuildUuid = testOpsConfig_default.getInstance().buildHashedId;
|
|
3482
|
+
} else if (capType === "buildProductMap") {
|
|
3483
|
+
caps.capabilities["bstack:options"].buildProductMap = getProductMap(this.browserStackConfig);
|
|
3458
3484
|
}
|
|
3459
3485
|
});
|
|
3460
3486
|
} else {
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAK/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAKlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAiCxH,KAAK,iBAAiB,GAAG,yBAAyB,CAAC,KAAK,GAAG;IACvD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAA;CAC9C,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,YAAW,QAAQ,CAAC,eAAe;IAY5E,OAAO,CAAC,QAAQ;IAEhB,OAAO,CAAC,OAAO;IAbnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,YAAY,CAAC,CAAQ;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAQ;IAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAQ;IACjC,OAAO,CAAC,wBAAwB,CAAC,CAAS;IAC1C,OAAO,CAAC,MAAM,CAAC,CAAO;IACtB,OAAO,CAAC,sBAAsB,CAAC,CAA0B;IACzD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAoB;gBAG3C,QAAQ,EAAE,kBAAkB,GAAG,mBAAmB,EAC1D,YAAY,EAAE,YAAY,CAAC,sBAAsB,EACzC,OAAO,EAAE,OAAO,CAAC,UAAU;IAmHjC,aAAa,CAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAalC,SAAS,CAAE,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC,sBAAsB;IAyKxF,UAAU;IAqEV,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU;IA2B7G,SAAS;IAYT,UAAU,CAAC,GAAG,EAAC,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6BrD;;;OAGG;IACG,YAAY,CAAE,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAyB1D,kBAAkB;IAOxB,qBAAqB,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,sBAAsB,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAsF1H,WAAW,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,sBAAsB,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAwHhG,sBAAsB,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,sBAAsB;IAyCzE,8BAA8B;IAgB9B;;;OAGG;IACH,oBAAoB;IA6BpB,sBAAsB,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,SAAS,CAAC,EAAC,MAAM,EAAE,eAAe,CAAC,EAAC,MAAM;IASnF,mBAAmB;CAQtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/browserstack-service",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.2",
|
|
4
4
|
"description": "WebdriverIO service for better Browserstack integration",
|
|
5
5
|
"author": "Adam Bjerstedt <abjerstedt@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browserstack-service",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
},
|
|
33
33
|
"typeScriptVersion": "3.8.3",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@browserstack/ai-sdk-node": "1.5.
|
|
35
|
+
"@browserstack/ai-sdk-node": "1.5.17",
|
|
36
36
|
"@percy/appium-app": "^2.0.1",
|
|
37
37
|
"@percy/selenium-webdriver": "^2.0.3",
|
|
38
38
|
"@types/gitconfiglocal": "^2.0.1",
|
|
39
39
|
"@wdio/logger": "9.1.3",
|
|
40
|
-
"@wdio/reporter": "9.2
|
|
41
|
-
"@wdio/types": "9.
|
|
40
|
+
"@wdio/reporter": "9.4.2",
|
|
41
|
+
"@wdio/types": "9.4.2",
|
|
42
42
|
"browserstack-local": "^1.5.1",
|
|
43
43
|
"chalk": "^5.3.0",
|
|
44
44
|
"csv-writer": "^1.6.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"git-repo-info": "^2.1.1",
|
|
47
47
|
"gitconfiglocal": "^2.1.0",
|
|
48
48
|
"uuid": "^10.0.0",
|
|
49
|
-
"webdriverio": "9.4.
|
|
49
|
+
"webdriverio": "9.4.2",
|
|
50
50
|
"winston-transport": "^4.5.0",
|
|
51
51
|
"yauzl": "^3.0.0"
|
|
52
52
|
},
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^20.1.0",
|
|
58
58
|
"@types/yauzl": "^2.10.3",
|
|
59
|
-
"@wdio/globals": "9.4.
|
|
59
|
+
"@wdio/globals": "9.4.2"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e42d3e8d6958fd9a734fe1d9a9768357b6045893"
|
|
65
65
|
}
|