@wdio/browserstack-service 8.21.0 → 8.22.1
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/accessibility-handler.d.ts.map +1 -1
- package/build/accessibility-handler.js +14 -15
- package/build/bstackLogger.d.ts +15 -0
- package/build/bstackLogger.d.ts.map +1 -0
- package/build/bstackLogger.js +67 -0
- package/build/constants.d.ts +3 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +3 -0
- package/build/crash-reporter.d.ts.map +1 -1
- package/build/crash-reporter.js +7 -8
- package/build/fileStream.d.ts +11 -0
- package/build/fileStream.d.ts.map +1 -0
- package/build/fileStream.js +12 -0
- package/build/insights-handler.d.ts.map +1 -1
- package/build/insights-handler.js +2 -3
- package/build/launcher.d.ts +2 -0
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +44 -21
- package/build/performance-tester.d.ts.map +1 -1
- package/build/performance-tester.js +5 -6
- package/build/reporter.d.ts.map +1 -1
- package/build/reporter.js +2 -3
- package/build/request-handler.d.ts.map +1 -1
- package/build/request-handler.js +5 -6
- package/build/service.d.ts.map +1 -1
- package/build/service.js +10 -11
- package/build/util.d.ts +4 -1
- package/build/util.d.ts.map +1 -1
- package/build/util.js +76 -46
- package/package.json +6 -5
|
@@ -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":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAiBjE,cAAM,qBAAqB;IASnB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,aAAa;IAErB,OAAO,CAAC,UAAU,CAAC;IACnB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
1
|
-
import
|
|
2
|
-
import { getA11yResultsSummary, getA11yResults, getUniqueIdentifier, getUniqueIdentifierForCucumber, isAccessibilityAutomationSession, isBrowserstackSession, o11yClassErrorHandler, shouldScanTestForAccessibility, validateCapsWithA11y, isTrue, } from './util.js';
|
|
1
|
+
import { getA11yResultsSummary, getA11yResults, getUniqueIdentifier, getUniqueIdentifierForCucumber, isAccessibilityAutomationSession, isBrowserstackSession, o11yClassErrorHandler, shouldScanTestForAccessibility, validateCapsWithA11y, isTrue } from './util.js';
|
|
3
2
|
import { testForceStop, testStartEvent, testStop } from './scripts/test-event-scripts.js';
|
|
4
|
-
|
|
3
|
+
import { BStackLogger } from './bstackLogger.js';
|
|
5
4
|
class _AccessibilityHandler {
|
|
6
5
|
_browser;
|
|
7
6
|
_capabilities;
|
|
@@ -96,7 +95,7 @@ class _AccessibilityHandler {
|
|
|
96
95
|
}
|
|
97
96
|
try {
|
|
98
97
|
if (shouldScanTest) {
|
|
99
|
-
|
|
98
|
+
BStackLogger.info('Setup for Accessibility testing has started. Automate test case execution will begin momentarily.');
|
|
100
99
|
await this.sendTestStartEvent(this._browser);
|
|
101
100
|
}
|
|
102
101
|
else {
|
|
@@ -104,11 +103,11 @@ class _AccessibilityHandler {
|
|
|
104
103
|
}
|
|
105
104
|
this._testMetadata[testIdentifier].accessibilityScanStarted = shouldScanTest;
|
|
106
105
|
if (shouldScanTest) {
|
|
107
|
-
|
|
106
|
+
BStackLogger.info('Automate test case execution has started.');
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
109
|
catch (error) {
|
|
111
|
-
|
|
110
|
+
BStackLogger.error(`Exception in starting accessibility automation scan for this test case ${error}`);
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
113
|
async afterTest(suiteTitle, test) {
|
|
@@ -124,7 +123,7 @@ class _AccessibilityHandler {
|
|
|
124
123
|
return;
|
|
125
124
|
}
|
|
126
125
|
if (shouldScanTestForAccessibility) {
|
|
127
|
-
|
|
126
|
+
BStackLogger.info('Automate test case execution has ended. Processing for accessibility testing is underway. ');
|
|
128
127
|
}
|
|
129
128
|
const dataForExtension = {
|
|
130
129
|
saveResults: shouldScanTestForAccessibility,
|
|
@@ -138,11 +137,11 @@ class _AccessibilityHandler {
|
|
|
138
137
|
};
|
|
139
138
|
await this.sendTestStopEvent(this._browser, dataForExtension);
|
|
140
139
|
if (shouldScanTestForAccessibility) {
|
|
141
|
-
|
|
140
|
+
BStackLogger.info('Accessibility testing for this test case has ended.');
|
|
142
141
|
}
|
|
143
142
|
}
|
|
144
143
|
catch (error) {
|
|
145
|
-
|
|
144
|
+
BStackLogger.error(`Accessibility results could not be processed for the test case ${test.title}. Error : ${error}`);
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
/**
|
|
@@ -163,7 +162,7 @@ class _AccessibilityHandler {
|
|
|
163
162
|
}
|
|
164
163
|
try {
|
|
165
164
|
if (shouldScanScenario) {
|
|
166
|
-
|
|
165
|
+
BStackLogger.info('Setup for Accessibility testing has started. Automate test case execution will begin momentarily.');
|
|
167
166
|
await this.sendTestStartEvent(this._browser);
|
|
168
167
|
}
|
|
169
168
|
else {
|
|
@@ -171,11 +170,11 @@ class _AccessibilityHandler {
|
|
|
171
170
|
}
|
|
172
171
|
this._testMetadata[uniqueId].accessibilityScanStarted = shouldScanScenario;
|
|
173
172
|
if (shouldScanScenario) {
|
|
174
|
-
|
|
173
|
+
BStackLogger.info('Automate test case execution has started.');
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
176
|
catch (error) {
|
|
178
|
-
|
|
177
|
+
BStackLogger.error(`Exception in starting accessibility automation scan for this test case ${error}`);
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
async afterScenario(world) {
|
|
@@ -193,7 +192,7 @@ class _AccessibilityHandler {
|
|
|
193
192
|
return;
|
|
194
193
|
}
|
|
195
194
|
if (shouldScanTestForAccessibility) {
|
|
196
|
-
|
|
195
|
+
BStackLogger.info('Automate test case execution has ended. Processing for accessibility testing is underway. ');
|
|
197
196
|
}
|
|
198
197
|
const dataForExtension = {
|
|
199
198
|
saveResults: shouldScanTestForAccessibility,
|
|
@@ -207,11 +206,11 @@ class _AccessibilityHandler {
|
|
|
207
206
|
};
|
|
208
207
|
await this.sendTestStopEvent(this._browser, dataForExtension);
|
|
209
208
|
if (shouldScanTestForAccessibility) {
|
|
210
|
-
|
|
209
|
+
BStackLogger.info('Accessibility testing for this test case has ended.');
|
|
211
210
|
}
|
|
212
211
|
}
|
|
213
212
|
catch (error) {
|
|
214
|
-
|
|
213
|
+
BStackLogger.error(`Accessibility results could not be processed for the test case ${pickleData.name}. Error : ${error}`);
|
|
215
214
|
}
|
|
216
215
|
}
|
|
217
216
|
/*
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare abstract class BStackLogger {
|
|
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=bstackLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bstackLogger.d.ts","sourceRoot":"","sources":["../src/bstackLogger.ts"],"names":[],"mappings":"AAWA,8BAAsB,YAAY;IAC9B,OAAc,WAAW,SAAsC;IAC/D,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;CAK7B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import logger from '@wdio/logger';
|
|
5
|
+
import { LOGS_FILE } from './constants.js';
|
|
6
|
+
import { COLORS } from './util.js';
|
|
7
|
+
const log = logger('@wdio/browserstack-service');
|
|
8
|
+
export class BStackLogger {
|
|
9
|
+
static logFilePath = path.join(process.cwd(), LOGS_FILE);
|
|
10
|
+
static logFolderPath = path.join(process.cwd(), 'logs');
|
|
11
|
+
static logFileStream;
|
|
12
|
+
static logToFile(logMessage, logLevel) {
|
|
13
|
+
try {
|
|
14
|
+
if (!this.logFileStream) {
|
|
15
|
+
if (!fs.existsSync(this.logFolderPath)) {
|
|
16
|
+
fs.mkdirSync(this.logFolderPath);
|
|
17
|
+
}
|
|
18
|
+
this.logFileStream = fs.createWriteStream(this.logFilePath, { flags: 'a' });
|
|
19
|
+
}
|
|
20
|
+
if (this.logFileStream && this.logFileStream.writable) {
|
|
21
|
+
this.logFileStream.write(this.formatLog(logMessage, logLevel));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
log.debug(`Failed to log to file. Error ${error}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
static formatLog(logMessage, level) {
|
|
29
|
+
return `${chalk.gray(new Date().toISOString())} ${chalk[COLORS[level]](level.toUpperCase())} ${chalk.whiteBright('@wdio/browserstack-service')} ${logMessage}\n`;
|
|
30
|
+
}
|
|
31
|
+
static info(message) {
|
|
32
|
+
this.logToFile(message, 'info');
|
|
33
|
+
log.info(message);
|
|
34
|
+
}
|
|
35
|
+
static error(message) {
|
|
36
|
+
this.logToFile(message, 'error');
|
|
37
|
+
log.error(message);
|
|
38
|
+
}
|
|
39
|
+
static debug(message, param) {
|
|
40
|
+
this.logToFile(message, 'debug');
|
|
41
|
+
if (param) {
|
|
42
|
+
log.debug(message, param);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
log.debug(message);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
static warn(message) {
|
|
49
|
+
this.logToFile(message, 'warn');
|
|
50
|
+
log.warn(message);
|
|
51
|
+
}
|
|
52
|
+
static trace(message) {
|
|
53
|
+
this.logToFile(message, 'trace');
|
|
54
|
+
log.trace(message);
|
|
55
|
+
}
|
|
56
|
+
static clearLogger() {
|
|
57
|
+
if (this.logFileStream) {
|
|
58
|
+
this.logFileStream.end();
|
|
59
|
+
}
|
|
60
|
+
this.logFileStream = null;
|
|
61
|
+
}
|
|
62
|
+
static clearLogFile() {
|
|
63
|
+
if (fs.existsSync(this.logFilePath)) {
|
|
64
|
+
fs.truncateSync(this.logFilePath);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
package/build/constants.d.ts
CHANGED
|
@@ -15,4 +15,7 @@ export declare const DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = 100;
|
|
|
15
15
|
export declare const BSTACK_SERVICE_VERSION: any;
|
|
16
16
|
export declare const ACCESSIBILITY_API_URL = "https://accessibility.browserstack.com/api";
|
|
17
17
|
export declare const NOT_ALLOWED_KEYS_IN_CAPS: string[];
|
|
18
|
+
export declare const LOGS_FILE = "logs/bstack-wdio-service.log";
|
|
19
|
+
export declare const UPLOAD_LOGS_ADDRESS = "https://upload-observability.browserstack.com";
|
|
20
|
+
export declare const UPLOAD_LOGS_ENDPOINT = "client-logs/upload";
|
|
18
21
|
//# 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,YAAY,CAAA;AAKpD,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;AAEvE,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;AAC5D,eAAO,MAAM,sBAAsB,KAAuB,CAAA;AAE1D,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,YAAY,CAAA;AAKpD,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;AAEvE,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;AAC5D,eAAO,MAAM,sBAAsB,KAAuB,CAAA;AAE1D,eAAO,MAAM,qBAAqB,+CAA+C,CAAA;AACjF,eAAO,MAAM,wBAAwB,UAA6D,CAAA;AAElG,eAAO,MAAM,SAAS,iCAAiC,CAAA;AACvD,eAAO,MAAM,mBAAmB,kDAAkD,CAAA;AAClF,eAAO,MAAM,oBAAoB,uBAAuB,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -35,3 +35,6 @@ export const DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS = 100; // 100ms
|
|
|
35
35
|
export const BSTACK_SERVICE_VERSION = bstackServiceVersion;
|
|
36
36
|
export const ACCESSIBILITY_API_URL = 'https://accessibility.browserstack.com/api';
|
|
37
37
|
export const NOT_ALLOWED_KEYS_IN_CAPS = ['includeTagsInTestingScope', 'excludeTagsInTestingScope'];
|
|
38
|
+
export const LOGS_FILE = 'logs/bstack-wdio-service.log';
|
|
39
|
+
export const UPLOAD_LOGS_ADDRESS = 'https://upload-observability.browserstack.com';
|
|
40
|
+
export const UPLOAD_LOGS_ENDPOINT = 'client-logs/upload';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crash-reporter.d.ts","sourceRoot":"","sources":["../src/crash-reporter.ts"],"names":[],"mappings":"
|
|
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;AAIxD,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;IA6CjE,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,8 +1,7 @@
|
|
|
1
|
-
import logger from '@wdio/logger';
|
|
2
1
|
import got from 'got';
|
|
3
2
|
import { BSTACK_SERVICE_VERSION, DATA_ENDPOINT } from './constants.js';
|
|
4
3
|
import { DEFAULT_REQUEST_CONFIG, getObservabilityKey, getObservabilityUser } from './util.js';
|
|
5
|
-
|
|
4
|
+
import { BStackLogger } from './bstackLogger.js';
|
|
6
5
|
export default class CrashReporter {
|
|
7
6
|
/* User test config for build run minus PII */
|
|
8
7
|
static userConfigForReporting = {};
|
|
@@ -38,10 +37,10 @@ export default class CrashReporter {
|
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
catch (error) {
|
|
41
|
-
return
|
|
40
|
+
return BStackLogger.error(`[Crash_Report_Upload] Failed to parse user credentials while reporting crash due to ${error}`);
|
|
42
41
|
}
|
|
43
42
|
if (!this.credentialsForCrashReportUpload.username || !this.credentialsForCrashReportUpload.password) {
|
|
44
|
-
return
|
|
43
|
+
return BStackLogger.error('[Crash_Report_Upload] Failed to parse user credentials while reporting crash');
|
|
45
44
|
}
|
|
46
45
|
try {
|
|
47
46
|
if (Object.keys(this.userConfigForReporting).length === 0) {
|
|
@@ -49,7 +48,7 @@ export default class CrashReporter {
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
catch (error) {
|
|
52
|
-
|
|
51
|
+
BStackLogger.error(`[Crash_Report_Upload] Failed to parse user config while reporting crash due to ${error}`);
|
|
53
52
|
this.userConfigForReporting = {};
|
|
54
53
|
}
|
|
55
54
|
const data = {
|
|
@@ -70,9 +69,9 @@ export default class CrashReporter {
|
|
|
70
69
|
...this.credentialsForCrashReportUpload,
|
|
71
70
|
json: data
|
|
72
71
|
}).text().then(response => {
|
|
73
|
-
|
|
72
|
+
BStackLogger.debug(`[Crash_Report_Upload] Success response: ${JSON.stringify(response)}`);
|
|
74
73
|
}).catch((error) => {
|
|
75
|
-
|
|
74
|
+
BStackLogger.error(`[Crash_Report_Upload] Failed due to ${error}`);
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
77
|
static recursivelyRedactKeysFromObject(obj, keys) {
|
|
@@ -124,7 +123,7 @@ export default class CrashReporter {
|
|
|
124
123
|
}
|
|
125
124
|
catch (err) {
|
|
126
125
|
/* Wrong configuration like strings instead of json objects could break this method, needs no action */
|
|
127
|
-
|
|
126
|
+
BStackLogger.error(`Error in parsing user config PII with error ${err ? (err.stack || err) : err}`);
|
|
128
127
|
return configWithoutPII;
|
|
129
128
|
}
|
|
130
129
|
configWithoutPII.services = finalServices;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
+
import type fs from 'node:fs';
|
|
4
|
+
import type zlib from 'node:zlib';
|
|
5
|
+
export declare class FileStream {
|
|
6
|
+
readableStream: fs.ReadStream | zlib.Gzip;
|
|
7
|
+
constructor(readableStream: fs.ReadStream | zlib.Gzip);
|
|
8
|
+
stream(): fs.ReadStream | zlib.Gzip;
|
|
9
|
+
get [Symbol.toStringTag](): string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=fileStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileStream.d.ts","sourceRoot":"","sources":["../src/fileStream.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,qBAAa,UAAU;IACnB,cAAc,EAAE,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAA;gBAC7B,cAAc,EAAE,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI;IAIrD,MAAM;IAIN,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;CACJ"}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"insights-handler.d.ts","sourceRoot":"","sources":["../src/insights-handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE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C,EAAE,UAAU,CAAC,IAAI,GAAG,sBAAsB;IA4DtI,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,YAAY;YAiBN,gBAAgB;IA8E9B,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,qBAAqB;YAoBf,2BAA2B;IA8FzC,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"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import logger from '@wdio/logger';
|
|
3
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
3
|
import TestReporter from './reporter.js';
|
|
5
4
|
import { frameworkSupportsHook, getCloudProvider, getFailureObject, getGitMetaData, getHookType, getScenarioExamples, getUniqueIdentifier, getUniqueIdentifierForCucumber, isBrowserstackSession, isScreenshotCommand, o11yClassErrorHandler, pushDataToQueue, removeAnsiColors, sleep, uploadEventData } from './util.js';
|
|
6
5
|
import RequestQueueHandler from './request-handler.js';
|
|
7
6
|
import { DATA_SCREENSHOT_ENDPOINT, DEFAULT_WAIT_INTERVAL_FOR_PENDING_UPLOADS, DEFAULT_WAIT_TIMEOUT_FOR_PENDING_UPLOADS } from './constants.js';
|
|
8
|
-
|
|
7
|
+
import { BStackLogger } from './bstackLogger.js';
|
|
9
8
|
class _InsightsHandler {
|
|
10
9
|
_browser;
|
|
11
10
|
_framework;
|
|
@@ -445,7 +444,7 @@ class _InsightsHandler {
|
|
|
445
444
|
}
|
|
446
445
|
}
|
|
447
446
|
catch (error) {
|
|
448
|
-
|
|
447
|
+
BStackLogger.debug(`Exception in uploading log data to Observability with error : ${error}`);
|
|
449
448
|
}
|
|
450
449
|
};
|
|
451
450
|
async sendData(data) {
|
package/build/launcher.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export default class BrowserstackLauncherService implements Services.ServiceInst
|
|
|
23
23
|
* <object>: only "path" and "custom_id" should coexist as multiple properties.
|
|
24
24
|
*/
|
|
25
25
|
_validateApp(appConfig: AppConfig | string): Promise<App>;
|
|
26
|
+
_uploadServiceLogs(): Promise<void>;
|
|
26
27
|
_updateObjectTypeCaps(capabilities?: Capabilities.RemoteCapabilities, capType?: string, value?: {
|
|
27
28
|
[key: string]: any;
|
|
28
29
|
}): void;
|
|
@@ -34,6 +35,7 @@ export default class BrowserstackLauncherService implements Services.ServiceInst
|
|
|
34
35
|
*/
|
|
35
36
|
_getLocalBuildNumber(): string | null;
|
|
36
37
|
_updateLocalBuildCache(filePath?: string, buildName?: string, buildIdentifier?: number): void;
|
|
38
|
+
_getClientBuildUuid(): string;
|
|
37
39
|
}
|
|
38
40
|
export {};
|
|
39
41
|
//# sourceMappingURL=launcher.d.ts.map
|
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":"AAWA,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAqBvF,KAAK,iBAAiB,GAAG,yBAAyB,CAAC,KAAK,GAAG;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;CAC7C,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,YAA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mB;CAQtB"}
|
package/build/launcher.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import got from 'got';
|
|
2
|
-
import FormData from '
|
|
2
|
+
import { FormData } from 'formdata-node';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
3
4
|
import fs from 'node:fs';
|
|
4
5
|
import path from 'node:path';
|
|
5
|
-
import { promisify } from 'node:util';
|
|
6
|
+
import { promisify, format } from 'node:util';
|
|
6
7
|
import { performance, PerformanceObserver } from 'node:perf_hooks';
|
|
7
|
-
import { SevereServiceError } from 'webdriverio';
|
|
8
8
|
import os from 'node:os';
|
|
9
|
+
import { SevereServiceError } from 'webdriverio';
|
|
9
10
|
import * as BrowserstackLocalLauncher from 'browserstack-local';
|
|
10
|
-
import logger from '@wdio/logger';
|
|
11
11
|
import PerformanceTester from './performance-tester.js';
|
|
12
12
|
import { BSTACK_SERVICE_VERSION, NOT_ALLOWED_KEYS_IN_CAPS, VALID_APP_EXTENSION } from './constants.js';
|
|
13
|
-
import { launchTestSession, createAccessibilityTestRun, shouldAddServiceVersion, stopBuildUpstream, getCiInfo, isBStackSession, isUndefined, isAccessibilityAutomationSession, stopAccessibilityTestRun, isTrue } from './util.js';
|
|
13
|
+
import { launchTestSession, createAccessibilityTestRun, shouldAddServiceVersion, stopBuildUpstream, getCiInfo, isBStackSession, isUndefined, isAccessibilityAutomationSession, stopAccessibilityTestRun, isTrue, getBrowserStackUser, getBrowserStackKey, uploadLogs } from './util.js';
|
|
14
14
|
import CrashReporter from './crash-reporter.js';
|
|
15
|
-
|
|
15
|
+
import { BStackLogger } from './bstackLogger.js';
|
|
16
|
+
import { FileStream } from './fileStream.js';
|
|
16
17
|
export default class BrowserstackLauncherService {
|
|
17
18
|
_options;
|
|
18
19
|
_config;
|
|
@@ -25,6 +26,7 @@ export default class BrowserstackLauncherService {
|
|
|
25
26
|
constructor(_options, capabilities, _config) {
|
|
26
27
|
this._options = _options;
|
|
27
28
|
this._config = _config;
|
|
29
|
+
BStackLogger.clearLogFile();
|
|
28
30
|
// added to maintain backward compatibility with webdriverIO v5
|
|
29
31
|
this._config || (this._config = _options);
|
|
30
32
|
if (Array.isArray(capabilities)) {
|
|
@@ -125,7 +127,7 @@ export default class BrowserstackLauncherService {
|
|
|
125
127
|
CrashReporter.setConfigDetails(this._config, capabilities, this._options);
|
|
126
128
|
}
|
|
127
129
|
catch (error) {
|
|
128
|
-
|
|
130
|
+
BStackLogger.error(`[Crash_Report_Upload] Config processing failed due to ${error}`);
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
async onPrepare(config, capabilities) {
|
|
@@ -134,7 +136,7 @@ export default class BrowserstackLauncherService {
|
|
|
134
136
|
* Update app value of capability directly if app_url, custom_id, shareable_id is given
|
|
135
137
|
*/
|
|
136
138
|
if (!this._options.app) {
|
|
137
|
-
|
|
139
|
+
BStackLogger.info('app is not defined in browserstack-service config, skipping ...');
|
|
138
140
|
}
|
|
139
141
|
else {
|
|
140
142
|
let app = {};
|
|
@@ -148,7 +150,7 @@ export default class BrowserstackLauncherService {
|
|
|
148
150
|
if (VALID_APP_EXTENSION.includes(path.extname(app.app))) {
|
|
149
151
|
if (fs.existsSync(app.app)) {
|
|
150
152
|
const data = await this._uploadApp(app);
|
|
151
|
-
|
|
153
|
+
BStackLogger.info(`app upload completed: ${JSON.stringify(data)}`);
|
|
152
154
|
app.app = data.app_url;
|
|
153
155
|
}
|
|
154
156
|
else if (app.customId) {
|
|
@@ -158,7 +160,7 @@ export default class BrowserstackLauncherService {
|
|
|
158
160
|
throw new SevereServiceError(`[Invalid app path] app path ${app.app} is not correct, Provide correct path to app under test`);
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
|
-
|
|
163
|
+
BStackLogger.info(`Using app: ${app.app}`);
|
|
162
164
|
this._updateCaps(capabilities, 'app', app.app);
|
|
163
165
|
}
|
|
164
166
|
/**
|
|
@@ -187,7 +189,7 @@ export default class BrowserstackLauncherService {
|
|
|
187
189
|
if (scannerVersion) {
|
|
188
190
|
process.env.BSTACK_A11Y_SCANNER_VERSION = scannerVersion;
|
|
189
191
|
}
|
|
190
|
-
|
|
192
|
+
BStackLogger.debug(`Accessibility scannerVersion ${scannerVersion}`);
|
|
191
193
|
}
|
|
192
194
|
if (this._options.accessibilityOptions) {
|
|
193
195
|
const filteredOpts = Object.keys(this._options.accessibilityOptions)
|
|
@@ -204,7 +206,7 @@ export default class BrowserstackLauncherService {
|
|
|
204
206
|
this._updateObjectTypeCaps(capabilities, 'accessibilityOptions', {});
|
|
205
207
|
}
|
|
206
208
|
if (this._options.testObservability) {
|
|
207
|
-
|
|
209
|
+
BStackLogger.debug('Sending launch start event');
|
|
208
210
|
await launchTestSession(this._options, this._config, {
|
|
209
211
|
projectName: this._projectName,
|
|
210
212
|
buildName: this._buildName,
|
|
@@ -214,7 +216,7 @@ export default class BrowserstackLauncherService {
|
|
|
214
216
|
});
|
|
215
217
|
}
|
|
216
218
|
if (!this._options.browserstackLocal) {
|
|
217
|
-
return
|
|
219
|
+
return BStackLogger.info('browserstackLocal is not enabled - skipping...');
|
|
218
220
|
}
|
|
219
221
|
const opts = {
|
|
220
222
|
key: this._config.key,
|
|
@@ -230,7 +232,7 @@ export default class BrowserstackLauncherService {
|
|
|
230
232
|
*/
|
|
231
233
|
const obs = new PerformanceObserver((list) => {
|
|
232
234
|
const entry = list.getEntries()[0];
|
|
233
|
-
|
|
235
|
+
BStackLogger.info(`Browserstack Local successfully started after ${entry.duration}ms`);
|
|
234
236
|
});
|
|
235
237
|
obs.observe({ entryTypes: ['measure'] });
|
|
236
238
|
let timer;
|
|
@@ -254,13 +256,14 @@ export default class BrowserstackLauncherService {
|
|
|
254
256
|
});
|
|
255
257
|
}
|
|
256
258
|
async onComplete() {
|
|
259
|
+
BStackLogger.debug('Inside OnComplete hook..');
|
|
257
260
|
if (isAccessibilityAutomationSession(this._accessibilityAutomation)) {
|
|
258
261
|
await stopAccessibilityTestRun().catch((error) => {
|
|
259
|
-
|
|
262
|
+
BStackLogger.error(`Exception in stop accessibility test run: ${error}`);
|
|
260
263
|
});
|
|
261
264
|
}
|
|
262
265
|
if (this._options.testObservability) {
|
|
263
|
-
|
|
266
|
+
BStackLogger.debug('Sending stop launch event');
|
|
264
267
|
await stopBuildUpstream();
|
|
265
268
|
if (process.env.BS_TESTOPS_BUILD_HASHED_ID) {
|
|
266
269
|
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`);
|
|
@@ -272,9 +275,16 @@ export default class BrowserstackLauncherService {
|
|
|
272
275
|
return;
|
|
273
276
|
}
|
|
274
277
|
const duration = (new Date()).getTime() - (new Date(process.env.START_TIME)).getTime();
|
|
275
|
-
|
|
278
|
+
BStackLogger.info(`Total duration is ${duration / 1000} s`);
|
|
276
279
|
}
|
|
277
280
|
}
|
|
281
|
+
try {
|
|
282
|
+
await this._uploadServiceLogs();
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
BStackLogger.debug(`Failed to upload BrowserStack WDIO Service logs ${error}`);
|
|
286
|
+
}
|
|
287
|
+
BStackLogger.clearLogger();
|
|
278
288
|
if (!this.browserstackLocal || !this.browserstackLocal.isRunning()) {
|
|
279
289
|
return;
|
|
280
290
|
}
|
|
@@ -304,10 +314,10 @@ export default class BrowserstackLauncherService {
|
|
|
304
314
|
});
|
|
305
315
|
}
|
|
306
316
|
async _uploadApp(app) {
|
|
307
|
-
|
|
317
|
+
BStackLogger.info(`uploading app ${app.app} ${app.customId ? `and custom_id: ${app.customId}` : ''} to browserstack`);
|
|
308
318
|
const form = new FormData();
|
|
309
319
|
if (app.app) {
|
|
310
|
-
form.append('file', fs.createReadStream(app.app));
|
|
320
|
+
form.append('file', new FileStream(fs.createReadStream(app.app)));
|
|
311
321
|
}
|
|
312
322
|
if (app.customId) {
|
|
313
323
|
form.append('custom_id', app.customId);
|
|
@@ -347,6 +357,11 @@ export default class BrowserstackLauncherService {
|
|
|
347
357
|
}
|
|
348
358
|
return app;
|
|
349
359
|
}
|
|
360
|
+
async _uploadServiceLogs() {
|
|
361
|
+
const clientBuildUuid = this._getClientBuildUuid();
|
|
362
|
+
const response = await uploadLogs(getBrowserStackUser(this._config), getBrowserStackKey(this._config), clientBuildUuid);
|
|
363
|
+
BStackLogger.logToFile(`Response - ${format(response)}`, 'debug');
|
|
364
|
+
}
|
|
350
365
|
_updateObjectTypeCaps(capabilities, capType, value) {
|
|
351
366
|
try {
|
|
352
367
|
if (Array.isArray(capabilities)) {
|
|
@@ -434,7 +449,7 @@ export default class BrowserstackLauncherService {
|
|
|
434
449
|
}
|
|
435
450
|
}
|
|
436
451
|
catch (error) {
|
|
437
|
-
|
|
452
|
+
BStackLogger.debug(`Exception while retrieving capability value. Error - ${error}`);
|
|
438
453
|
}
|
|
439
454
|
}
|
|
440
455
|
_updateCaps(capabilities, capType, value) {
|
|
@@ -560,7 +575,7 @@ export default class BrowserstackLauncherService {
|
|
|
560
575
|
}
|
|
561
576
|
if ((!this._buildName || process.env.BROWSERSTACK_BUILD_NAME) && this._buildIdentifier) {
|
|
562
577
|
this._updateCaps(capabilities, 'buildIdentifier');
|
|
563
|
-
|
|
578
|
+
BStackLogger.warn('Skipping buildIdentifier as buildName is not passed.');
|
|
564
579
|
return;
|
|
565
580
|
}
|
|
566
581
|
if (this._buildIdentifier && this._buildIdentifier.includes('${DATE_TIME}')) {
|
|
@@ -630,4 +645,12 @@ export default class BrowserstackLauncherService {
|
|
|
630
645
|
jsonContent[buildName] = { 'identifier': buildIdentifier };
|
|
631
646
|
fs.writeFileSync(filePath, JSON.stringify(jsonContent));
|
|
632
647
|
}
|
|
648
|
+
_getClientBuildUuid() {
|
|
649
|
+
if (process.env.BS_TESTOPS_BUILD_HASHED_ID) {
|
|
650
|
+
return process.env.BS_TESTOPS_BUILD_HASHED_ID;
|
|
651
|
+
}
|
|
652
|
+
const uuid = uuidv4();
|
|
653
|
+
BStackLogger.logToFile(`If facing any issues, please contact BrowserStack support with the Build Run Id - ${uuid}`, 'info');
|
|
654
|
+
return uuid;
|
|
655
|
+
}
|
|
633
656
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance-tester.d.ts","sourceRoot":"","sources":["../src/performance-tester.ts"],"names":[],"mappings":";AAEA,OAAO,EAAe,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;
|
|
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,9 +1,8 @@
|
|
|
1
1
|
import { createObjectCsvWriter } from 'csv-writer';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import { performance, PerformanceObserver } from 'node:perf_hooks';
|
|
4
|
-
import logger from '@wdio/logger';
|
|
5
4
|
import { sleep } from './util.js';
|
|
6
|
-
|
|
5
|
+
import { BStackLogger } from './bstackLogger.js';
|
|
7
6
|
export default class PerformanceTester {
|
|
8
7
|
static _observer;
|
|
9
8
|
static _csvWriter;
|
|
@@ -39,7 +38,7 @@ export default class PerformanceTester {
|
|
|
39
38
|
const timeTaken = methods.reduce((a, c) => {
|
|
40
39
|
return times[c] + (a || 0);
|
|
41
40
|
}, 0);
|
|
42
|
-
|
|
41
|
+
BStackLogger.info(`Time for ${methods} is ${timeTaken}`);
|
|
43
42
|
return timeTaken;
|
|
44
43
|
}
|
|
45
44
|
static async stopAndGenerate(filename = 'performance-own.html') {
|
|
@@ -54,10 +53,10 @@ export default class PerformanceTester {
|
|
|
54
53
|
const path = process.cwd() + '/' + filename;
|
|
55
54
|
fs.writeFile(path, content, err => {
|
|
56
55
|
if (err) {
|
|
57
|
-
|
|
56
|
+
BStackLogger.error(`Error in writing html ${err}`);
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
|
-
|
|
59
|
+
BStackLogger.info(`Performance report is at ${path}`);
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
62
|
static generateReport(entries) {
|
|
@@ -89,7 +88,7 @@ export default class PerformanceTester {
|
|
|
89
88
|
};
|
|
90
89
|
});
|
|
91
90
|
this._csvWriter.writeRecords(dat)
|
|
92
|
-
.then(() =>
|
|
91
|
+
.then(() => BStackLogger.info('Performance CSV report generated successfully'))
|
|
93
92
|
.catch((error) => console.error(error));
|
|
94
93
|
}
|
|
95
94
|
}
|
package/build/reporter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACnF,OAAO,YAAY,MAAM,gBAAgB,CAAA;AAKzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExD,OAAO,KAAK,EAAgC,QAAQ,EAAc,MAAM,YAAY,C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