@wdio/browserstack-service 7.33.0 → 7.35.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 +34 -0
- package/build/Percy/Percy-Handler.d.ts.map +1 -0
- package/build/Percy/Percy-Handler.js +187 -0
- package/build/Percy/Percy.d.ts +24 -0
- package/build/Percy/Percy.d.ts.map +1 -0
- package/build/Percy/Percy.js +128 -0
- package/build/Percy/PercyBinary.d.ts +17 -0
- package/build/Percy/PercyBinary.d.ts.map +1 -0
- package/build/Percy/PercyBinary.js +151 -0
- package/build/Percy/PercyCaptureMap.d.ts +9 -0
- package/build/Percy/PercyCaptureMap.d.ts.map +1 -0
- package/build/Percy/PercyCaptureMap.js +46 -0
- package/build/Percy/PercyHelper.d.ts +8 -0
- package/build/Percy/PercyHelper.d.ts.map +1 -0
- package/build/Percy/PercyHelper.js +78 -0
- package/build/Percy/PercyLogger.d.ts +15 -0
- package/build/Percy/PercyLogger.d.ts.map +1 -0
- package/build/Percy/PercyLogger.js +76 -0
- package/build/Percy/PercySDK.d.ts +4 -0
- package/build/Percy/PercySDK.d.ts.map +1 -0
- package/build/Percy/PercySDK.js +42 -0
- package/build/cleanup.d.ts +5 -0
- package/build/cleanup.d.ts.map +1 -0
- package/build/cleanup.js +23 -0
- package/build/constants.d.ts +3 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +12 -1
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +15 -1
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +1 -0
- package/build/launcher.d.ts +9 -2
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +80 -0
- package/build/request-handler.d.ts +1 -0
- package/build/request-handler.d.ts.map +1 -1
- package/build/request-handler.js +5 -0
- package/build/service.d.ts +3 -0
- package/build/service.d.ts.map +1 -1
- package/build/service.js +64 -17
- package/build/types.d.ts +24 -0
- package/build/types.d.ts.map +1 -1
- package/build/util.d.ts +18 -1
- package/build/util.d.ts.map +1 -1
- package/build/util.js +159 -12
- package/package.json +7 -4
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ======= Percy helper methods start =======
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getBestPlatformForPercySnapshot = exports.stopPercy = exports.startPercy = void 0;
|
|
8
|
+
const PercyLogger_1 = require("./PercyLogger");
|
|
9
|
+
const Percy_1 = __importDefault(require("./Percy"));
|
|
10
|
+
const startPercy = async (options, config, bsConfig) => {
|
|
11
|
+
PercyLogger_1.PercyLogger.debug('Starting percy');
|
|
12
|
+
const percy = new Percy_1.default(options, config, bsConfig);
|
|
13
|
+
const response = await percy.start();
|
|
14
|
+
if (response) {
|
|
15
|
+
return percy;
|
|
16
|
+
}
|
|
17
|
+
return {};
|
|
18
|
+
};
|
|
19
|
+
exports.startPercy = startPercy;
|
|
20
|
+
const stopPercy = async (percy) => {
|
|
21
|
+
PercyLogger_1.PercyLogger.debug('Stopping percy');
|
|
22
|
+
return percy.stop();
|
|
23
|
+
};
|
|
24
|
+
exports.stopPercy = stopPercy;
|
|
25
|
+
const getBestPlatformForPercySnapshot = (capabilities) => {
|
|
26
|
+
try {
|
|
27
|
+
const percyBrowserPreference = { 'chrome': 0, 'firefox': 1, 'edge': 2, 'safari': 3 };
|
|
28
|
+
let bestPlatformCaps = null;
|
|
29
|
+
let bestBrowser = null;
|
|
30
|
+
if (Array.isArray(capabilities)) {
|
|
31
|
+
capabilities
|
|
32
|
+
.flatMap((c) => {
|
|
33
|
+
if (Object.values(c).length > 0 && Object.values(c).every(c => typeof c === 'object' && c.capabilities)) {
|
|
34
|
+
return Object.values(c).map((o) => o.capabilities);
|
|
35
|
+
}
|
|
36
|
+
return c;
|
|
37
|
+
}).forEach((capability) => {
|
|
38
|
+
var _a;
|
|
39
|
+
let currBrowserName = capability.browserName;
|
|
40
|
+
if (capability['bstack:options']) {
|
|
41
|
+
currBrowserName = capability['bstack:options'].browserName || currBrowserName;
|
|
42
|
+
}
|
|
43
|
+
if (!bestBrowser || !bestPlatformCaps || (bestPlatformCaps.deviceName || ((_a = bestPlatformCaps['bstack:options']) === null || _a === void 0 ? void 0 : _a.deviceName))) {
|
|
44
|
+
bestBrowser = currBrowserName;
|
|
45
|
+
bestPlatformCaps = capability;
|
|
46
|
+
}
|
|
47
|
+
else if (currBrowserName && percyBrowserPreference[currBrowserName.toLowerCase()] < percyBrowserPreference[bestBrowser.toLowerCase()]) {
|
|
48
|
+
bestBrowser = currBrowserName;
|
|
49
|
+
bestPlatformCaps = capability;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return bestPlatformCaps;
|
|
53
|
+
}
|
|
54
|
+
else if (typeof capabilities === 'object') {
|
|
55
|
+
Object.entries(capabilities).forEach(([, caps]) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
let currBrowserName = caps.capabilities.browserName;
|
|
58
|
+
if (caps.capabilities['bstack:options']) {
|
|
59
|
+
currBrowserName = ((_a = caps.capabilities['bstack:options']) === null || _a === void 0 ? void 0 : _a.browserName) || currBrowserName;
|
|
60
|
+
}
|
|
61
|
+
if (!bestBrowser || !bestPlatformCaps || (bestPlatformCaps.deviceName || ((_b = bestPlatformCaps['bstack:options']) === null || _b === void 0 ? void 0 : _b.deviceName))) {
|
|
62
|
+
bestBrowser = currBrowserName;
|
|
63
|
+
bestPlatformCaps = caps.capabilities;
|
|
64
|
+
}
|
|
65
|
+
else if (currBrowserName && percyBrowserPreference[currBrowserName.toLowerCase()] < percyBrowserPreference[bestBrowser.toLowerCase()]) {
|
|
66
|
+
bestBrowser = currBrowserName;
|
|
67
|
+
bestPlatformCaps = caps.capabilities;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return bestPlatformCaps;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
PercyLogger_1.PercyLogger.error(`Error while trying to determine best platform for Percy snapshot ${err}`);
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
exports.getBestPlatformForPercySnapshot = getBestPlatformForPercySnapshot;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class PercyLogger {
|
|
2
|
+
static logFilePath: string;
|
|
3
|
+
private static logFolderPath;
|
|
4
|
+
private static logFileStream;
|
|
5
|
+
static logToFile(logMessage: string, logLevel: string): void;
|
|
6
|
+
private static formatLog;
|
|
7
|
+
static info(message: string): void;
|
|
8
|
+
static error(message: string): void;
|
|
9
|
+
static debug(message: string, param?: any): void;
|
|
10
|
+
static warn(message: string): void;
|
|
11
|
+
static trace(message: string): void;
|
|
12
|
+
static clearLogger(): void;
|
|
13
|
+
static clearLogFile(): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=PercyLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PercyLogger.d.ts","sourceRoot":"","sources":["../../src/Percy/PercyLogger.ts"],"names":[],"mappings":"AASA,qBAAa,WAAW;IACpB,OAAc,WAAW,SAA4C;IACrE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAmC;IAC/D,OAAO,CAAC,MAAM,CAAC,aAAa,CAAuB;IAEnD,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAgBrD,OAAO,CAAC,MAAM,CAAC,SAAS;WAIV,IAAI,CAAC,OAAO,EAAE,MAAM;WAKpB,KAAK,CAAC,OAAO,EAAE,MAAM;WAKrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;WASlC,IAAI,CAAC,OAAO,EAAE,MAAM;WAKpB,KAAK,CAAC,OAAO,EAAE,MAAM;WAKrB,WAAW;WAOX,YAAY;CAS7B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PercyLogger = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
10
|
+
const constants_1 = require("../constants");
|
|
11
|
+
const log = (0, logger_1.default)('@wdio/browserstack-service');
|
|
12
|
+
class PercyLogger {
|
|
13
|
+
static logToFile(logMessage, logLevel) {
|
|
14
|
+
try {
|
|
15
|
+
if (!this.logFileStream) {
|
|
16
|
+
if (!node_fs_1.default.existsSync(this.logFolderPath)) {
|
|
17
|
+
node_fs_1.default.mkdirSync(this.logFolderPath);
|
|
18
|
+
}
|
|
19
|
+
this.logFileStream = node_fs_1.default.createWriteStream(this.logFilePath, { flags: 'a' });
|
|
20
|
+
}
|
|
21
|
+
if (this.logFileStream && this.logFileStream.writable) {
|
|
22
|
+
this.logFileStream.write(this.formatLog(logMessage, logLevel));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
log.debug(`Failed to log to file. Error ${error}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
static formatLog(logMessage, level) {
|
|
30
|
+
return `${new Date().toISOString()} ${level.toUpperCase()} @wdio/browserstack-service ${logMessage}\n`;
|
|
31
|
+
}
|
|
32
|
+
static info(message) {
|
|
33
|
+
this.logToFile(message, 'info');
|
|
34
|
+
log.info(message);
|
|
35
|
+
}
|
|
36
|
+
static error(message) {
|
|
37
|
+
this.logToFile(message, 'error');
|
|
38
|
+
log.error(message);
|
|
39
|
+
}
|
|
40
|
+
static debug(message, param) {
|
|
41
|
+
this.logToFile(message, 'debug');
|
|
42
|
+
if (param) {
|
|
43
|
+
log.debug(message, param);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
log.debug(message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
static warn(message) {
|
|
50
|
+
this.logToFile(message, 'warn');
|
|
51
|
+
log.warn(message);
|
|
52
|
+
}
|
|
53
|
+
static trace(message) {
|
|
54
|
+
this.logToFile(message, 'trace');
|
|
55
|
+
log.trace(message);
|
|
56
|
+
}
|
|
57
|
+
static clearLogger() {
|
|
58
|
+
if (this.logFileStream) {
|
|
59
|
+
this.logFileStream.end();
|
|
60
|
+
}
|
|
61
|
+
this.logFileStream = null;
|
|
62
|
+
}
|
|
63
|
+
static clearLogFile() {
|
|
64
|
+
try {
|
|
65
|
+
if (node_fs_1.default.existsSync(this.logFilePath)) {
|
|
66
|
+
node_fs_1.default.truncateSync(this.logFilePath);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
log.error(`Failed to clear percy.log file. Error ${err}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.PercyLogger = PercyLogger;
|
|
75
|
+
PercyLogger.logFilePath = node_path_1.default.join(process.cwd(), constants_1.PERCY_LOGS_FILE);
|
|
76
|
+
PercyLogger.logFolderPath = node_path_1.default.join(process.cwd(), 'logs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PercySDK.d.ts","sourceRoot":"","sources":["../../src/Percy/PercySDK.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,QAAQ,YAVW,GAAG,EAAE,SAUE,CAAA;AASvC,eAAO,MAAM,UAAU,YANiB,GAAG,EAAE,kBAMF,CAAA;AAS3C,eAAO,MAAM,aAAa,YANiB,GAAG,EAAE,kBAMC,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.screenshotApp = exports.screenshot = exports.snapshot = void 0;
|
|
4
|
+
const tryRequire = function (pkg, fallback) {
|
|
5
|
+
try {
|
|
6
|
+
return require(pkg);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return fallback;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const percySnapshot = tryRequire('@percy/selenium-webdriver', null);
|
|
13
|
+
const percyAppScreenshot = tryRequire('@percy/appium-app', {});
|
|
14
|
+
const PercyLogger_1 = require("./PercyLogger");
|
|
15
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
16
|
+
let snapshotHandler = (...args) => {
|
|
17
|
+
PercyLogger_1.PercyLogger.error('Unsupported driver for percy');
|
|
18
|
+
};
|
|
19
|
+
if (percySnapshot) {
|
|
20
|
+
snapshotHandler = (browser, name) => {
|
|
21
|
+
if (process.env.PERCY_SNAPSHOT === 'true') {
|
|
22
|
+
return percySnapshot(browser, name);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.snapshot = snapshotHandler;
|
|
27
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
28
|
+
let screenshotHandler = async (...args) => {
|
|
29
|
+
PercyLogger_1.PercyLogger.error('Unsupported driver for percy');
|
|
30
|
+
};
|
|
31
|
+
if (percySnapshot && percySnapshot.percyScreenshot) {
|
|
32
|
+
screenshotHandler = percySnapshot.percyScreenshot;
|
|
33
|
+
}
|
|
34
|
+
exports.screenshot = screenshotHandler;
|
|
35
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
36
|
+
let screenshotAppHandler = async (...args) => {
|
|
37
|
+
PercyLogger_1.PercyLogger.error('Unsupported driver for percy');
|
|
38
|
+
};
|
|
39
|
+
if (percyAppScreenshot) {
|
|
40
|
+
screenshotAppHandler = percyAppScreenshot;
|
|
41
|
+
}
|
|
42
|
+
exports.screenshotApp = screenshotAppHandler;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../src/cleanup.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,aAAa;IAC9B,MAAM,CAAC,YAAY;IAGnB,MAAM,CAAC,2BAA2B;CAarC"}
|
package/build/cleanup.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const util_1 = require("./util");
|
|
4
|
+
class BStackCleanup {
|
|
5
|
+
static startCleanup() {
|
|
6
|
+
this.executeObservabilityCleanup();
|
|
7
|
+
}
|
|
8
|
+
static executeObservabilityCleanup() {
|
|
9
|
+
if (!process.env.BS_TESTOPS_JWT) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
console.log('Executing observability cleanup');
|
|
13
|
+
(0, util_1.stopBuildUpstream)().then(() => {
|
|
14
|
+
if (process.env.BS_TESTOPS_BUILD_HASHED_ID) {
|
|
15
|
+
console.log(`\nVisit https://observability.browserstack.com/builds/${process.env.BS_TESTOPS_BUILD_HASHED_ID} to view build report, insights, and many more debugging information all at one place!\n`);
|
|
16
|
+
}
|
|
17
|
+
}).catch((err) => {
|
|
18
|
+
console.error(err);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = BStackCleanup;
|
|
23
|
+
BStackCleanup.startCleanup();
|
package/build/constants.d.ts
CHANGED
|
@@ -14,4 +14,7 @@ export declare const DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS = 5000;
|
|
|
14
14
|
export declare const DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = 100;
|
|
15
15
|
export declare const ACCESSIBILITY_API_URL = "https://accessibility.browserstack.com/api";
|
|
16
16
|
export declare const NOT_ALLOWED_KEYS_IN_CAPS: string[];
|
|
17
|
+
export declare const PERCY_LOGS_FILE = "logs/percy.log";
|
|
18
|
+
export declare const PERCY_DOM_CHANGING_COMMANDS_ENDPOINTS: string[];
|
|
19
|
+
export declare const CAPTURE_MODES: string[];
|
|
17
20
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,mBAAmB,qHAStB,CAAA;AAEV,eAAO,MAAM,mBAAmB,UAI/B,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,kBAAkB,CAKvD,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,OAAO,OAAoC,CAAA;AACvE,eAAO,MAAM,aAAa,qDAAqD,CAAA;AAC/E,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AACjD,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AACjD,eAAO,MAAM,wBAAwB,uBAAuB,CAAA;AAC5D,eAAO,MAAM,eAAe,OAAO,CAAA;AACnC,eAAO,MAAM,mBAAmB,OAAO,CAAA;AACvC,eAAO,MAAM,iBAAiB,UAAgH,CAAA;AAC9I,eAAO,MAAM,wCAAwC,OAAO,CAAA;AAC5D,eAAO,MAAM,yCAAyC,MAAM,CAAA;AAE5D,eAAO,MAAM,qBAAqB,+CAA+C,CAAA;AACjF,eAAO,MAAM,wBAAwB,UAA6D,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,mBAAmB,qHAStB,CAAA;AAEV,eAAO,MAAM,mBAAmB,UAI/B,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,kBAAkB,CAKvD,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,OAAO,OAAoC,CAAA;AACvE,eAAO,MAAM,aAAa,qDAAqD,CAAA;AAC/E,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AACjD,eAAO,MAAM,mBAAmB,iBAAiB,CAAA;AACjD,eAAO,MAAM,wBAAwB,uBAAuB,CAAA;AAC5D,eAAO,MAAM,eAAe,OAAO,CAAA;AACnC,eAAO,MAAM,mBAAmB,OAAO,CAAA;AACvC,eAAO,MAAM,iBAAiB,UAAgH,CAAA;AAC9I,eAAO,MAAM,wCAAwC,OAAO,CAAA;AAC5D,eAAO,MAAM,yCAAyC,MAAM,CAAA;AAE5D,eAAO,MAAM,qBAAqB,+CAA+C,CAAA;AACjF,eAAO,MAAM,wBAAwB,UAA6D,CAAA;AAElG,eAAO,MAAM,eAAe,mBAAmB,CAAA;AAE/C,eAAO,MAAM,qCAAqC,UAQjD,CAAA;AAED,eAAO,MAAM,aAAa,UAAwD,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NOT_ALLOWED_KEYS_IN_CAPS = exports.ACCESSIBILITY_API_URL = exports.DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = exports.DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS = exports.BATCH_EVENT_TYPES = exports.DATA_BATCH_INTERVAL = exports.DATA_BATCH_SIZE = exports.DATA_SCREENSHOT_ENDPOINT = exports.DATA_BATCH_ENDPOINT = exports.DATA_EVENT_ENDPOINT = exports.DATA_ENDPOINT = exports.consoleHolder = exports.DEFAULT_OPTIONS = exports.VALID_APP_EXTENSION = exports.BROWSER_DESCRIPTION = void 0;
|
|
3
|
+
exports.CAPTURE_MODES = exports.PERCY_DOM_CHANGING_COMMANDS_ENDPOINTS = exports.PERCY_LOGS_FILE = exports.NOT_ALLOWED_KEYS_IN_CAPS = exports.ACCESSIBILITY_API_URL = exports.DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = exports.DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS = exports.BATCH_EVENT_TYPES = exports.DATA_BATCH_INTERVAL = exports.DATA_BATCH_SIZE = exports.DATA_SCREENSHOT_ENDPOINT = exports.DATA_BATCH_ENDPOINT = exports.DATA_EVENT_ENDPOINT = exports.DATA_ENDPOINT = exports.consoleHolder = exports.DEFAULT_OPTIONS = exports.VALID_APP_EXTENSION = exports.BROWSER_DESCRIPTION = void 0;
|
|
4
4
|
exports.BROWSER_DESCRIPTION = [
|
|
5
5
|
'device',
|
|
6
6
|
'os',
|
|
@@ -34,3 +34,14 @@ exports.DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS = 5000; // 5s
|
|
|
34
34
|
exports.DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = 100; // 100ms
|
|
35
35
|
exports.ACCESSIBILITY_API_URL = 'https://accessibility.browserstack.com/api';
|
|
36
36
|
exports.NOT_ALLOWED_KEYS_IN_CAPS = ['includeTagsInTestingScope', 'excludeTagsInTestingScope'];
|
|
37
|
+
exports.PERCY_LOGS_FILE = 'logs/percy.log';
|
|
38
|
+
exports.PERCY_DOM_CHANGING_COMMANDS_ENDPOINTS = [
|
|
39
|
+
'/session/:sessionId/url',
|
|
40
|
+
'/session/:sessionId/forward',
|
|
41
|
+
'/session/:sessionId/back',
|
|
42
|
+
'/session/:sessionId/refresh',
|
|
43
|
+
'/session/:sessionId/screenshot',
|
|
44
|
+
'/session/:sessionId/actions',
|
|
45
|
+
'/session/:sessionId/appium/device/shake'
|
|
46
|
+
];
|
|
47
|
+
exports.CAPTURE_MODES = ['click', 'auto', 'screenshot', 'manual', 'testcase'];
|
package/build/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare const log4jsAppender: {
|
|
|
8
8
|
configure: (config: any, layouts: any) => Function;
|
|
9
9
|
};
|
|
10
10
|
export declare const BStackTestOpsLogger: typeof logReportingAPI;
|
|
11
|
+
import * as Percy from './Percy/PercySDK';
|
|
12
|
+
export declare const PercySDK: typeof Percy;
|
|
11
13
|
export * from './types';
|
|
12
14
|
declare global {
|
|
13
15
|
namespace WebdriverIO {
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,MAAM,YAAY,CAAA;AAC7C,OAAO,mBAAmB,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,eAAe,mBAAmB,CAAA;AAClC,eAAO,MAAM,QAAQ,6BAAuB,CAAA;AAC5C,eAAO,MAAM,cAAc;;CAAgB,CAAA;AAC3C,eAAO,MAAM,mBAAmB,wBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,MAAM,YAAY,CAAA;AAC7C,OAAO,mBAAmB,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAE/C,eAAe,mBAAmB,CAAA;AAClC,eAAO,MAAM,QAAQ,6BAAuB,CAAA;AAC5C,eAAO,MAAM,cAAc;;CAAgB,CAAA;AAC3C,eAAO,MAAM,mBAAmB,wBAAkB,CAAA;AAElD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,eAAO,MAAM,QAAQ,cAAQ,CAAA;AAE7B,cAAc,SAAS,CAAA;AAEvB,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,aAAc,SAAQ,kBAAkB;SAAG;KACxD;CACJ"}
|
package/build/index.js
CHANGED
|
@@ -11,6 +11,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
11
11
|
if (k2 === undefined) k2 = k;
|
|
12
12
|
o[k2] = m[k];
|
|
13
13
|
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
14
26
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
27
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
28
|
};
|
|
@@ -18,7 +30,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
30
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
31
|
};
|
|
20
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.BStackTestOpsLogger = exports.log4jsAppender = exports.launcher = void 0;
|
|
33
|
+
exports.PercySDK = exports.BStackTestOpsLogger = exports.log4jsAppender = exports.launcher = void 0;
|
|
22
34
|
const launcher_1 = __importDefault(require("./launcher"));
|
|
23
35
|
const service_1 = __importDefault(require("./service"));
|
|
24
36
|
const log4jsAppender_1 = require("./log4jsAppender");
|
|
@@ -27,4 +39,6 @@ exports.default = service_1.default;
|
|
|
27
39
|
exports.launcher = launcher_1.default;
|
|
28
40
|
exports.log4jsAppender = { configure: log4jsAppender_1.configure };
|
|
29
41
|
exports.BStackTestOpsLogger = logReportingAPI_1.default;
|
|
42
|
+
const Percy = __importStar(require("./Percy/PercySDK"));
|
|
43
|
+
exports.PercySDK = Percy;
|
|
30
44
|
__exportStar(require("./types"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAIzE,OAAO,KAAK,EAAiB,OAAO,EAAE,QAAQ,EAAsB,YAAY,EAAE,kBAAkB,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAoB9J,OAAO,KAAK,EAAY,QAAQ,EAA4B,cAAc,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAMnG,cAAM,gBAAgB;IAgBL,OAAO,CAAC,QAAQ;IAAwI,OAAO,CAAC,UAAU,CAAC;IAdxL,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,aAAa,CAAC,CAAc;IACpC,OAAO,CAAC,SAAS,CAA2D;IAC5E,OAAO,CAAC,cAAc,CAAC,CAAQ;IAC/B,OAAO,CAAC,oBAAoB,CAAoC;IAChE,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,YAAY,CAAqB;IACzC,OAAO,CAAC,aAAa,CAIpB;gBAEoB,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,EAAU,UAAU,CAAC,oBAAQ;IAehM,iB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5B,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,CAAC,UAAU;IAoDnG,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,aAAa;CAMxB;AAGD,QAAA,MAAM,eAAe,EAAE,OAAO,gBAA0D,CAAA;AACxF,KAAK,eAAe,GAAG,gBAAgB,CAAA;AAEvC,eAAe,eAAe,CAAA"}
|
package/build/launcher.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as BrowserstackLocalLauncher from 'browserstack-local';
|
|
2
2
|
import type { Capabilities, Services, Options } from '@wdio/types';
|
|
3
|
-
import type { App, AppConfig, AppUploadResponse, BrowserstackConfig } from './types';
|
|
3
|
+
import type { App, AppConfig, AppUploadResponse, BrowserstackConfig, UserConfig } from './types';
|
|
4
4
|
type BrowserstackLocal = BrowserstackLocalLauncher.Local & {
|
|
5
5
|
pid?: number;
|
|
6
|
-
stop(callback: (err?:
|
|
6
|
+
stop(callback: (err?: Error) => void): void;
|
|
7
7
|
};
|
|
8
8
|
export default class BrowserstackLauncherService implements Services.ServiceInstance {
|
|
9
9
|
private _options;
|
|
@@ -14,9 +14,16 @@ export default class BrowserstackLauncherService implements Services.ServiceInst
|
|
|
14
14
|
private _buildTag?;
|
|
15
15
|
private _buildIdentifier?;
|
|
16
16
|
private _accessibilityAutomation?;
|
|
17
|
+
private _percy?;
|
|
18
|
+
private _percyBestPlatformCaps?;
|
|
19
|
+
_testOpsBuildStopped?: boolean;
|
|
17
20
|
constructor(_options: BrowserstackConfig & Options.Testrunner, capabilities: Capabilities.RemoteCapability, _config: Options.Testrunner);
|
|
21
|
+
onWorkerStart(cid: any, caps: any): Promise<void>;
|
|
22
|
+
setupExitHandlers(): void;
|
|
18
23
|
onPrepare(config?: Options.Testrunner, capabilities?: Capabilities.RemoteCapabilities): Promise<unknown>;
|
|
19
24
|
onComplete(): Promise<unknown>;
|
|
25
|
+
setupPercy(options: BrowserstackConfig & Options.Testrunner, config: Options.Testrunner, bsConfig: UserConfig): Promise<void>;
|
|
26
|
+
stopPercy(): Promise<void>;
|
|
20
27
|
_uploadApp(app: App): Promise<AppUploadResponse>;
|
|
21
28
|
/**
|
|
22
29
|
* @param {String | AppConfig} appConfig <string>: should be "app file path" or "app_url" or "custom_id" or "shareable_id".
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAOlE,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAqBhG,KAAK,iBAAiB,GAAG,yBAAyB,CAAC,KAAK,GAAG;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;CAC/C,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,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sBAAsB,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,SAAS,CAAC,EAAC,MAAM,EAAE,eAAe,CAAC,EAAC,MAAM;CAQtF"}
|
package/build/launcher.js
CHANGED
|
@@ -36,18 +36,23 @@ const os_1 = __importDefault(require("os"));
|
|
|
36
36
|
const webdriverio_1 = require("webdriverio");
|
|
37
37
|
const BrowserstackLocalLauncher = __importStar(require("browserstack-local"));
|
|
38
38
|
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
39
|
+
const node_child_process_1 = require("node:child_process");
|
|
39
40
|
// @ts-ignore
|
|
40
41
|
const package_json_1 = require("../package.json");
|
|
41
42
|
const crash_reporter_1 = __importDefault(require("./crash-reporter"));
|
|
43
|
+
const PercyHelper_1 = require("./Percy/PercyHelper");
|
|
42
44
|
const constants_1 = require("./constants");
|
|
43
45
|
const util_2 = require("./util");
|
|
44
46
|
const performance_tester_1 = __importDefault(require("./performance-tester"));
|
|
47
|
+
const PercyLogger_1 = require("./Percy/PercyLogger");
|
|
45
48
|
const log = (0, logger_1.default)('@wdio/browserstack-service');
|
|
46
49
|
class BrowserstackLauncherService {
|
|
47
50
|
constructor(_options, capabilities, _config) {
|
|
48
51
|
this._options = _options;
|
|
49
52
|
this._config = _config;
|
|
53
|
+
PercyLogger_1.PercyLogger.clearLogFile();
|
|
50
54
|
// added to maintain backward compatibility with webdriverIO v5
|
|
55
|
+
this.setupExitHandlers();
|
|
51
56
|
this._config || (this._config = _options);
|
|
52
57
|
if (Array.isArray(capabilities)) {
|
|
53
58
|
capabilities.forEach((capability) => {
|
|
@@ -141,6 +146,28 @@ class BrowserstackLauncherService {
|
|
|
141
146
|
log.error(`[Crash_Report_Upload] Config processing failed due to ${error}`);
|
|
142
147
|
}
|
|
143
148
|
}
|
|
149
|
+
async onWorkerStart(cid, caps) {
|
|
150
|
+
try {
|
|
151
|
+
if (this._options.percy && this._percyBestPlatformCaps) {
|
|
152
|
+
const isThisBestPercyPlatform = (0, util_2.ObjectsAreEqual)(caps, this._percyBestPlatformCaps);
|
|
153
|
+
if (isThisBestPercyPlatform) {
|
|
154
|
+
process.env.BEST_PLATFORM_CID = cid;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
PercyLogger_1.PercyLogger.error(`Error while setting best platform for Percy snapshot at worker start ${err}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
setupExitHandlers() {
|
|
163
|
+
process.on('exit', (code) => {
|
|
164
|
+
if (!!process.env.BS_TESTOPS_JWT && !this._testOpsBuildStopped) {
|
|
165
|
+
const childProcess = (0, node_child_process_1.spawn)('node', [`${path_1.default.join(__dirname, 'cleanup.js')}`], { detached: true, stdio: 'inherit', env: { ...process.env } });
|
|
166
|
+
childProcess.unref();
|
|
167
|
+
process.exit(code);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
144
171
|
async onPrepare(config, capabilities) {
|
|
145
172
|
/**
|
|
146
173
|
* Upload app to BrowserStack if valid file path to app is given.
|
|
@@ -228,6 +255,18 @@ class BrowserstackLauncherService {
|
|
|
228
255
|
buildIdentifier: this._buildIdentifier
|
|
229
256
|
});
|
|
230
257
|
}
|
|
258
|
+
if (this._options.percy) {
|
|
259
|
+
try {
|
|
260
|
+
const bestPlatformPercyCaps = (0, PercyHelper_1.getBestPlatformForPercySnapshot)(capabilities);
|
|
261
|
+
this._percyBestPlatformCaps = bestPlatformPercyCaps;
|
|
262
|
+
await this.setupPercy(this._options, this._config, {
|
|
263
|
+
projectName: this._projectName
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
PercyLogger_1.PercyLogger.error(`Error while setting up Percy ${err}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
231
270
|
if (!this._options.browserstackLocal) {
|
|
232
271
|
return log.info('browserstackLocal is not enabled - skipping...');
|
|
233
272
|
}
|
|
@@ -279,6 +318,7 @@ class BrowserstackLauncherService {
|
|
|
279
318
|
await (0, util_2.stopBuildUpstream)();
|
|
280
319
|
if (process.env.BS_TESTOPS_BUILD_HASHED_ID) {
|
|
281
320
|
console.log(`\nVisit https://observability.browserstack.com/builds/${process.env.BS_TESTOPS_BUILD_HASHED_ID} to view build report, insights, and many more debugging information all at one place!\n`);
|
|
321
|
+
this._testOpsBuildStopped = true;
|
|
282
322
|
}
|
|
283
323
|
}
|
|
284
324
|
if (process.env.BROWSERSTACK_O11Y_PERF_MEASUREMENT) {
|
|
@@ -290,6 +330,10 @@ class BrowserstackLauncherService {
|
|
|
290
330
|
const duration = (new Date()).getTime() - (new Date(process.env.START_TIME)).getTime();
|
|
291
331
|
log.info(`Total duration is ${duration / 1000} s`);
|
|
292
332
|
}
|
|
333
|
+
if (this._options.percy) {
|
|
334
|
+
await this.stopPercy();
|
|
335
|
+
}
|
|
336
|
+
PercyLogger_1.PercyLogger.clearLogger();
|
|
293
337
|
if (!this.browserstackLocal || !this.browserstackLocal.isRunning()) {
|
|
294
338
|
return;
|
|
295
339
|
}
|
|
@@ -319,6 +363,42 @@ class BrowserstackLauncherService {
|
|
|
319
363
|
return Promise.reject(err);
|
|
320
364
|
});
|
|
321
365
|
}
|
|
366
|
+
async setupPercy(options, config, bsConfig) {
|
|
367
|
+
var _a;
|
|
368
|
+
if ((_a = this._percy) === null || _a === void 0 ? void 0 : _a.isRunning()) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
try {
|
|
372
|
+
this._percy = await (0, PercyHelper_1.startPercy)(options, config, bsConfig);
|
|
373
|
+
if (!this._percy) {
|
|
374
|
+
throw new Error('Could not start percy, check percy logs for info.');
|
|
375
|
+
}
|
|
376
|
+
PercyLogger_1.PercyLogger.info('Percy started successfully');
|
|
377
|
+
let signal = 0;
|
|
378
|
+
const handler = async () => {
|
|
379
|
+
signal++;
|
|
380
|
+
signal === 1 && await this.stopPercy();
|
|
381
|
+
};
|
|
382
|
+
process.on('beforeExit', handler);
|
|
383
|
+
process.on('SIGINT', handler);
|
|
384
|
+
process.on('SIGTERM', handler);
|
|
385
|
+
}
|
|
386
|
+
catch (err) {
|
|
387
|
+
PercyLogger_1.PercyLogger.debug(`Error in percy setup ${err}`);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
async stopPercy() {
|
|
391
|
+
if (!this._percy || !this._percy.isRunning()) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
try {
|
|
395
|
+
await (0, PercyHelper_1.stopPercy)(this._percy);
|
|
396
|
+
PercyLogger_1.PercyLogger.info('Percy stopped');
|
|
397
|
+
}
|
|
398
|
+
catch (err) {
|
|
399
|
+
PercyLogger_1.PercyLogger.error(`Error occured while stopping percy : ${err}`);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
322
402
|
async _uploadApp(app) {
|
|
323
403
|
log.info(`uploading app ${app.app} ${app.customId ? `and custom_id: ${app.customId}` : ''} to browserstack`);
|
|
324
404
|
const form = new form_data_1.default();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-handler.d.ts","sourceRoot":"","sources":["../src/request-handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAKzC,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACpC,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,sBAAsB,CAAC,CAAgC;IACxD,cAAc,SAAI;
|
|
1
|
+
{"version":3,"file":"request-handler.d.ts","sourceRoot":"","sources":["../src/request-handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAKzC,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACpC,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,sBAAsB,CAAC,CAAgC;IACxD,cAAc,SAAI;IAClB,eAAe,UAAQ;IAE9B,MAAM,CAAC,QAAQ,EAAE,mBAAmB,CAAA;IAGpC,OAAO;WAGO,WAAW,IAAI,mBAAmB;IAOhD,KAAK;IAOL,GAAG,CAAE,KAAK,EAAE,UAAU;;;;;;;;;IAuChB,QAAQ;IAQd,sBAAsB;IAUtB,sBAAsB;IAKtB,uBAAuB,CAAE,GAAG,EAAE,MAAM;IAQpC,aAAa;CAOhB"}
|
package/build/request-handler.js
CHANGED
|
@@ -13,6 +13,7 @@ class RequestQueueHandler {
|
|
|
13
13
|
this.queue = [];
|
|
14
14
|
this.started = false;
|
|
15
15
|
this.pendingUploads = 0;
|
|
16
|
+
this.tearDownInvoked = false;
|
|
16
17
|
}
|
|
17
18
|
static getInstance() {
|
|
18
19
|
if (!RequestQueueHandler.instance) {
|
|
@@ -87,6 +88,10 @@ class RequestQueueHandler {
|
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
shouldProceed() {
|
|
91
|
+
if (this.tearDownInvoked) {
|
|
92
|
+
log.debug('Force request-queue shutdown, as test run event is received after teardown');
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
90
95
|
return this.queue.length >= constants_1.DATA_BATCH_SIZE;
|
|
91
96
|
}
|
|
92
97
|
}
|
package/build/service.d.ts
CHANGED
|
@@ -19,6 +19,9 @@ export default class BrowserstackService implements Services.ServiceInstance {
|
|
|
19
19
|
private _insightsHandler?;
|
|
20
20
|
private _accessibility;
|
|
21
21
|
private _accessibilityHandler?;
|
|
22
|
+
private _turboScale;
|
|
23
|
+
private _percy;
|
|
24
|
+
private _percyHandler?;
|
|
22
25
|
constructor(options: BrowserstackConfig & Options.Testrunner, _caps: Capabilities.RemoteCapability, _config: Options.Testrunner);
|
|
23
26
|
_updateCaps(fn: (caps: Capabilities.Capabilities | Capabilities.DesiredCapabilities) => void): void;
|
|
24
27
|
beforeSession(config: Omit<Options.Testrunner, 'capabilities'>): void;
|
package/build/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAA8C,MAAM,SAAS,CAAA;AAKhH,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAiB7F,MAAM,CAAC,OAAO,OAAO,mBAAoB,YAAW,QAAQ,CAAC,eAAe;IAqBpE,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IArBnB,OAAO,CAAC,eAAe,CAAmD;IAC1E,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,iBAAiB,CAAe;IACxC,OAAO,CAAC,gBAAgB,CAA4D;IACpF,OAAO,CAAC,QAAQ,CAAC,CAAgD;IACjE,OAAO,CAAC,WAAW,CAAC,CAAQ;IAC5B,OAAO,CAAC,UAAU,CAAC,CAAQ;IAC3B,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,cAAc,CAAA;IACtB,OAAO,CAAC,YAAY,CAAC,CAA0C;IAC/D,OAAO,CAAC,gBAAgB,CAAC,CAAiB;IAC1C,OAAO,CAAC,cAAc,CAAA;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