@lambdatest/smartui-cli 4.1.36 → 4.1.37
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/dist/index.cjs +247 -52
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -203,7 +203,8 @@ var constants_default = {
|
|
|
203
203
|
waitForTimeout: 1e3,
|
|
204
204
|
enableJavaScript: false,
|
|
205
205
|
allowedHostnames: [],
|
|
206
|
-
smartIgnore: false
|
|
206
|
+
smartIgnore: false,
|
|
207
|
+
showRenderErrors: false
|
|
207
208
|
},
|
|
208
209
|
DEFAULT_WEB_STATIC_CONFIG: [
|
|
209
210
|
{
|
|
@@ -521,7 +522,23 @@ var constants_default = {
|
|
|
521
522
|
"Redmi Note 13 Pro": { os: "android", viewport: { width: 412, height: 869 } },
|
|
522
523
|
"Aquos Sense 5G": { os: "android", viewport: { width: 393, height: 731 } },
|
|
523
524
|
"Xperia 10 IV": { os: "android", viewport: { width: 412, height: 832 } },
|
|
524
|
-
"Honeywell CT40": { os: "android", viewport: { width: 360, height: 512 } }
|
|
525
|
+
"Honeywell CT40": { os: "android", viewport: { width: 360, height: 512 } },
|
|
526
|
+
"Galaxy S25": { os: "android", viewport: { width: 370, height: 802 } },
|
|
527
|
+
"Galaxy S25 Plus": { os: "android", viewport: { width: 393, height: 888 } },
|
|
528
|
+
"Galaxy S25 Ultra": { os: "android", viewport: { width: 432, height: 941 } },
|
|
529
|
+
"iPhone 17": { os: "ios", viewport: { width: 393, height: 852 } },
|
|
530
|
+
"iPhone 17 Pro": { os: "ios", viewport: { width: 393, height: 852 } },
|
|
531
|
+
"iPhone 17 Pro Max": { os: "ios", viewport: { width: 430, height: 932 } },
|
|
532
|
+
"Galaxy Z Fold7": { os: "android", viewport: { width: 373, height: 873 } },
|
|
533
|
+
"Galaxy Z Flip7": { os: "android", viewport: { width: 299, height: 723 } },
|
|
534
|
+
"Galaxy Z Fold6": { os: "android", viewport: { width: 373, height: 873 } },
|
|
535
|
+
"Galaxy Z Flip6": { os: "android", viewport: { width: 298, height: 713 } },
|
|
536
|
+
"Pixel 10 Pro": { os: "android", viewport: { width: 393, height: 852 } },
|
|
537
|
+
"Pixel 10 Pro XL": { os: "android", viewport: { width: 412, height: 915 } },
|
|
538
|
+
"Motorola Edge 50 Pro": { os: "android", viewport: { width: 384, height: 864 } },
|
|
539
|
+
"OnePlus 12": { os: "android", viewport: { width: 384, height: 884 } },
|
|
540
|
+
"Nothing Phone 1": { os: "android", viewport: { width: 393, height: 853 } },
|
|
541
|
+
"Nothing Phone 2": { os: "android", viewport: { width: 393, height: 878 } }
|
|
525
542
|
},
|
|
526
543
|
FIGMA_API: "https://api.figma.com/v1/",
|
|
527
544
|
DEFAULT_FIGMA_CONFIG: {
|
|
@@ -881,6 +898,10 @@ var ConfigSchema = {
|
|
|
881
898
|
minimum: 0,
|
|
882
899
|
maximum: 100,
|
|
883
900
|
errorMessage: "Invalid config; rejectionThreshold must be a number"
|
|
901
|
+
},
|
|
902
|
+
showRenderErrors: {
|
|
903
|
+
type: "boolean",
|
|
904
|
+
errorMessage: "Invalid config; showRenderErrors must be true/false"
|
|
884
905
|
}
|
|
885
906
|
},
|
|
886
907
|
anyOf: [
|
|
@@ -2055,6 +2076,131 @@ function validateCoordinates(coordString, pageHeight, pageWidth, snapshotName) {
|
|
|
2055
2076
|
coords: { top, bottom, left, right }
|
|
2056
2077
|
};
|
|
2057
2078
|
}
|
|
2079
|
+
function createBasicAuthToken(username, accessKey) {
|
|
2080
|
+
const credentials = `${username}:${accessKey}`;
|
|
2081
|
+
return Buffer.from(credentials).toString("base64");
|
|
2082
|
+
}
|
|
2083
|
+
function listenToSmartUISSE(baseURL, accessToken, ctx, onEvent) {
|
|
2084
|
+
return __async(this, null, function* () {
|
|
2085
|
+
var _a;
|
|
2086
|
+
const url = `${baseURL}/api/v1/sse/smartui`;
|
|
2087
|
+
const abortController = new AbortController();
|
|
2088
|
+
try {
|
|
2089
|
+
const response = yield fetch(url, {
|
|
2090
|
+
method: "GET",
|
|
2091
|
+
headers: {
|
|
2092
|
+
"Accept": "text/event-stream",
|
|
2093
|
+
"Cache-Control": "no-cache",
|
|
2094
|
+
"Cookie": `stageAccessToken=Basic ${accessToken}`
|
|
2095
|
+
},
|
|
2096
|
+
signal: abortController.signal
|
|
2097
|
+
});
|
|
2098
|
+
if (!response.ok) {
|
|
2099
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
2100
|
+
}
|
|
2101
|
+
onEvent == null ? void 0 : onEvent("open", { status: "connected" });
|
|
2102
|
+
const reader = (_a = response.body) == null ? void 0 : _a.getReader();
|
|
2103
|
+
if (!reader) {
|
|
2104
|
+
throw new Error("No response body reader available");
|
|
2105
|
+
}
|
|
2106
|
+
const decoder = new TextDecoder();
|
|
2107
|
+
let buffer = "";
|
|
2108
|
+
let currentEvent = "";
|
|
2109
|
+
try {
|
|
2110
|
+
while (true) {
|
|
2111
|
+
const { done, value } = yield reader.read();
|
|
2112
|
+
if (done)
|
|
2113
|
+
break;
|
|
2114
|
+
const chunk = decoder.decode(value, { stream: true });
|
|
2115
|
+
buffer += chunk;
|
|
2116
|
+
const lines = buffer.split("\n");
|
|
2117
|
+
buffer = lines.pop() || "";
|
|
2118
|
+
for (const line of lines) {
|
|
2119
|
+
if (line.startsWith("event:")) {
|
|
2120
|
+
currentEvent = line.substring(6).trim();
|
|
2121
|
+
} else if (line.startsWith("data:")) {
|
|
2122
|
+
const data = line.substring(5).trim();
|
|
2123
|
+
if (data) {
|
|
2124
|
+
try {
|
|
2125
|
+
const parsedData = JSON.parse(data);
|
|
2126
|
+
onEvent == null ? void 0 : onEvent(currentEvent, parsedData);
|
|
2127
|
+
} catch (parseError) {
|
|
2128
|
+
if (currentEvent === "connection" && data === "connected") {
|
|
2129
|
+
onEvent == null ? void 0 : onEvent(currentEvent, { status: "connected", message: data });
|
|
2130
|
+
} else {
|
|
2131
|
+
onEvent == null ? void 0 : onEvent(currentEvent, data);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
} else if (line.trim() === "") {
|
|
2136
|
+
currentEvent = "";
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
} catch (streamError) {
|
|
2141
|
+
ctx.log.debug("SSE Streaming error:", streamError);
|
|
2142
|
+
onEvent == null ? void 0 : onEvent("error", streamError);
|
|
2143
|
+
} finally {
|
|
2144
|
+
reader.releaseLock();
|
|
2145
|
+
}
|
|
2146
|
+
} catch (error) {
|
|
2147
|
+
ctx.log.debug("SSE Connection error:", error);
|
|
2148
|
+
onEvent == null ? void 0 : onEvent("error", error);
|
|
2149
|
+
}
|
|
2150
|
+
return {
|
|
2151
|
+
abort: () => abortController.abort()
|
|
2152
|
+
};
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
function startSSEListener(ctx) {
|
|
2156
|
+
return __async(this, null, function* () {
|
|
2157
|
+
let currentConnection = null;
|
|
2158
|
+
let errorCount = 0;
|
|
2159
|
+
try {
|
|
2160
|
+
ctx.log.debug("Attempting SSE connection");
|
|
2161
|
+
const accessKey = ctx.env.LT_ACCESS_KEY;
|
|
2162
|
+
const username = ctx.env.LT_USERNAME;
|
|
2163
|
+
const basicAuthToken = createBasicAuthToken(username, accessKey);
|
|
2164
|
+
ctx.log.debug(`Basic auth token: ${basicAuthToken}`);
|
|
2165
|
+
currentConnection = yield listenToSmartUISSE(
|
|
2166
|
+
ctx.env.SMARTUI_SSE_URL,
|
|
2167
|
+
basicAuthToken,
|
|
2168
|
+
ctx,
|
|
2169
|
+
(eventType, data) => {
|
|
2170
|
+
switch (eventType) {
|
|
2171
|
+
case "open":
|
|
2172
|
+
ctx.log.debug("Connected to SSE server");
|
|
2173
|
+
break;
|
|
2174
|
+
case "connection":
|
|
2175
|
+
ctx.log.debug("Connection confirmed:", data);
|
|
2176
|
+
break;
|
|
2177
|
+
case "Dot_buildCompleted":
|
|
2178
|
+
ctx.log.debug("Build completed");
|
|
2179
|
+
ctx.log.info(chalk__default.default.green.bold("Build completed"));
|
|
2180
|
+
process.exit(0);
|
|
2181
|
+
case "DOTUIError":
|
|
2182
|
+
if (data.buildId == ctx.build.id) {
|
|
2183
|
+
errorCount++;
|
|
2184
|
+
ctx.log.info(chalk__default.default.red.bold(`Error: ${data.message}`));
|
|
2185
|
+
}
|
|
2186
|
+
break;
|
|
2187
|
+
case "DOTUIWarning":
|
|
2188
|
+
if (data.buildId == ctx.build.id) {
|
|
2189
|
+
ctx.log.info(chalk__default.default.yellow.bold(`Warning: ${data.message}`));
|
|
2190
|
+
}
|
|
2191
|
+
break;
|
|
2192
|
+
case "error":
|
|
2193
|
+
ctx.log.debug("SSE Error occurred:", data);
|
|
2194
|
+
currentConnection == null ? void 0 : currentConnection.abort();
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
);
|
|
2199
|
+
} catch (error) {
|
|
2200
|
+
ctx.log.debug("Failed to start SSE listener:", error);
|
|
2201
|
+
}
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2058
2204
|
|
|
2059
2205
|
// src/lib/server.ts
|
|
2060
2206
|
var fp = require_find_free_port();
|
|
@@ -2145,7 +2291,7 @@ var server_default = (ctx) => __async(void 0, null, function* () {
|
|
|
2145
2291
|
ctx.log.debug(`Initialized empty context mapping map for contextId: ${contextId}`);
|
|
2146
2292
|
}
|
|
2147
2293
|
if (contextId && ctx.contextToSnapshotMap) {
|
|
2148
|
-
ctx.contextToSnapshotMap.set(contextId, 0);
|
|
2294
|
+
ctx.contextToSnapshotMap.set(contextId, "0");
|
|
2149
2295
|
ctx.log.debug(`Marking contextId as captured and added to queue: ${contextId}`);
|
|
2150
2296
|
}
|
|
2151
2297
|
if (contextId) {
|
|
@@ -2258,19 +2404,29 @@ var server_default = (ctx) => __async(void 0, null, function* () {
|
|
|
2258
2404
|
const timeoutDuration = pollTimeout * 1e3 || 3e4;
|
|
2259
2405
|
if ((_a = ctx.contextToSnapshotMap) == null ? void 0 : _a.has(contextId)) {
|
|
2260
2406
|
let contextStatus = ctx.contextToSnapshotMap.get(contextId);
|
|
2261
|
-
|
|
2262
|
-
|
|
2407
|
+
let counter = 60;
|
|
2408
|
+
while (contextStatus === "0") {
|
|
2409
|
+
if (counter <= 0) {
|
|
2410
|
+
throw new Error("Snapshot processing failed");
|
|
2411
|
+
}
|
|
2263
2412
|
contextStatus = ctx.contextToSnapshotMap.get(contextId);
|
|
2413
|
+
yield new Promise((resolve) => setTimeout(resolve, 5e3));
|
|
2414
|
+
counter--;
|
|
2264
2415
|
}
|
|
2265
|
-
if (contextStatus
|
|
2416
|
+
if (contextStatus === "2") {
|
|
2266
2417
|
throw new Error("Snapshot Failed");
|
|
2267
2418
|
}
|
|
2268
2419
|
ctx.log.debug("Snapshot uploaded successfully");
|
|
2420
|
+
const buildId = contextStatus;
|
|
2421
|
+
if (!buildId) {
|
|
2422
|
+
throw new Error(`No buildId found for contextId: ${contextId}`);
|
|
2423
|
+
}
|
|
2269
2424
|
let lastExternalResponse = null;
|
|
2270
2425
|
const startTime = Date.now();
|
|
2271
2426
|
while (true) {
|
|
2272
2427
|
try {
|
|
2273
2428
|
const externalResponse = yield ctx.client.getSnapshotStatus(
|
|
2429
|
+
buildId,
|
|
2274
2430
|
snapshotName,
|
|
2275
2431
|
contextId,
|
|
2276
2432
|
ctx
|
|
@@ -2370,7 +2526,9 @@ var env_default = () => {
|
|
|
2370
2526
|
SMARTUI_API_PROXY,
|
|
2371
2527
|
SMARTUI_API_SKIP_CERTIFICATES,
|
|
2372
2528
|
USE_REMOTE_DISCOVERY,
|
|
2373
|
-
SMART_GIT
|
|
2529
|
+
SMART_GIT,
|
|
2530
|
+
SHOW_RENDER_ERRORS,
|
|
2531
|
+
SMARTUI_SSE_URL = "https://server-events.lambdatest.com"
|
|
2374
2532
|
} = process.env;
|
|
2375
2533
|
return {
|
|
2376
2534
|
PROJECT_TOKEN,
|
|
@@ -2393,7 +2551,9 @@ var env_default = () => {
|
|
|
2393
2551
|
SMARTUI_API_PROXY,
|
|
2394
2552
|
SMARTUI_API_SKIP_CERTIFICATES: SMARTUI_API_SKIP_CERTIFICATES === "true",
|
|
2395
2553
|
USE_REMOTE_DISCOVERY: USE_REMOTE_DISCOVERY === "true",
|
|
2396
|
-
SMART_GIT: SMART_GIT === "true"
|
|
2554
|
+
SMART_GIT: SMART_GIT === "true",
|
|
2555
|
+
SHOW_RENDER_ERRORS: SHOW_RENDER_ERRORS === "true",
|
|
2556
|
+
SMARTUI_SSE_URL
|
|
2397
2557
|
};
|
|
2398
2558
|
};
|
|
2399
2559
|
var logContext = {};
|
|
@@ -2488,7 +2648,7 @@ var authExec_default = (ctx) => {
|
|
|
2488
2648
|
};
|
|
2489
2649
|
|
|
2490
2650
|
// package.json
|
|
2491
|
-
var version = "4.1.
|
|
2651
|
+
var version = "4.1.37";
|
|
2492
2652
|
var package_default = {
|
|
2493
2653
|
name: "@lambdatest/smartui-cli",
|
|
2494
2654
|
version,
|
|
@@ -2885,7 +3045,26 @@ var httpClient = class {
|
|
|
2885
3045
|
data: requestData
|
|
2886
3046
|
}, ctx.log);
|
|
2887
3047
|
}
|
|
2888
|
-
processSnapshotCaps(ctx, snapshot, snapshotUuid, capsBuildId, capsProjectToken, discoveryErrors) {
|
|
3048
|
+
processSnapshotCaps(ctx, snapshot, snapshotUuid, capsBuildId, capsProjectToken, discoveryErrors, variantCount, sync = false, approvalThreshold, rejectionThreshold) {
|
|
3049
|
+
const requestData = {
|
|
3050
|
+
name: snapshot.name,
|
|
3051
|
+
url: snapshot.url,
|
|
3052
|
+
snapshotUuid,
|
|
3053
|
+
variantCount,
|
|
3054
|
+
test: {
|
|
3055
|
+
type: ctx.testType,
|
|
3056
|
+
source: "cli"
|
|
3057
|
+
},
|
|
3058
|
+
doRemoteDiscovery: snapshot.options.doRemoteDiscovery,
|
|
3059
|
+
discoveryErrors,
|
|
3060
|
+
sync
|
|
3061
|
+
};
|
|
3062
|
+
if (approvalThreshold !== void 0) {
|
|
3063
|
+
requestData.approvalThreshold = approvalThreshold;
|
|
3064
|
+
}
|
|
3065
|
+
if (rejectionThreshold !== void 0) {
|
|
3066
|
+
requestData.rejectionThreshold = rejectionThreshold;
|
|
3067
|
+
}
|
|
2889
3068
|
return this.request({
|
|
2890
3069
|
url: `/build/${capsBuildId}/snapshot`,
|
|
2891
3070
|
method: "POST",
|
|
@@ -2893,21 +3072,27 @@ var httpClient = class {
|
|
|
2893
3072
|
"Content-Type": "application/json",
|
|
2894
3073
|
projectToken: capsProjectToken !== "" ? capsProjectToken : this.projectToken
|
|
2895
3074
|
},
|
|
2896
|
-
data:
|
|
2897
|
-
name: snapshot.name,
|
|
2898
|
-
url: snapshot.url,
|
|
2899
|
-
snapshotUuid,
|
|
2900
|
-
test: {
|
|
2901
|
-
type: ctx.testType,
|
|
2902
|
-
source: "cli"
|
|
2903
|
-
},
|
|
2904
|
-
doRemoteDiscovery: snapshot.options.doRemoteDiscovery,
|
|
2905
|
-
discoveryErrors
|
|
2906
|
-
}
|
|
3075
|
+
data: requestData
|
|
2907
3076
|
}, ctx.log);
|
|
2908
3077
|
}
|
|
2909
|
-
uploadSnapshotForCaps(ctx, snapshot, capsBuildId, capsProjectToken, discoveryErrors) {
|
|
3078
|
+
uploadSnapshotForCaps(ctx, snapshot, capsBuildId, capsProjectToken, discoveryErrors, variantCount, sync = false, approvalThreshold, rejectionThreshold) {
|
|
2910
3079
|
const buildId = capsBuildId !== "" ? capsBuildId : ctx.build.id;
|
|
3080
|
+
const requestData = {
|
|
3081
|
+
snapshot,
|
|
3082
|
+
test: {
|
|
3083
|
+
type: ctx.testType,
|
|
3084
|
+
source: "cli"
|
|
3085
|
+
},
|
|
3086
|
+
discoveryErrors,
|
|
3087
|
+
variantCount,
|
|
3088
|
+
sync
|
|
3089
|
+
};
|
|
3090
|
+
if (approvalThreshold !== void 0) {
|
|
3091
|
+
requestData.approvalThreshold = approvalThreshold;
|
|
3092
|
+
}
|
|
3093
|
+
if (rejectionThreshold !== void 0) {
|
|
3094
|
+
requestData.rejectionThreshold = rejectionThreshold;
|
|
3095
|
+
}
|
|
2911
3096
|
return this.request({
|
|
2912
3097
|
url: `/builds/${buildId}/snapshot`,
|
|
2913
3098
|
method: "POST",
|
|
@@ -2916,14 +3101,7 @@ var httpClient = class {
|
|
|
2916
3101
|
projectToken: capsProjectToken !== "" ? capsProjectToken : this.projectToken
|
|
2917
3102
|
// Use capsProjectToken dynamically
|
|
2918
3103
|
},
|
|
2919
|
-
data:
|
|
2920
|
-
snapshot,
|
|
2921
|
-
test: {
|
|
2922
|
-
type: ctx.testType,
|
|
2923
|
-
source: "cli"
|
|
2924
|
-
},
|
|
2925
|
-
discoveryErrors
|
|
2926
|
-
}
|
|
3104
|
+
data: requestData
|
|
2927
3105
|
}, ctx.log);
|
|
2928
3106
|
}
|
|
2929
3107
|
uploadScreenshot({ id: buildId, name: buildName, baseline }, ssPath, ssName, browserName, viewport, url = "", log2) {
|
|
@@ -3146,9 +3324,9 @@ var httpClient = class {
|
|
|
3146
3324
|
data: requestData
|
|
3147
3325
|
}, ctx.log);
|
|
3148
3326
|
}
|
|
3149
|
-
getSnapshotStatus(snapshotName, snapshotUuid, ctx) {
|
|
3327
|
+
getSnapshotStatus(buildId, snapshotName, snapshotUuid, ctx) {
|
|
3150
3328
|
return this.request({
|
|
3151
|
-
url: `/snapshot/status?buildId=${
|
|
3329
|
+
url: `/snapshot/status?buildId=${buildId}&snapshotName=${snapshotName}&snapshotUUID=${snapshotUuid}`,
|
|
3152
3330
|
method: "GET",
|
|
3153
3331
|
headers: {
|
|
3154
3332
|
"Content-Type": "application/json"
|
|
@@ -3215,7 +3393,7 @@ var httpClient = class {
|
|
|
3215
3393
|
}
|
|
3216
3394
|
};
|
|
3217
3395
|
var ctx_default = (options) => {
|
|
3218
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
3396
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3219
3397
|
let env = env_default();
|
|
3220
3398
|
let webConfig;
|
|
3221
3399
|
let mobileConfig;
|
|
@@ -3350,7 +3528,8 @@ var ctx_default = (options) => {
|
|
|
3350
3528
|
useExtendedViewport,
|
|
3351
3529
|
loadDomContent,
|
|
3352
3530
|
approvalThreshold: config.approvalThreshold,
|
|
3353
|
-
rejectionThreshold: config.rejectionThreshold
|
|
3531
|
+
rejectionThreshold: config.rejectionThreshold,
|
|
3532
|
+
showRenderErrors: (_k = config.showRenderErrors) != null ? _k : false
|
|
3354
3533
|
},
|
|
3355
3534
|
uploadFilePath: "",
|
|
3356
3535
|
webStaticConfig: [],
|
|
@@ -3388,7 +3567,8 @@ var ctx_default = (options) => {
|
|
|
3388
3567
|
fetchResultsFileName: fetchResultsFileObj,
|
|
3389
3568
|
baselineBranch: options.baselineBranch || "",
|
|
3390
3569
|
baselineBuild: options.baselineBuild || "",
|
|
3391
|
-
githubURL: options.githubURL || ""
|
|
3570
|
+
githubURL: options.githubURL || "",
|
|
3571
|
+
showRenderErrors: options.showRenderErrors ? true : false
|
|
3392
3572
|
},
|
|
3393
3573
|
cliVersion: version,
|
|
3394
3574
|
totalSnapshots: -1,
|
|
@@ -3616,6 +3796,13 @@ var exec_default = (ctx) => {
|
|
|
3616
3796
|
startPolling(ctx2, "", false, "");
|
|
3617
3797
|
}
|
|
3618
3798
|
}
|
|
3799
|
+
if ((ctx2.env.SHOW_RENDER_ERRORS || ctx2.options.showRenderErrors || ctx2.config.showRenderErrors) && ctx2.build && ctx2.build.id) {
|
|
3800
|
+
if (ctx2.env.LT_USERNAME && ctx2.env.LT_ACCESS_KEY) {
|
|
3801
|
+
startSSEListener(ctx2);
|
|
3802
|
+
} else {
|
|
3803
|
+
ctx2.log.info("LT_USERNAME and LT_ACCESS_KEY are not set, set them to display render errors");
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3619
3806
|
updateLogContext({ task: "exec" });
|
|
3620
3807
|
return new Promise((resolve, reject) => {
|
|
3621
3808
|
var _a2, _b, _c;
|
|
@@ -4788,7 +4975,7 @@ var Queue = class {
|
|
|
4788
4975
|
}
|
|
4789
4976
|
processNext() {
|
|
4790
4977
|
return __async(this, null, function* () {
|
|
4791
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
4978
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
4792
4979
|
if (!this.isEmpty()) {
|
|
4793
4980
|
let snapshot;
|
|
4794
4981
|
if (this.ctx.config.delayedUpload) {
|
|
@@ -4861,8 +5048,13 @@ var Queue = class {
|
|
|
4861
5048
|
}
|
|
4862
5049
|
if (useCapsBuildId) {
|
|
4863
5050
|
this.ctx.log.info(`Using cached buildId: ${capsBuildId}`);
|
|
5051
|
+
let approvalThreshold = ((_c = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _c.approvalThreshold) || this.ctx.config.approvalThreshold;
|
|
5052
|
+
let rejectionThreshold = ((_d = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _d.rejectionThreshold) || this.ctx.config.rejectionThreshold;
|
|
4864
5053
|
if (useKafkaFlowCaps) {
|
|
4865
|
-
|
|
5054
|
+
let snapshotUuid = uuid.v4();
|
|
5055
|
+
if (((_e = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _e.contextId) && ((_f = this.ctx.contextToSnapshotMap) == null ? void 0 : _f.has(snapshot.options.contextId))) {
|
|
5056
|
+
snapshotUuid = snapshot.options.contextId;
|
|
5057
|
+
}
|
|
4866
5058
|
let uploadDomToS3 = this.ctx.config.useLambdaInternal || uploadDomToS3ViaEnv3;
|
|
4867
5059
|
if (!uploadDomToS3) {
|
|
4868
5060
|
this.ctx.log.debug(`Uploading dom to S3 for snapshot using presigned URL for CAPS`);
|
|
@@ -4873,16 +5065,19 @@ var Queue = class {
|
|
|
4873
5065
|
this.ctx.log.debug(`Uploading dom to S3 for snapshot using LSRS`);
|
|
4874
5066
|
yield this.ctx.client.sendDomToLSRSForCaps(this.ctx, processedSnapshot, snapshotUuid, capsBuildId, capsProjectToken);
|
|
4875
5067
|
}
|
|
4876
|
-
yield this.ctx.client.processSnapshotCaps(this.ctx, processedSnapshot, snapshotUuid, capsBuildId, capsProjectToken, discoveryErrors);
|
|
5068
|
+
yield this.ctx.client.processSnapshotCaps(this.ctx, processedSnapshot, snapshotUuid, capsBuildId, capsProjectToken, discoveryErrors, calculateVariantCountFromSnapshot(processedSnapshot, this.ctx.config), (_g = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _g.sync, approvalThreshold, rejectionThreshold);
|
|
4877
5069
|
} else {
|
|
4878
|
-
yield this.ctx.client.uploadSnapshotForCaps(this.ctx, processedSnapshot, capsBuildId, capsProjectToken, discoveryErrors);
|
|
5070
|
+
yield this.ctx.client.uploadSnapshotForCaps(this.ctx, processedSnapshot, capsBuildId, capsProjectToken, discoveryErrors, calculateVariantCountFromSnapshot(processedSnapshot, this.ctx.config), (_h = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _h.sync, approvalThreshold, rejectionThreshold);
|
|
4879
5071
|
}
|
|
4880
5072
|
const cachedCapabilities = this.ctx.sessionCapabilitiesMap.get(sessionId);
|
|
4881
5073
|
const currentCount = (cachedCapabilities == null ? void 0 : cachedCapabilities.snapshotCount) || 0;
|
|
4882
5074
|
cachedCapabilities.snapshotCount = currentCount + 1;
|
|
4883
5075
|
this.ctx.sessionCapabilitiesMap.set(sessionId, cachedCapabilities);
|
|
5076
|
+
if (((_i = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _i.contextId) && this.ctx.contextToSnapshotMap) {
|
|
5077
|
+
this.ctx.contextToSnapshotMap.set(snapshot.options.contextId, capsBuildId);
|
|
5078
|
+
}
|
|
4884
5079
|
} else {
|
|
4885
|
-
if (!((
|
|
5080
|
+
if (!((_j = this.ctx.build) == null ? void 0 : _j.id)) {
|
|
4886
5081
|
if (this.ctx.authenticatedInitially) {
|
|
4887
5082
|
let resp = yield this.ctx.client.createBuild(this.ctx.git, this.ctx.config, this.ctx.log, this.ctx.build.name, false, false, false, "");
|
|
4888
5083
|
this.ctx.build = {
|
|
@@ -4907,7 +5102,7 @@ var Queue = class {
|
|
|
4907
5102
|
if (this.ctx.build && this.ctx.build.useKafkaFlow) {
|
|
4908
5103
|
let snapshotUuid = uuid.v4();
|
|
4909
5104
|
let snapshotUploadResponse;
|
|
4910
|
-
if (((
|
|
5105
|
+
if (((_k = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _k.contextId) && ((_l = this.ctx.contextToSnapshotMap) == null ? void 0 : _l.has(snapshot.options.contextId))) {
|
|
4911
5106
|
snapshotUuid = snapshot.options.contextId;
|
|
4912
5107
|
}
|
|
4913
5108
|
let uploadDomToS3 = this.ctx.config.useLambdaInternal || uploadDomToS3ViaEnv3;
|
|
@@ -4933,18 +5128,18 @@ var Queue = class {
|
|
|
4933
5128
|
this.ctx.log.debug(`Closed browser context for snapshot ${snapshot.name}`);
|
|
4934
5129
|
}
|
|
4935
5130
|
}
|
|
4936
|
-
if ((
|
|
4937
|
-
(
|
|
5131
|
+
if ((_m = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _m.contextId) {
|
|
5132
|
+
(_o = this.ctx.contextToSnapshotMap) == null ? void 0 : _o.set((_n = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _n.contextId, "2");
|
|
4938
5133
|
}
|
|
4939
5134
|
this.processNext();
|
|
4940
5135
|
} else {
|
|
4941
|
-
let approvalThreshold = ((
|
|
4942
|
-
let rejectionThreshold = ((
|
|
4943
|
-
yield this.ctx.client.processSnapshot(this.ctx, processedSnapshot, snapshotUuid, discoveryErrors, calculateVariantCountFromSnapshot(processedSnapshot, this.ctx.config), (
|
|
4944
|
-
if (((
|
|
4945
|
-
this.ctx.contextToSnapshotMap.set(snapshot.options.contextId,
|
|
5136
|
+
let approvalThreshold = ((_p = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _p.approvalThreshold) || this.ctx.config.approvalThreshold;
|
|
5137
|
+
let rejectionThreshold = ((_q = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _q.rejectionThreshold) || this.ctx.config.rejectionThreshold;
|
|
5138
|
+
yield this.ctx.client.processSnapshot(this.ctx, processedSnapshot, snapshotUuid, discoveryErrors, calculateVariantCountFromSnapshot(processedSnapshot, this.ctx.config), (_r = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _r.sync, approvalThreshold, rejectionThreshold);
|
|
5139
|
+
if (((_s = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _s.contextId) && ((_t = this.ctx.contextToSnapshotMap) == null ? void 0 : _t.has(snapshot.options.contextId))) {
|
|
5140
|
+
this.ctx.contextToSnapshotMap.set(snapshot.options.contextId, this.ctx.build.id);
|
|
4946
5141
|
}
|
|
4947
|
-
this.ctx.log.debug(`ContextId: ${(
|
|
5142
|
+
this.ctx.log.debug(`ContextId: ${(_u = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _u.contextId} status set to uploaded`);
|
|
4948
5143
|
}
|
|
4949
5144
|
} else {
|
|
4950
5145
|
this.ctx.log.info(`Uploading snapshot to S3`);
|
|
@@ -4957,8 +5152,8 @@ var Queue = class {
|
|
|
4957
5152
|
} catch (error) {
|
|
4958
5153
|
this.ctx.log.debug(`snapshot failed; ${error}`);
|
|
4959
5154
|
this.processedSnapshots.push({ name: snapshot == null ? void 0 : snapshot.name, error: error.message });
|
|
4960
|
-
if (((
|
|
4961
|
-
this.ctx.contextToSnapshotMap.set(snapshot.options.contextId, 2);
|
|
5155
|
+
if (((_v = snapshot == null ? void 0 : snapshot.options) == null ? void 0 : _v.contextId) && this.ctx.contextToSnapshotMap) {
|
|
5156
|
+
this.ctx.contextToSnapshotMap.set(snapshot.options.contextId, "2");
|
|
4962
5157
|
}
|
|
4963
5158
|
}
|
|
4964
5159
|
if (this.ctx.browser) {
|
|
@@ -5013,7 +5208,7 @@ var startTunnel_default = (ctx) => {
|
|
|
5013
5208
|
|
|
5014
5209
|
// src/commander/exec.ts
|
|
5015
5210
|
var command = new commander.Command();
|
|
5016
|
-
command.name("exec").description("Run test commands around SmartUI").argument("<command...>", "Command supplied for running tests").option("-P, --port <number>", "Port number for the server").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").option("--buildName <string>", "Specify the build name").option("--scheduled <string>", "Specify the schedule ID").option("--userName <string>", "Specify the LT username").option("--accessKey <string>", "Specify the LT accesskey").action(function(execCommand, _, command11) {
|
|
5211
|
+
command.name("exec").description("Run test commands around SmartUI").argument("<command...>", "Command supplied for running tests").option("-P, --port <number>", "Port number for the server").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").option("--buildName <string>", "Specify the build name").option("--scheduled <string>", "Specify the schedule ID").option("--userName <string>", "Specify the LT username").option("--accessKey <string>", "Specify the LT accesskey").option("--show-render-errors", "Show render errors from SmartUI build").action(function(execCommand, _, command11) {
|
|
5017
5212
|
return __async(this, null, function* () {
|
|
5018
5213
|
var _a;
|
|
5019
5214
|
const options = command11.optsWithGlobals();
|