@wdio/browserstack-service 8.33.0 → 9.0.0-alpha.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.js +1 -1
- package/build/Percy/PercyBinary.d.ts +2 -3
- package/build/Percy/PercyBinary.d.ts.map +1 -1
- package/build/Percy/PercyBinary.js +41 -48
- package/build/accessibility-handler.d.ts +5 -3
- package/build/accessibility-handler.d.ts.map +1 -1
- package/build/accessibility-handler.js +60 -34
- package/build/config.d.ts +1 -1
- package/build/config.d.ts.map +1 -1
- package/build/constants.d.ts.map +1 -1
- package/build/crash-reporter.d.ts.map +1 -1
- package/build/crash-reporter.js +15 -9
- package/build/data-store.d.ts +0 -1
- package/build/data-store.d.ts.map +1 -1
- package/build/data-store.js +1 -1
- package/build/exitHandler.d.ts.map +1 -1
- package/build/exitHandler.js +0 -3
- package/build/fetchWrapper.d.ts +6 -0
- package/build/fetchWrapper.d.ts.map +1 -0
- package/build/fetchWrapper.js +14 -0
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +2 -4
- package/build/instrumentation/funnelInstrumentation.d.ts.map +1 -1
- package/build/instrumentation/funnelInstrumentation.js +11 -10
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +15 -11
- package/build/reporter.d.ts.map +1 -1
- package/build/reporter.js +3 -0
- package/build/request-handler.d.ts +1 -1
- package/build/request-handler.d.ts.map +1 -1
- package/build/request-handler.js +1 -1
- package/build/scripts/accessibility-scripts.d.ts +26 -0
- package/build/scripts/accessibility-scripts.d.ts.map +1 -0
- package/build/scripts/accessibility-scripts.js +61 -0
- package/build/service.d.ts +1 -1
- package/build/service.d.ts.map +1 -1
- package/build/service.js +38 -26
- package/build/testOps/requestUtils.js +7 -7
- package/build/types.d.ts +0 -13
- package/build/types.d.ts.map +1 -1
- package/build/util.d.ts +5 -11
- package/build/util.d.ts.map +1 -1
- package/build/util.js +91 -56
- package/package.json +9 -9
- package/build/scripts/test-event-scripts.d.ts +0 -10
- package/build/scripts/test-event-scripts.d.ts.map +0 -1
- package/build/scripts/test-event-scripts.js +0 -65
package/build/Percy/Percy.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { Options } from '@wdio/types';
|
|
2
1
|
declare class PercyBinary {
|
|
3
2
|
#private;
|
|
4
3
|
constructor();
|
|
5
|
-
getBinaryPath(
|
|
4
|
+
getBinaryPath(): Promise<string>;
|
|
6
5
|
validateBinary(binaryPath: string): Promise<unknown>;
|
|
7
|
-
download(
|
|
6
|
+
download(destParentDir: any): Promise<string>;
|
|
8
7
|
}
|
|
9
8
|
export default PercyBinary;
|
|
10
9
|
//# sourceMappingURL=PercyBinary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PercyBinary.d.ts","sourceRoot":"","sources":["../../src/Percy/PercyBinary.ts"],"names":[],"mappings":"AAUA,
|
|
1
|
+
{"version":3,"file":"PercyBinary.d.ts","sourceRoot":"","sources":["../../src/Percy/PercyBinary.ts"],"names":[],"mappings":"AAUA,cAAM,WAAW;;;IAmDP,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAgBhC,cAAc,CAAC,UAAU,EAAE,MAAM;IAiBjC,QAAQ,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;CA6DtD;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import url from 'node:url';
|
|
2
1
|
import yauzl from 'yauzl';
|
|
3
2
|
import fs from 'node:fs';
|
|
4
3
|
import fsp from 'node:fs/promises';
|
|
5
|
-
import
|
|
4
|
+
import { pipeline } from 'node:stream/promises';
|
|
6
5
|
import path from 'node:path';
|
|
7
6
|
import os from 'node:os';
|
|
8
7
|
import { spawn } from 'node:child_process';
|
|
@@ -55,18 +54,18 @@ class PercyBinary {
|
|
|
55
54
|
}
|
|
56
55
|
throw new Error('Error trying to download percy binary');
|
|
57
56
|
}
|
|
58
|
-
async getBinaryPath(
|
|
57
|
+
async getBinaryPath() {
|
|
59
58
|
const destParentDir = await this.#getAvailableDirs();
|
|
60
59
|
const binaryPath = path.join(destParentDir, this.#binaryName);
|
|
61
60
|
if (await this.#checkPath(binaryPath)) {
|
|
62
61
|
return binaryPath;
|
|
63
62
|
}
|
|
64
|
-
const downloadedBinaryPath = await this.download(
|
|
63
|
+
const downloadedBinaryPath = await this.download(destParentDir);
|
|
65
64
|
const isValid = await this.validateBinary(downloadedBinaryPath);
|
|
66
65
|
if (!isValid) {
|
|
67
66
|
// retry once
|
|
68
67
|
PercyLogger.error('Corrupt percy binary, retrying');
|
|
69
|
-
return await this.download(
|
|
68
|
+
return await this.download(destParentDir);
|
|
70
69
|
}
|
|
71
70
|
return downloadedBinaryPath;
|
|
72
71
|
}
|
|
@@ -85,7 +84,7 @@ class PercyBinary {
|
|
|
85
84
|
});
|
|
86
85
|
});
|
|
87
86
|
}
|
|
88
|
-
async download(
|
|
87
|
+
async download(destParentDir) {
|
|
89
88
|
if (!await this.#checkPath(destParentDir)) {
|
|
90
89
|
await fsp.mkdir(destParentDir);
|
|
91
90
|
}
|
|
@@ -93,54 +92,48 @@ class PercyBinary {
|
|
|
93
92
|
const zipFilePath = path.join(destParentDir, binaryName + '.zip');
|
|
94
93
|
const binaryPath = path.join(destParentDir, binaryName);
|
|
95
94
|
const downloadedFileStream = fs.createWriteStream(zipFilePath);
|
|
96
|
-
const
|
|
95
|
+
const response = await fetch(this.#httpPath);
|
|
96
|
+
await pipeline(response.body, downloadedFileStream);
|
|
97
97
|
return new Promise((resolve, reject) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
.on('
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
yauzl.open(zipFilePath, { lazyEntries: true }, function (err, zipfile) {
|
|
99
|
+
if (err) {
|
|
100
|
+
return reject(err);
|
|
101
|
+
}
|
|
102
|
+
zipfile.readEntry();
|
|
103
|
+
zipfile.on('entry', (entry) => {
|
|
104
|
+
if (/\/$/.test(entry.fileName)) {
|
|
105
|
+
// Directory file names end with '/'.
|
|
106
|
+
zipfile.readEntry();
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
zipfile.readEntry();
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
// file entry
|
|
116
|
-
const writeStream = fs.createWriteStream(path.join(destParentDir, entry.fileName));
|
|
117
|
-
zipfile.openReadStream(entry, function (zipErr, readStream) {
|
|
118
|
-
if (zipErr) {
|
|
119
|
-
reject(err);
|
|
120
|
-
}
|
|
121
|
-
readStream.on('end', function () {
|
|
122
|
-
writeStream.close();
|
|
123
|
-
zipfile.readEntry();
|
|
124
|
-
});
|
|
125
|
-
readStream.pipe(writeStream);
|
|
126
|
-
});
|
|
127
|
-
if (entry.fileName === binaryName) {
|
|
128
|
-
zipfile.close();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
zipfile.on('error', (zipErr) => {
|
|
133
|
-
reject(zipErr);
|
|
134
|
-
});
|
|
135
|
-
zipfile.once('end', () => {
|
|
136
|
-
fs.chmod(binaryPath, '0755', function (zipErr) {
|
|
108
|
+
else {
|
|
109
|
+
// file entry
|
|
110
|
+
const writeStream = fs.createWriteStream(path.join(destParentDir, entry.fileName));
|
|
111
|
+
zipfile.openReadStream(entry, function (zipErr, readStream) {
|
|
137
112
|
if (zipErr) {
|
|
138
|
-
reject(
|
|
113
|
+
reject(err);
|
|
139
114
|
}
|
|
140
|
-
|
|
115
|
+
readStream.on('end', function () {
|
|
116
|
+
writeStream.close();
|
|
117
|
+
zipfile.readEntry();
|
|
118
|
+
});
|
|
119
|
+
readStream.pipe(writeStream);
|
|
141
120
|
});
|
|
142
|
-
|
|
121
|
+
if (entry.fileName === binaryName) {
|
|
122
|
+
zipfile.close();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
zipfile.on('error', (zipErr) => {
|
|
127
|
+
reject(zipErr);
|
|
128
|
+
});
|
|
129
|
+
zipfile.once('end', () => {
|
|
130
|
+
fs.chmod(binaryPath, '0755', function (zipErr) {
|
|
131
|
+
if (zipErr) {
|
|
132
|
+
reject(zipErr);
|
|
133
|
+
}
|
|
134
|
+
resolve(binaryPath);
|
|
143
135
|
});
|
|
136
|
+
zipfile.close();
|
|
144
137
|
});
|
|
145
138
|
});
|
|
146
139
|
});
|
|
@@ -12,12 +12,14 @@ declare class _AccessibilityHandler {
|
|
|
12
12
|
private _accessibility?;
|
|
13
13
|
private _accessibilityOptions?;
|
|
14
14
|
private _testMetadata;
|
|
15
|
+
private static _a11yScanSessionMap;
|
|
16
|
+
private _sessionId;
|
|
15
17
|
constructor(_browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser, _capabilities: Capabilities.RemoteCapability, isAppAutomate?: boolean, _framework?: string | undefined, _accessibilityAutomation?: string | boolean | undefined, _accessibilityOpts?: {
|
|
16
18
|
[key: string]: any;
|
|
17
19
|
} | undefined);
|
|
18
20
|
setSuiteFile(filename: string): void;
|
|
19
21
|
_getCapabilityValue(caps: Capabilities.RemoteCapability, capType: string, legacyCapType: string): WebdriverIO.SafaridriverOptions | undefined;
|
|
20
|
-
before(): Promise<void>;
|
|
22
|
+
before(sessionId: string): Promise<void>;
|
|
21
23
|
beforeTest(suiteTitle: string | undefined, test: Frameworks.Test): Promise<void>;
|
|
22
24
|
afterTest(suiteTitle: string | undefined, test: Frameworks.Test): Promise<void>;
|
|
23
25
|
/**
|
|
@@ -25,12 +27,12 @@ declare class _AccessibilityHandler {
|
|
|
25
27
|
*/
|
|
26
28
|
beforeScenario(world: ITestCaseHookParameter): Promise<void>;
|
|
27
29
|
afterScenario(world: ITestCaseHookParameter): Promise<void>;
|
|
28
|
-
private
|
|
29
|
-
private sendTestForceStopEvent;
|
|
30
|
+
private commandWrapper;
|
|
30
31
|
private sendTestStopEvent;
|
|
31
32
|
private getIdentifier;
|
|
32
33
|
private shouldRunTestHooks;
|
|
33
34
|
private checkIfPageOpened;
|
|
35
|
+
private static shouldPatchExecuteScript;
|
|
34
36
|
}
|
|
35
37
|
declare const AccessibilityHandler: typeof _AccessibilityHandler;
|
|
36
38
|
type AccessibilityHandler = _AccessibilityHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility-handler.d.ts","sourceRoot":"","sources":["../src/accessibility-handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accessibility-handler.d.ts","sourceRoot":"","sources":["../src/accessibility-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAmBjE,cAAM,qBAAqB;IAWnB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IAErB,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,wBAAwB,CAAC;IACjC,OAAO,CAAC,kBAAkB,CAAC;IAf/B,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,qBAAqB,CAAC,CAAyB;IACvD,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAA8B;IAChE,OAAO,CAAC,UAAU,CAAsB;gBAG5B,QAAQ,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB,EAC9D,aAAa,EAAE,YAAY,CAAC,gBAAgB,EACpD,aAAa,CAAC,EAAE,OAAO,EACf,UAAU,CAAC,oBAAQ,EACnB,wBAAwB,CAAC,8BAAkB,EAC3C,kBAAkB,CAAC;;iBAAyB;IAgBxD,YAAY,CAAC,QAAQ,EAAE,MAAM;IAI7B,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAC,gBAAgB,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IA6BzF,MAAM,CAAE,SAAS,EAAE,MAAM;IAsCzB,UAAU,CAAE,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI;IAgCjE,SAAS,CAAE,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI;IA2CtE;;MAEE;IACI,cAAc,CAAE,KAAK,EAAE,sBAAsB;IAgC7C,aAAa,CAAE,KAAK,EAAE,sBAAsB;YA+CpC,cAAc;YAcd,iBAAiB;IAO/B,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,kBAAkB;YAOZ,iBAAiB;IAkB/B,OAAO,CAAC,MAAM,CAAC,wBAAwB;CAU1C;AAGD,QAAA,MAAM,oBAAoB,EAAE,OAAO,qBAAoE,CAAA;AACvG,KAAK,oBAAoB,GAAG,qBAAqB,CAAA;AAEjD,eAAe,oBAAoB,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import util from 'node:util';
|
|
2
|
+
import { getA11yResultsSummary, getA11yResults, performA11yScan, getUniqueIdentifier, getUniqueIdentifierForCucumber, isAccessibilityAutomationSession, isBrowserstackSession, o11yClassErrorHandler, shouldScanTestForAccessibility, validateCapsWithA11y, isTrue } from './util.js';
|
|
3
|
+
import accessibilityScripts from './scripts/accessibility-scripts.js';
|
|
3
4
|
import { BStackLogger } from './bstackLogger.js';
|
|
4
5
|
class _AccessibilityHandler {
|
|
5
6
|
_browser;
|
|
@@ -13,6 +14,8 @@ class _AccessibilityHandler {
|
|
|
13
14
|
_accessibility;
|
|
14
15
|
_accessibilityOptions;
|
|
15
16
|
_testMetadata = {};
|
|
17
|
+
static _a11yScanSessionMap = {};
|
|
18
|
+
_sessionId = null;
|
|
16
19
|
constructor(_browser, _capabilities, isAppAutomate, _framework, _accessibilityAutomation, _accessibilityOpts) {
|
|
17
20
|
this._browser = _browser;
|
|
18
21
|
this._capabilities = _capabilities;
|
|
@@ -68,7 +71,8 @@ class _AccessibilityHandler {
|
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
|
-
async before() {
|
|
74
|
+
async before(sessionId) {
|
|
75
|
+
this._sessionId = sessionId;
|
|
72
76
|
this._accessibility = isTrue(this._getCapabilityValue(this._caps, 'accessibility', 'browserstack.accessibility'));
|
|
73
77
|
if (isBrowserstackSession(this._browser) && isAccessibilityAutomationSession(this._accessibility)) {
|
|
74
78
|
const deviceName = this._getCapabilityValue(this._caps, 'deviceName', 'device');
|
|
@@ -81,25 +85,37 @@ class _AccessibilityHandler {
|
|
|
81
85
|
this._browser.getAccessibilityResults = async () => {
|
|
82
86
|
return await getA11yResults(this._browser, isBrowserstackSession(this._browser), this._accessibility);
|
|
83
87
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
this._browser.performScan = async () => {
|
|
89
|
+
return await performA11yScan(this._browser, isBrowserstackSession(this._browser), this._accessibility);
|
|
90
|
+
};
|
|
91
|
+
if (!this._accessibility) {
|
|
88
92
|
return;
|
|
89
93
|
}
|
|
90
|
-
|
|
91
|
-
const testIdentifier = this.getIdentifier(test);
|
|
92
|
-
const isPageOpened = await this.checkIfPageOpened(this._browser, testIdentifier, shouldScanTest);
|
|
93
|
-
if (!isPageOpened) {
|
|
94
|
+
if (!('overwriteCommand' in this._browser && Array.isArray(accessibilityScripts.commandsToWrap))) {
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
97
|
+
accessibilityScripts.commandsToWrap
|
|
98
|
+
.filter((command) => command.name && command.class)
|
|
99
|
+
.forEach((command) => {
|
|
100
|
+
const browser = this._browser;
|
|
101
|
+
browser.overwriteCommand(command.name, this.commandWrapper.bind(this, command), command.class === 'Element');
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
async beforeTest(suiteTitle, test) {
|
|
96
105
|
try {
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
if (this._framework !== 'mocha' ||
|
|
107
|
+
!this.shouldRunTestHooks(this._browser, this._accessibility)) {
|
|
108
|
+
return;
|
|
100
109
|
}
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
const shouldScanTest = shouldScanTestForAccessibility(suiteTitle, test.title, this._accessibilityOptions);
|
|
111
|
+
const testIdentifier = this.getIdentifier(test);
|
|
112
|
+
const isPageOpened = await this.checkIfPageOpened(this._browser, testIdentifier, shouldScanTest);
|
|
113
|
+
if (this._sessionId) {
|
|
114
|
+
/* For case with multiple tests under one browser, before hook of 2nd test should change this map value */
|
|
115
|
+
AccessibilityHandler._a11yScanSessionMap[this._sessionId] = shouldScanTest;
|
|
116
|
+
}
|
|
117
|
+
if (!isPageOpened) {
|
|
118
|
+
return;
|
|
103
119
|
}
|
|
104
120
|
this._testMetadata[testIdentifier].accessibilityScanStarted = shouldScanTest;
|
|
105
121
|
if (shouldScanTest) {
|
|
@@ -149,25 +165,22 @@ class _AccessibilityHandler {
|
|
|
149
165
|
* Cucumber Only
|
|
150
166
|
*/
|
|
151
167
|
async beforeScenario(world) {
|
|
152
|
-
if (!this.shouldRunTestHooks(this._browser, this._accessibility)) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
168
|
const pickleData = world.pickle;
|
|
156
169
|
const gherkinDocument = world.gherkinDocument;
|
|
157
170
|
const featureData = gherkinDocument.feature;
|
|
158
171
|
const uniqueId = getUniqueIdentifierForCucumber(world);
|
|
159
|
-
|
|
160
|
-
const isPageOpened = await this.checkIfPageOpened(this._browser, uniqueId, shouldScanScenario);
|
|
161
|
-
if (!isPageOpened) {
|
|
172
|
+
if (!this.shouldRunTestHooks(this._browser, this._accessibility)) {
|
|
162
173
|
return;
|
|
163
174
|
}
|
|
164
175
|
try {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
176
|
+
const shouldScanScenario = shouldScanTestForAccessibility(featureData?.name, pickleData.name, this._accessibilityOptions, world, true);
|
|
177
|
+
const isPageOpened = await this.checkIfPageOpened(this._browser, uniqueId, shouldScanScenario);
|
|
178
|
+
if (this._sessionId) {
|
|
179
|
+
/* For case with multiple tests under one browser, before hook of 2nd test should change this map value */
|
|
180
|
+
AccessibilityHandler._a11yScanSessionMap[this._sessionId] = shouldScanScenario;
|
|
168
181
|
}
|
|
169
|
-
|
|
170
|
-
|
|
182
|
+
if (!isPageOpened) {
|
|
183
|
+
return;
|
|
171
184
|
}
|
|
172
185
|
this._testMetadata[uniqueId].accessibilityScanStarted = shouldScanScenario;
|
|
173
186
|
if (shouldScanScenario) {
|
|
@@ -218,14 +231,20 @@ class _AccessibilityHandler {
|
|
|
218
231
|
/*
|
|
219
232
|
* private methods
|
|
220
233
|
*/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
234
|
+
async commandWrapper(command, origFunction, ...args) {
|
|
235
|
+
if (this._sessionId && AccessibilityHandler._a11yScanSessionMap[this._sessionId] &&
|
|
236
|
+
(!command.name.includes('execute') ||
|
|
237
|
+
!AccessibilityHandler.shouldPatchExecuteScript(args.length ? args[0] : null))) {
|
|
238
|
+
BStackLogger.debug(`Performing scan for ${command.class} ${command.name}`);
|
|
239
|
+
await performA11yScan(this._browser, true, true, command.name);
|
|
240
|
+
}
|
|
241
|
+
return origFunction(...args);
|
|
226
242
|
}
|
|
227
|
-
sendTestStopEvent(browser, dataForExtension) {
|
|
228
|
-
|
|
243
|
+
async sendTestStopEvent(browser, dataForExtension) {
|
|
244
|
+
BStackLogger.debug('Performing scan before saving results');
|
|
245
|
+
await performA11yScan(browser, true, true);
|
|
246
|
+
const results = await browser.executeAsync(accessibilityScripts.saveTestResults, dataForExtension);
|
|
247
|
+
BStackLogger.debug(util.format(results));
|
|
229
248
|
}
|
|
230
249
|
getIdentifier(test) {
|
|
231
250
|
if ('pickle' in test) {
|
|
@@ -255,6 +274,13 @@ class _AccessibilityHandler {
|
|
|
255
274
|
}
|
|
256
275
|
return pageOpen;
|
|
257
276
|
}
|
|
277
|
+
static shouldPatchExecuteScript(script) {
|
|
278
|
+
if (!script || typeof script !== 'string') {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
return (script.toLowerCase().indexOf('browserstack_executor') !== -1 ||
|
|
282
|
+
script.toLowerCase().indexOf('browserstack_accessibility_automation_script') !== -1);
|
|
283
|
+
}
|
|
258
284
|
}
|
|
259
285
|
// https://github.com/microsoft/TypeScript/issues/6543
|
|
260
286
|
const AccessibilityHandler = o11yClassErrorHandler(_AccessibilityHandler);
|
package/build/config.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare class BrowserStackConfig {
|
|
|
16
16
|
appAutomate: boolean;
|
|
17
17
|
automate: boolean;
|
|
18
18
|
funnelDataSent: boolean;
|
|
19
|
-
|
|
19
|
+
constructor(options: BrowserstackConfig & Options.Testrunner, config: Options.Testrunner);
|
|
20
20
|
sentFunnelData(): void;
|
|
21
21
|
}
|
|
22
22
|
export default BrowserStackConfig;
|
package/build/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,aAAa,MAAM,4BAA4B,CAAA;AAGtD,cAAM,kBAAkB;IACpB,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,GAAG,kBAAkB;IAO/G,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,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AA;AAGpE,eAAO,MAAM,oBAAoB,+BAA+B,CAAA;AAGhE,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AAGxE,eAAO,MAAM,eAAe,6BAA6B,CAAA;AAGzD,eAAO,MAAM,SAAS,uBAAuB,CAAA;AAG7C,eAAO,MAAM,2BAA2B,+BAA+B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crash-reporter.d.ts","sourceRoot":"","sources":["../src/crash-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"crash-reporter.d.ts","sourceRoot":"","sources":["../src/crash-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGxD,OAAO,KAAK,EAAE,kBAAkB,EAAmC,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAI7G,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAE/B,MAAM,CAAC,OAAO,OAAO,aAAa;IAE9B,OAAc,sBAAsB,EAAE,sBAAsB,CAAK;IAEjE,OAAO,CAAC,MAAM,CAAC,+BAA+B,CAAsC;IAEpF,MAAM,CAAC,kCAAkC,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU;IAQtH,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU;WAiBxI,iBAAiB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM;IAsDjE,MAAM,CAAC,+BAA+B,CAAC,GAAG,EAAE,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;IAiB9E,MAAM,CAAC,uBAAuB,CAAC,GAAG,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC;IAOxD,MAAM,CAAC,kBAAkB,CAAC,YAAY,EAAE,YAAY,CAAC,gBAAgB;IAMrE,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU;CAyBlD"}
|
package/build/crash-reporter.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import got from 'got';
|
|
2
1
|
import { BSTACK_SERVICE_VERSION, DATA_ENDPOINT, TESTOPS_BUILD_ID_ENV } from './constants.js';
|
|
3
2
|
import { DEFAULT_REQUEST_CONFIG, getObservabilityKey, getObservabilityUser } from './util.js';
|
|
4
3
|
import { BStackLogger } from './bstackLogger.js';
|
|
@@ -64,15 +63,22 @@ export default class CrashReporter {
|
|
|
64
63
|
config: this.userConfigForReporting
|
|
65
64
|
};
|
|
66
65
|
const url = `${DATA_ENDPOINT}/api/v1/analytics`;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
...
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
const encodedAuth = Buffer.from(`${this.credentialsForCrashReportUpload.username}:${this.credentialsForCrashReportUpload.password}`, 'utf8').toString('base64');
|
|
67
|
+
const headers = {
|
|
68
|
+
...DEFAULT_REQUEST_CONFIG.headers,
|
|
69
|
+
Authorization: `Basic ${encodedAuth}`,
|
|
70
|
+
};
|
|
71
|
+
const response = await fetch(url, {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
body: JSON.stringify(data),
|
|
74
|
+
headers
|
|
75
75
|
});
|
|
76
|
+
if (response.ok) {
|
|
77
|
+
BStackLogger.debug(`[Crash_Report_Upload] Success response: ${JSON.stringify(await response.json())}`);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
BStackLogger.error(`[Crash_Report_Upload] Failed due to ${response.body}`);
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
static recursivelyRedactKeysFromObject(obj, keys) {
|
|
78
84
|
if (!obj) {
|
package/build/data-store.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-store.d.ts","sourceRoot":"","sources":["../src/data-store.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,6BAoBjC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QASvD
|
|
1
|
+
{"version":3,"file":"data-store.d.ts","sourceRoot":"","sources":["../src/data-store.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,6BAoBjC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QASvD"}
|
package/build/data-store.js
CHANGED
|
@@ -29,7 +29,7 @@ export function saveWorkerData(data) {
|
|
|
29
29
|
BStackLogger.debug('Exception in saving worker data: ' + e);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
function removeWorkersDataDir() {
|
|
33
33
|
fs.rmSync(workersDataDirPath, { recursive: true, force: true });
|
|
34
34
|
return true;
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitHandler.d.ts","sourceRoot":"","sources":["../src/exitHandler.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"exitHandler.d.ts","sourceRoot":"","sources":["../src/exitHandler.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,MAAM,aAAa,CAAA;AAQ5C,wBAAgB,iBAAiB,SAShC;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAYtE"}
|
package/build/exitHandler.js
CHANGED
|
@@ -4,15 +4,12 @@ import BrowserStackConfig from './config.js';
|
|
|
4
4
|
import { saveFunnelData } from './instrumentation/funnelInstrumentation.js';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { TESTOPS_JWT_ENV } from './constants.js';
|
|
7
|
-
import { BStackLogger } from './bstackLogger.js';
|
|
8
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
8
|
const __dirname = path.dirname(__filename);
|
|
10
9
|
export function setupExitHandlers() {
|
|
11
10
|
process.on('exit', (code) => {
|
|
12
|
-
BStackLogger.debug('Exit hook called');
|
|
13
11
|
const args = shouldCallCleanup(BrowserStackConfig.getInstance());
|
|
14
12
|
if (Array.isArray(args) && args.length) {
|
|
15
|
-
BStackLogger.debug('Spawning cleanup with args ' + args.toString());
|
|
16
13
|
const childProcess = spawn('node', [`${path.join(__dirname, 'cleanup.js')}`, ...args], { detached: true, stdio: 'inherit', env: { ...process.env } });
|
|
17
14
|
childProcess.unref();
|
|
18
15
|
process.exit(code);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare class ResponseError extends Error {
|
|
2
|
+
response: Response;
|
|
3
|
+
constructor(message: string, res: Response);
|
|
4
|
+
}
|
|
5
|
+
export default function fetchWrap(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
6
|
+
//# sourceMappingURL=fetchWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchWrapper.d.ts","sourceRoot":"","sources":["../src/fetchWrapper.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IAC7B,QAAQ,EAAE,QAAQ,CAAA;gBACb,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ;CAI7C;AAED,wBAA8B,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,qBAMnF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class ResponseError extends Error {
|
|
2
|
+
response;
|
|
3
|
+
constructor(message, res) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.response = res;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export default async function fetchWrap(input, init) {
|
|
9
|
+
const res = await fetch(input, init);
|
|
10
|
+
if (!res.ok) {
|
|
11
|
+
throw new ResponseError(`Error response from server ${res.status}: ${await res.text()}`, res);
|
|
12
|
+
}
|
|
13
|
+
return res;
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGzE,OAAO,KAAK,EAAiB,OAAO,EAAE,QAAQ,EAAsB,YAAY,EAAE,kBAAkB,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAgBjK,OAAO,KAAK,EACR,QAAQ,EACR,QAAQ,EAER,cAAc,EACd,MAAM,EACT,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C,cAAM,gBAAgB;IAiBL,OAAO,CAAC,QAAQ;IAAiF,OAAO,CAAC,UAAU,CAAC;IAhBjI,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,SAAS,CAA2D;IAC5E,OAAO,CAAC,cAAc,CAAC,CAAQ;IAC/B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,aAAa,CAIpB;IACD,OAAO,CAAC,SAAS,CAAC,CAAoC;IACtD,OAAO,CAAC,QAAQ,CAAyB;gBAEpB,QAAQ,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW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AAC,yBAAyB;IAqFjC,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,aAAa;CAMxB;AAGD,QAAA,MAAM,eAAe,EAAE,OAAO,gBAA0D,CAAA;AACxF,KAAK,eAAe,GAAG,gBAAgB,CAAA;AAEvC,eAAe,eAAe,CAAA"}
|
|
@@ -206,7 +206,7 @@ class _InsightsHandler {
|
|
|
206
206
|
};
|
|
207
207
|
this.setCurrentHook({ uuid: hookUUID });
|
|
208
208
|
this.attachHookData(context, hookUUID);
|
|
209
|
-
this.listener.hookStarted(this.getRunData(test, '
|
|
209
|
+
this.listener.hookStarted(this.getRunData(test, 'HookRunStarted'));
|
|
210
210
|
}
|
|
211
211
|
async afterHook(test, result) {
|
|
212
212
|
if (!frameworkSupportsHook('after', this._framework)) {
|
|
@@ -244,7 +244,7 @@ class _InsightsHandler {
|
|
|
244
244
|
startedAt: (new Date()).toISOString(),
|
|
245
245
|
finishedAt: (new Date()).toISOString()
|
|
246
246
|
};
|
|
247
|
-
this.listener.
|
|
247
|
+
this.listener.testFinished(this.getRunData(skippedTest, 'TestRunSkipped'));
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
250
|
/*
|
|
@@ -324,7 +324,6 @@ class _InsightsHandler {
|
|
|
324
324
|
...(this._tests[fullTitle] || {}),
|
|
325
325
|
finishedAt: (new Date()).toISOString()
|
|
326
326
|
};
|
|
327
|
-
BStackLogger.debug('calling testFinished');
|
|
328
327
|
this.listener.testFinished(this.getRunData(test, 'TestRunFinished', result));
|
|
329
328
|
}
|
|
330
329
|
/**
|
|
@@ -692,7 +691,6 @@ class _InsightsHandler {
|
|
|
692
691
|
}
|
|
693
692
|
if (eventType === 'TestRunSkipped') {
|
|
694
693
|
testData.result = 'skipped';
|
|
695
|
-
eventType = 'TestRunFinished';
|
|
696
694
|
}
|
|
697
695
|
return testData;
|
|
698
696
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funnelInstrumentation.d.ts","sourceRoot":"","sources":["../../src/instrumentation/funnelInstrumentation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"funnelInstrumentation.d.ts","sourceRoot":"","sources":["../../src/instrumentation/funnelInstrumentation.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,kBAAkB,MAAM,cAAc,CAAA;AAqBlD,wBAAsB,SAAS,CAAC,MAAM,EAAE,kBAAkB,iBAEzD;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,kBAAkB,iBAE1D;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAOpF;AAGD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAahE"}
|
|
@@ -2,11 +2,11 @@ import os from 'node:os';
|
|
|
2
2
|
import util from 'node:util';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
|
-
import got from 'got';
|
|
6
5
|
import UsageStats from '../testOps/usageStats.js';
|
|
7
6
|
import { BStackLogger } from '../bstackLogger.js';
|
|
8
7
|
import { BSTACK_SERVICE_VERSION, FUNNEL_INSTRUMENTATION_URL } from '../constants.js';
|
|
9
|
-
import { getDataFromWorkers
|
|
8
|
+
import { getDataFromWorkers } from '../data-store.js';
|
|
9
|
+
import fetchWrap from '../fetchWrapper.js';
|
|
10
10
|
async function fireFunnelTestEvent(eventType, config) {
|
|
11
11
|
if (!config.userName || !config.accessKey) {
|
|
12
12
|
BStackLogger.debug('username/accesskey not passed');
|
|
@@ -16,17 +16,13 @@ async function fireFunnelTestEvent(eventType, config) {
|
|
|
16
16
|
const data = buildEventData(eventType, config);
|
|
17
17
|
await fireFunnelRequest(data);
|
|
18
18
|
BStackLogger.debug('Funnel event success');
|
|
19
|
-
|
|
20
|
-
config.sentFunnelData();
|
|
21
|
-
}
|
|
19
|
+
config.sentFunnelData();
|
|
22
20
|
}
|
|
23
21
|
catch (error) {
|
|
24
22
|
BStackLogger.debug('Exception in sending funnel data: ' + error);
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
export async function sendStart(config) {
|
|
28
|
-
// Remove Workers folder if exists
|
|
29
|
-
removeWorkersDataDir();
|
|
30
26
|
await fireFunnelTestEvent('SDKTestAttempted', config);
|
|
31
27
|
}
|
|
32
28
|
export async function sendFinish(config) {
|
|
@@ -42,11 +38,16 @@ export function saveFunnelData(eventType, config) {
|
|
|
42
38
|
// Called from two different process
|
|
43
39
|
export async function fireFunnelRequest(data) {
|
|
44
40
|
BStackLogger.debug('Sending SDK event with data ' + util.inspect(data, { depth: 6 }));
|
|
45
|
-
|
|
41
|
+
const encodedAuth = Buffer.from(`${data.userName}:${data.accessKey}`, 'utf8').toString('base64');
|
|
42
|
+
const response = await fetchWrap(FUNNEL_INSTRUMENTATION_URL, {
|
|
43
|
+
method: 'POST',
|
|
46
44
|
headers: {
|
|
47
|
-
'content-type': 'application/json'
|
|
48
|
-
|
|
45
|
+
'content-type': 'application/json',
|
|
46
|
+
Authorization: `Basic ${encodedAuth}`,
|
|
47
|
+
},
|
|
48
|
+
body: JSON.stringify(data)
|
|
49
49
|
});
|
|
50
|
+
BStackLogger.debug('Funnel Event Response: ' + JSON.stringify(await response.text()));
|
|
50
51
|
}
|
|
51
52
|
function getProductList(config) {
|
|
52
53
|
const products = [];
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAKlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS,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