@wdio/browserstack-service 8.41.0 → 8.43.0
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/Percy/Percy-Handler.d.ts.map +1 -1
- package/build/Percy/Percy-Handler.js +5 -0
- package/build/Percy/Percy.d.ts.map +1 -1
- package/build/Percy/Percy.js +14 -0
- package/build/Percy/PercyBinary.d.ts.map +1 -1
- package/build/Percy/PercyBinary.js +11 -0
- package/build/Percy/PercySDK.d.ts.map +1 -1
- package/build/Percy/PercySDK.js +3 -6
- package/build/accessibility-handler.d.ts +2 -1
- package/build/accessibility-handler.d.ts.map +1 -1
- package/build/accessibility-handler.js +45 -21
- package/build/cleanup.d.ts.map +1 -1
- package/build/cleanup.js +10 -0
- package/build/config.d.ts.map +1 -1
- package/build/config.js +2 -0
- package/build/constants.d.ts +5 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +5 -0
- package/build/exitHandler.d.ts.map +1 -1
- package/build/exitHandler.js +8 -0
- package/build/instrumentation/funnelInstrumentation.d.ts.map +1 -1
- package/build/instrumentation/funnelInstrumentation.js +6 -1
- package/build/instrumentation/performance/constants.d.ts +79 -0
- package/build/instrumentation/performance/constants.d.ts.map +1 -0
- package/build/instrumentation/performance/constants.js +78 -0
- package/build/instrumentation/performance/performance-tester.d.ts +44 -0
- package/build/instrumentation/performance/performance-tester.d.ts.map +1 -0
- package/build/instrumentation/performance/performance-tester.js +280 -0
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +29 -5
- package/build/scripts/accessibility-scripts.d.ts +1 -0
- package/build/scripts/accessibility-scripts.d.ts.map +1 -1
- package/build/scripts/accessibility-scripts.js +27 -3
- package/build/service.d.ts.map +1 -1
- package/build/service.js +68 -14
- package/build/util.d.ts +26 -9
- package/build/util.d.ts.map +1 -1
- package/build/util.js +207 -37
- package/package.json +6 -6
- package/tsconfig.prod.tsbuildinfo +1 -1
- package/build/performance-tester.d.ts +0 -14
- package/build/performance-tester.d.ts.map +0 -1
- package/build/performance-tester.js +0 -94
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { PerformanceObserver } from 'node:perf_hooks';
|
|
2
|
-
export default class PerformanceTester {
|
|
3
|
-
static _observer: PerformanceObserver;
|
|
4
|
-
static _csvWriter: any;
|
|
5
|
-
private static _events;
|
|
6
|
-
static started: boolean;
|
|
7
|
-
static startMonitoring(csvName?: string): void;
|
|
8
|
-
static getPerformance(): import("perf_hooks").Performance;
|
|
9
|
-
static calculateTimes(methods: string[]): number;
|
|
10
|
-
static stopAndGenerate(filename?: string): Promise<void>;
|
|
11
|
-
static generateReport(entries: PerformanceEntry[]): string;
|
|
12
|
-
static generateCSV(entries: PerformanceEntry[]): void;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=performance-tester.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"performance-tester.d.ts","sourceRoot":"","sources":["../src/performance-tester.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAIlE,MAAM,CAAC,OAAO,OAAO,iBAAiB;IAClC,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAA;IACrC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAA;IACtB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAyB;IAC/C,MAAM,CAAC,OAAO,UAAQ;IAEtB,MAAM,CAAC,eAAe,CAAC,OAAO,GAAE,MAAiC;IAiBjE,MAAM,CAAC,cAAc;IAIrB,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAI,MAAM;WAepC,eAAe,CAAC,QAAQ,GAAE,MAA+B;IAoBtE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE;IAWjD,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,gBAAgB,EAAE;CAuBjD"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { createObjectCsvWriter } from 'csv-writer';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import { performance, PerformanceObserver } from 'node:perf_hooks';
|
|
4
|
-
import { sleep } from './util.js';
|
|
5
|
-
import { BStackLogger } from './bstackLogger.js';
|
|
6
|
-
export default class PerformanceTester {
|
|
7
|
-
static _observer;
|
|
8
|
-
static _csvWriter;
|
|
9
|
-
static _events = [];
|
|
10
|
-
static started = false;
|
|
11
|
-
static startMonitoring(csvName = 'performance-report.csv') {
|
|
12
|
-
this._observer = new PerformanceObserver(list => {
|
|
13
|
-
list.getEntries().forEach(entry => {
|
|
14
|
-
this._events.push(entry);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
this._observer.observe({ buffered: true, entryTypes: ['function'] });
|
|
18
|
-
this.started = true;
|
|
19
|
-
this._csvWriter = createObjectCsvWriter({
|
|
20
|
-
path: csvName,
|
|
21
|
-
header: [
|
|
22
|
-
{ id: 'name', title: 'Function Name' },
|
|
23
|
-
{ id: 'time', title: 'Execution Time (ms)' }
|
|
24
|
-
]
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
static getPerformance() {
|
|
28
|
-
return performance;
|
|
29
|
-
}
|
|
30
|
-
static calculateTimes(methods) {
|
|
31
|
-
const times = {};
|
|
32
|
-
this._events.map((entry) => {
|
|
33
|
-
if (!times[entry.name]) {
|
|
34
|
-
times[entry.name] = 0;
|
|
35
|
-
}
|
|
36
|
-
times[entry.name] += entry.duration;
|
|
37
|
-
});
|
|
38
|
-
const timeTaken = methods.reduce((a, c) => {
|
|
39
|
-
return times[c] + (a || 0);
|
|
40
|
-
}, 0);
|
|
41
|
-
BStackLogger.info(`Time for ${methods} is ${timeTaken}`);
|
|
42
|
-
return timeTaken;
|
|
43
|
-
}
|
|
44
|
-
static async stopAndGenerate(filename = 'performance-own.html') {
|
|
45
|
-
if (!this.started) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
await sleep(2000); // Wait to 2s just to finish any running callbacks for timerify
|
|
49
|
-
this._observer.disconnect();
|
|
50
|
-
this.started = false;
|
|
51
|
-
this.generateCSV(this._events);
|
|
52
|
-
const content = this.generateReport(this._events);
|
|
53
|
-
const path = process.cwd() + '/' + filename;
|
|
54
|
-
fs.writeFile(path, content, err => {
|
|
55
|
-
if (err) {
|
|
56
|
-
BStackLogger.error(`Error in writing html ${err}`);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
BStackLogger.info(`Performance report is at ${path}`);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
static generateReport(entries) {
|
|
63
|
-
let html = '<!DOCTYPE html><html><head><title>Performance Report</title></head><body>';
|
|
64
|
-
html += '<h1>Performance Report</h1>';
|
|
65
|
-
html += '<table><thead><tr><th>Function Name</th><th>Duration (ms)</th></tr></thead><tbody>';
|
|
66
|
-
entries.forEach((entry) => {
|
|
67
|
-
html += `<tr><td>${entry.name}</td><td>${entry.duration}</td></tr>`;
|
|
68
|
-
});
|
|
69
|
-
html += '</tbody></table></body></html>';
|
|
70
|
-
return html;
|
|
71
|
-
}
|
|
72
|
-
static generateCSV(entries) {
|
|
73
|
-
const times = {};
|
|
74
|
-
entries.map((entry) => {
|
|
75
|
-
if (!times[entry.name]) {
|
|
76
|
-
times[entry.name] = 0;
|
|
77
|
-
}
|
|
78
|
-
times[entry.name] += entry.duration;
|
|
79
|
-
return {
|
|
80
|
-
name: entry.name,
|
|
81
|
-
time: entry.duration
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
const dat = Object.entries(times).map(([key, value]) => {
|
|
85
|
-
return {
|
|
86
|
-
name: key,
|
|
87
|
-
time: value
|
|
88
|
-
};
|
|
89
|
-
});
|
|
90
|
-
this._csvWriter.writeRecords(dat)
|
|
91
|
-
.then(() => BStackLogger.info('Performance CSV report generated successfully'))
|
|
92
|
-
.catch((error) => console.error(error));
|
|
93
|
-
}
|
|
94
|
-
}
|