@lambdatest/smartui-cli 4.0.19 → 4.0.20
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 +107 -55
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -16,6 +16,7 @@ var axios = require('axios');
|
|
|
16
16
|
var child_process = require('child_process');
|
|
17
17
|
var spawn = require('cross-spawn');
|
|
18
18
|
var test = require('@playwright/test');
|
|
19
|
+
var uuid = require('uuid');
|
|
19
20
|
var sharp = require('sharp');
|
|
20
21
|
|
|
21
22
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -962,7 +963,7 @@ var validateFigmaDesignConfig = ajv.compile(FigmaDesignConfigSchema);
|
|
|
962
963
|
var validateWebFigmaConfig = ajv.compile(FigmaWebConfigSchema);
|
|
963
964
|
|
|
964
965
|
// src/lib/server.ts
|
|
965
|
-
var server_default = (ctx) => __async(
|
|
966
|
+
var server_default = (ctx) => __async(undefined, null, function* () {
|
|
966
967
|
const server = fastify__default.default({
|
|
967
968
|
logger: {
|
|
968
969
|
level: "debug",
|
|
@@ -980,7 +981,7 @@ var server_default = (ctx) => __async(void 0, null, function* () {
|
|
|
980
981
|
server.get("/domserializer", opts, (request, reply) => {
|
|
981
982
|
reply.code(200).send({ data: { dom: SMARTUI_DOM } });
|
|
982
983
|
});
|
|
983
|
-
server.post("/snapshot", opts, (request, reply) => __async(
|
|
984
|
+
server.post("/snapshot", opts, (request, reply) => __async(undefined, null, function* () {
|
|
984
985
|
var _a;
|
|
985
986
|
let replyCode;
|
|
986
987
|
let replyBody;
|
|
@@ -1083,7 +1084,7 @@ var logger_default = logger;
|
|
|
1083
1084
|
var startServer_default = (ctx) => {
|
|
1084
1085
|
return {
|
|
1085
1086
|
title: `Setting up SmartUI server`,
|
|
1086
|
-
task: (ctx2, task) => __async(
|
|
1087
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
1087
1088
|
var _a;
|
|
1088
1089
|
updateLogContext({ task: "startServer" });
|
|
1089
1090
|
try {
|
|
@@ -1102,7 +1103,7 @@ var startServer_default = (ctx) => {
|
|
|
1102
1103
|
var auth_default = (ctx) => {
|
|
1103
1104
|
return {
|
|
1104
1105
|
title: `Authenticating with SmartUI`,
|
|
1105
|
-
task: (ctx2, task) => __async(
|
|
1106
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
1106
1107
|
updateLogContext({ task: "auth" });
|
|
1107
1108
|
try {
|
|
1108
1109
|
const authResult = yield ctx2.client.auth(ctx2.log, ctx2.env);
|
|
@@ -1125,7 +1126,7 @@ var auth_default = (ctx) => {
|
|
|
1125
1126
|
};
|
|
1126
1127
|
|
|
1127
1128
|
// package.json
|
|
1128
|
-
var version = "4.0.
|
|
1129
|
+
var version = "4.0.20";
|
|
1129
1130
|
var package_default = {
|
|
1130
1131
|
name: "@lambdatest/smartui-cli",
|
|
1131
1132
|
version,
|
|
@@ -1168,6 +1169,7 @@ var package_default = {
|
|
|
1168
1169
|
listr2: "^7.0.1",
|
|
1169
1170
|
sharp: "^0.33.4",
|
|
1170
1171
|
tsup: "^7.2.0",
|
|
1172
|
+
uuid: "^11.0.3",
|
|
1171
1173
|
which: "^4.0.0",
|
|
1172
1174
|
winston: "^3.10.0"
|
|
1173
1175
|
},
|
|
@@ -1213,7 +1215,7 @@ var httpClient = class {
|
|
|
1213
1215
|
headers: error.response.headers,
|
|
1214
1216
|
body: error.response.data
|
|
1215
1217
|
})}`);
|
|
1216
|
-
throw new Error(((_a = error.response.data.error) == null ?
|
|
1218
|
+
throw new Error(((_a = error.response.data.error) == null ? undefined : _a.message) || error.response.data.message || error.response.data);
|
|
1217
1219
|
}
|
|
1218
1220
|
if (error.request) {
|
|
1219
1221
|
log2.debug(`http request failed: ${error.toJSON()}`);
|
|
@@ -1288,6 +1290,23 @@ var httpClient = class {
|
|
|
1288
1290
|
}
|
|
1289
1291
|
}, ctx.log);
|
|
1290
1292
|
}
|
|
1293
|
+
processSnapshot(ctx, snapshot, snapshotUuid) {
|
|
1294
|
+
return this.request({
|
|
1295
|
+
url: `/build/${ctx.build.id}/snapshot`,
|
|
1296
|
+
method: "POST",
|
|
1297
|
+
headers: { "Content-Type": "application/json" },
|
|
1298
|
+
data: {
|
|
1299
|
+
name: snapshot.name,
|
|
1300
|
+
url: snapshot.url,
|
|
1301
|
+
snapshotUuid,
|
|
1302
|
+
test: {
|
|
1303
|
+
type: ctx.testType,
|
|
1304
|
+
source: "cli"
|
|
1305
|
+
},
|
|
1306
|
+
async: false
|
|
1307
|
+
}
|
|
1308
|
+
}, ctx.log);
|
|
1309
|
+
}
|
|
1291
1310
|
uploadScreenshot({ id: buildId, name: buildName, baseline }, ssPath, ssName, browserName, viewport, log2) {
|
|
1292
1311
|
browserName = browserName === constants_default.SAFARI ? constants_default.WEBKIT : browserName;
|
|
1293
1312
|
const file = fs5__default.default.readFileSync(ssPath);
|
|
@@ -1356,6 +1375,18 @@ var httpClient = class {
|
|
|
1356
1375
|
}
|
|
1357
1376
|
}, ctx.log);
|
|
1358
1377
|
}
|
|
1378
|
+
getS3PresignedURLForSnapshotUpload(ctx, snapshotName, snapshotUuid) {
|
|
1379
|
+
return this.request({
|
|
1380
|
+
url: `/snapshotuploadurl`,
|
|
1381
|
+
method: "POST",
|
|
1382
|
+
headers: { "Content-Type": "application/json" },
|
|
1383
|
+
data: {
|
|
1384
|
+
buildId: ctx.build.id,
|
|
1385
|
+
snapshotName,
|
|
1386
|
+
snapshotUuid
|
|
1387
|
+
}
|
|
1388
|
+
}, ctx.log);
|
|
1389
|
+
}
|
|
1359
1390
|
uploadLogs(ctx, uploadURL) {
|
|
1360
1391
|
const fileStream = fs5__default.default.createReadStream(constants_default.LOG_FILE_PATH);
|
|
1361
1392
|
const { size } = fs5__default.default.statSync(constants_default.LOG_FILE_PATH);
|
|
@@ -1373,6 +1404,20 @@ var httpClient = class {
|
|
|
1373
1404
|
// prevent axios from limiting the content size
|
|
1374
1405
|
}, ctx.log);
|
|
1375
1406
|
}
|
|
1407
|
+
uploadSnapshotToS3(ctx, uploadURL, snapshot) {
|
|
1408
|
+
return this.request({
|
|
1409
|
+
url: uploadURL,
|
|
1410
|
+
method: "PUT",
|
|
1411
|
+
headers: {
|
|
1412
|
+
"Content-Type": "application/json"
|
|
1413
|
+
},
|
|
1414
|
+
data: snapshot,
|
|
1415
|
+
maxBodyLength: Infinity,
|
|
1416
|
+
// prevent axios from limiting the body size
|
|
1417
|
+
maxContentLength: Infinity
|
|
1418
|
+
// prevent axios from limiting the content size
|
|
1419
|
+
}, ctx.log);
|
|
1420
|
+
}
|
|
1376
1421
|
processWebFigma(requestBody, log2) {
|
|
1377
1422
|
return this.request({
|
|
1378
1423
|
url: "figma-web/upload",
|
|
@@ -1448,7 +1493,7 @@ var ctx_default = (options) => {
|
|
|
1448
1493
|
}
|
|
1449
1494
|
if (config.web) {
|
|
1450
1495
|
webConfig = { browsers: config.web.browsers, viewports: [] };
|
|
1451
|
-
for (let viewport of (_b = config.web) == null ?
|
|
1496
|
+
for (let viewport of (_b = config.web) == null ? undefined : _b.viewports)
|
|
1452
1497
|
webConfig.viewports.push({ width: viewport[0], height: viewport[1] || 0 });
|
|
1453
1498
|
}
|
|
1454
1499
|
if (config.mobile) {
|
|
@@ -1566,7 +1611,7 @@ var getGitInfo_default = (ctx) => {
|
|
|
1566
1611
|
skip: (ctx2) => {
|
|
1567
1612
|
return !isGitRepo() && !ctx2.env.SMARTUI_GIT_INFO_FILEPATH ? "[SKIPPED] Fetching git repo details; not a git repo" : "";
|
|
1568
1613
|
},
|
|
1569
|
-
task: (ctx2, task) => __async(
|
|
1614
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
1570
1615
|
if (ctx2.env.CURRENT_BRANCH && ctx2.env.CURRENT_BRANCH.trim() === "") {
|
|
1571
1616
|
throw new Error("Error: The environment variable CURRENT_BRANCH cannot be empty.");
|
|
1572
1617
|
}
|
|
@@ -1586,7 +1631,7 @@ var getGitInfo_default = (ctx) => {
|
|
|
1586
1631
|
var createBuild_default = (ctx) => {
|
|
1587
1632
|
return {
|
|
1588
1633
|
title: `Creating SmartUI build`,
|
|
1589
|
-
task: (ctx2, task) => __async(
|
|
1634
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
1590
1635
|
updateLogContext({ task: "createBuild" });
|
|
1591
1636
|
try {
|
|
1592
1637
|
let resp = yield ctx2.client.createBuild(ctx2.git, ctx2.config, ctx2.log, ctx2.build.name);
|
|
@@ -1594,7 +1639,8 @@ var createBuild_default = (ctx) => {
|
|
|
1594
1639
|
id: resp.data.buildId,
|
|
1595
1640
|
name: resp.data.buildName,
|
|
1596
1641
|
url: resp.data.buildURL,
|
|
1597
|
-
baseline: resp.data.baseline
|
|
1642
|
+
baseline: resp.data.baseline,
|
|
1643
|
+
useKafkaFlow: resp.data.useKafkaFlow || false
|
|
1598
1644
|
};
|
|
1599
1645
|
task.output = chalk6__default.default.gray(`build id: ${resp.data.buildId}`);
|
|
1600
1646
|
task.title = "SmartUI build created";
|
|
@@ -1643,7 +1689,7 @@ function launchBrowsers(ctx) {
|
|
|
1643
1689
|
return __async(this, null, function* () {
|
|
1644
1690
|
var _a;
|
|
1645
1691
|
let browsers = {};
|
|
1646
|
-
const isHeadless = ((_a = process.env.HEADLESS) == null ?
|
|
1692
|
+
const isHeadless = ((_a = process.env.HEADLESS) == null ? undefined : _a.toLowerCase()) === "false" ? false : true;
|
|
1647
1693
|
let launchOptions = { headless: isHeadless };
|
|
1648
1694
|
if (ctx.config.web) {
|
|
1649
1695
|
for (const browser of ctx.config.web.browsers) {
|
|
@@ -1679,7 +1725,7 @@ function closeBrowsers(browsers) {
|
|
|
1679
1725
|
return __async(this, null, function* () {
|
|
1680
1726
|
var _a;
|
|
1681
1727
|
for (const browserName of Object.keys(browsers))
|
|
1682
|
-
yield (_a = browsers[browserName]) == null ?
|
|
1728
|
+
yield (_a = browsers[browserName]) == null ? undefined : _a.close();
|
|
1683
1729
|
});
|
|
1684
1730
|
}
|
|
1685
1731
|
function getWebRenderViewports(ctx) {
|
|
@@ -1728,7 +1774,7 @@ function getMobileRenderViewports(ctx) {
|
|
|
1728
1774
|
let os = constants_default.SUPPORTED_MOBILE_DEVICES[device].os;
|
|
1729
1775
|
let { width, height } = constants_default.SUPPORTED_MOBILE_DEVICES[device].viewport;
|
|
1730
1776
|
let portrait = ctx.config.mobile.orientation === constants_default.MOBILE_ORIENTATION_PORTRAIT ? true : false;
|
|
1731
|
-
(_a = mobileRenderViewports[os]) == null ?
|
|
1777
|
+
(_a = mobileRenderViewports[os]) == null ? undefined : _a.push({
|
|
1732
1778
|
viewport: { width: portrait ? width : height, height: portrait ? height : width },
|
|
1733
1779
|
viewportString: `${device} (${ctx.config.mobile.orientation})`,
|
|
1734
1780
|
fullPage: ctx.config.mobile.fullPage,
|
|
@@ -1751,12 +1797,12 @@ function getMobileRenderViewportsForOptions(options) {
|
|
|
1751
1797
|
let orientation = options.mobile.orientation || constants_default.MOBILE_ORIENTATION_PORTRAIT;
|
|
1752
1798
|
let portrait = orientation === constants_default.MOBILE_ORIENTATION_PORTRAIT;
|
|
1753
1799
|
let fullPage;
|
|
1754
|
-
if (options.mobile.fullPage ===
|
|
1800
|
+
if (options.mobile.fullPage === undefined || options.mobile.fullPage) {
|
|
1755
1801
|
fullPage = true;
|
|
1756
1802
|
} else {
|
|
1757
1803
|
fullPage = false;
|
|
1758
1804
|
}
|
|
1759
|
-
(_a = mobileRenderViewports[os]) == null ?
|
|
1805
|
+
(_a = mobileRenderViewports[os]) == null ? undefined : _a.push({
|
|
1760
1806
|
viewport: { width: portrait ? width : height, height: portrait ? height : width },
|
|
1761
1807
|
viewportString: `${device} (${orientation})`,
|
|
1762
1808
|
fullPage,
|
|
@@ -1866,31 +1912,31 @@ ${chalk6__default.default.yellow("Build ID:")} ${chalk6__default.default.white(r
|
|
|
1866
1912
|
var exec_default = (ctx) => {
|
|
1867
1913
|
var _a;
|
|
1868
1914
|
return {
|
|
1869
|
-
title: `Executing '${(_a = ctx.args.execCommand) == null ?
|
|
1870
|
-
task: (ctx2, task) => __async(
|
|
1915
|
+
title: `Executing '${(_a = ctx.args.execCommand) == null ? undefined : _a.join(" ")}'`,
|
|
1916
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
1871
1917
|
if (ctx2.options.fetchResults) {
|
|
1872
1918
|
startPolling(ctx2);
|
|
1873
1919
|
}
|
|
1874
1920
|
updateLogContext({ task: "exec" });
|
|
1875
1921
|
return new Promise((resolve, reject) => {
|
|
1876
1922
|
var _a2, _b, _c;
|
|
1877
|
-
const childProcess = spawn__default.default(ctx2.args.execCommand[0], (_a2 = ctx2.args.execCommand) == null ?
|
|
1923
|
+
const childProcess = spawn__default.default(ctx2.args.execCommand[0], (_a2 = ctx2.args.execCommand) == null ? undefined : _a2.slice(1));
|
|
1878
1924
|
let totalOutput = "";
|
|
1879
1925
|
const output = listr2.createWritable((chunk) => {
|
|
1880
1926
|
totalOutput += chunk;
|
|
1881
1927
|
task.output = chalk6__default.default.gray(totalOutput);
|
|
1882
1928
|
});
|
|
1883
|
-
(_b = childProcess.stdout) == null ?
|
|
1884
|
-
(_c = childProcess.stderr) == null ?
|
|
1929
|
+
(_b = childProcess.stdout) == null ? undefined : _b.pipe(output);
|
|
1930
|
+
(_c = childProcess.stderr) == null ? undefined : _c.pipe(output);
|
|
1885
1931
|
childProcess.on("error", (error) => {
|
|
1886
1932
|
var _a3;
|
|
1887
1933
|
task.output = chalk6__default.default.gray(`error: ${error.message}`);
|
|
1888
|
-
throw new Error(`Execution of '${(_a3 = ctx2.args.execCommand) == null ?
|
|
1934
|
+
throw new Error(`Execution of '${(_a3 = ctx2.args.execCommand) == null ? undefined : _a3.join(" ")}' failed`);
|
|
1889
1935
|
});
|
|
1890
|
-
childProcess.on("close", (code, signal) => __async(
|
|
1936
|
+
childProcess.on("close", (code, signal) => __async(undefined, null, function* () {
|
|
1891
1937
|
var _a3;
|
|
1892
1938
|
if (code !== null) {
|
|
1893
|
-
task.title = `Execution of '${(_a3 = ctx2.args.execCommand) == null ?
|
|
1939
|
+
task.title = `Execution of '${(_a3 = ctx2.args.execCommand) == null ? undefined : _a3.join(" ")}' completed; exited with code ${code}`;
|
|
1894
1940
|
} else if (signal !== null) {
|
|
1895
1941
|
throw new Error(`Child process killed with signal ${signal}`);
|
|
1896
1942
|
}
|
|
@@ -1905,7 +1951,7 @@ var exec_default = (ctx) => {
|
|
|
1905
1951
|
var processSnapshot_default = (ctx) => {
|
|
1906
1952
|
return {
|
|
1907
1953
|
title: `Processing snapshots`,
|
|
1908
|
-
task: (ctx2, task) => __async(
|
|
1954
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
1909
1955
|
var _a, _b;
|
|
1910
1956
|
try {
|
|
1911
1957
|
if (ctx2.config.delayedUpload) {
|
|
@@ -1949,7 +1995,7 @@ ${snapshot.warnings.length ? chalk6__default.default.gray(`[warning] ${snapshot.
|
|
|
1949
1995
|
var finalizeBuild_default = (ctx) => {
|
|
1950
1996
|
return {
|
|
1951
1997
|
title: `Finalizing build`,
|
|
1952
|
-
task: (ctx2, task) => __async(
|
|
1998
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
1953
1999
|
var _a, _b;
|
|
1954
2000
|
updateLogContext({ task: "finalizeBuild" });
|
|
1955
2001
|
try {
|
|
@@ -1985,7 +2031,7 @@ function processSnapshot(snapshot, ctx) {
|
|
|
1985
2031
|
var _a, _b;
|
|
1986
2032
|
updateLogContext({ task: "discovery" });
|
|
1987
2033
|
ctx.log.debug(`Processing snapshot ${snapshot.name} ${snapshot.url}`);
|
|
1988
|
-
const isHeadless = ((_a = process.env.HEADLESS) == null ?
|
|
2034
|
+
const isHeadless = ((_a = process.env.HEADLESS) == null ? undefined : _a.toLowerCase()) === "false" ? false : true;
|
|
1989
2035
|
let launchOptions = {
|
|
1990
2036
|
headless: isHeadless,
|
|
1991
2037
|
args: constants_default.LAUNCH_ARGS
|
|
@@ -1994,7 +2040,7 @@ function processSnapshot(snapshot, ctx) {
|
|
|
1994
2040
|
javaScriptEnabled: ctx.config.cliEnableJavaScript,
|
|
1995
2041
|
userAgent: constants_default.CHROME_USER_AGENT
|
|
1996
2042
|
};
|
|
1997
|
-
if (!((_b = ctx.browser) == null ?
|
|
2043
|
+
if (!((_b = ctx.browser) == null ? undefined : _b.isConnected())) {
|
|
1998
2044
|
if (ctx.env.HTTP_PROXY || ctx.env.HTTPS_PROXY)
|
|
1999
2045
|
launchOptions.proxy = { server: ctx.env.HTTP_PROXY || ctx.env.HTTPS_PROXY };
|
|
2000
2046
|
if (ctx.env.SMARTUI_HTTP_PROXY || ctx.env.SMARTUI_HTTPS_PROXY)
|
|
@@ -2127,7 +2173,7 @@ function processSnapshot(snapshot, ctx) {
|
|
|
2127
2173
|
const isNotAllEmpty = (obj) => {
|
|
2128
2174
|
var _a2;
|
|
2129
2175
|
for (let key in obj)
|
|
2130
|
-
if ((_a2 = obj[key]) == null ?
|
|
2176
|
+
if ((_a2 = obj[key]) == null ? undefined : _a2.length)
|
|
2131
2177
|
return true;
|
|
2132
2178
|
return false;
|
|
2133
2179
|
};
|
|
@@ -2255,11 +2301,11 @@ function processSnapshot(snapshot, ctx) {
|
|
|
2255
2301
|
return DEFAULT_HEIGHT;
|
|
2256
2302
|
}
|
|
2257
2303
|
const measurements = [
|
|
2258
|
-
(body == null ?
|
|
2259
|
-
(body == null ?
|
|
2260
|
-
(html == null ?
|
|
2261
|
-
(html == null ?
|
|
2262
|
-
(html == null ?
|
|
2304
|
+
(body == null ? undefined : body.scrollHeight) || 0,
|
|
2305
|
+
(body == null ? undefined : body.offsetHeight) || 0,
|
|
2306
|
+
(html == null ? undefined : html.clientHeight) || 0,
|
|
2307
|
+
(html == null ? undefined : html.scrollHeight) || 0,
|
|
2308
|
+
(html == null ? undefined : html.offsetHeight) || 0
|
|
2263
2309
|
];
|
|
2264
2310
|
const allMeasurementsInvalid = measurements.every((measurement) => !measurement);
|
|
2265
2311
|
if (allMeasurementsInvalid) {
|
|
@@ -2312,8 +2358,6 @@ function processSnapshot(snapshot, ctx) {
|
|
|
2312
2358
|
};
|
|
2313
2359
|
});
|
|
2314
2360
|
}
|
|
2315
|
-
|
|
2316
|
-
// src/lib/snapshotQueue.ts
|
|
2317
2361
|
var Queue = class {
|
|
2318
2362
|
constructor(ctx) {
|
|
2319
2363
|
this.snapshots = [];
|
|
@@ -2376,7 +2420,7 @@ var Queue = class {
|
|
|
2376
2420
|
}
|
|
2377
2421
|
generateWebVariants(snapshot, webConfig) {
|
|
2378
2422
|
var _a, _b, _c;
|
|
2379
|
-
const browsers = (_c = (_b = webConfig.browsers) != null ? _b : (_a = this.ctx.config.web) == null ?
|
|
2423
|
+
const browsers = (_c = (_b = webConfig.browsers) != null ? _b : (_a = this.ctx.config.web) == null ? undefined : _a.browsers) != null ? _c : [constants_default.CHROME, constants_default.EDGE, constants_default.FIREFOX, constants_default.SAFARI];
|
|
2380
2424
|
const viewports = webConfig.viewports || [];
|
|
2381
2425
|
for (const browser of browsers) {
|
|
2382
2426
|
for (const viewport of viewports) {
|
|
@@ -2390,7 +2434,7 @@ var Queue = class {
|
|
|
2390
2434
|
generateMobileVariants(snapshot, mobileConfig) {
|
|
2391
2435
|
var _a, _b, _c;
|
|
2392
2436
|
const devices = mobileConfig.devices || [];
|
|
2393
|
-
const orientation = (_c = (_b = mobileConfig.orientation) != null ? _b : (_a = this.ctx.config.mobile) == null ?
|
|
2437
|
+
const orientation = (_c = (_b = mobileConfig.orientation) != null ? _b : (_a = this.ctx.config.mobile) == null ? undefined : _a.orientation) != null ? _c : constants_default.MOBILE_ORIENTATION_PORTRAIT;
|
|
2394
2438
|
for (const device of devices) {
|
|
2395
2439
|
const variant = `${snapshot.name}_${device}_${orientation}`;
|
|
2396
2440
|
this.variants.push(variant);
|
|
@@ -2472,7 +2516,7 @@ var Queue = class {
|
|
|
2472
2516
|
}
|
|
2473
2517
|
filterWebVariants(snapshot, webConfig) {
|
|
2474
2518
|
var _a, _b, _c;
|
|
2475
|
-
const browsers = (_c = (_b = webConfig.browsers) != null ? _b : (_a = this.ctx.config.web) == null ?
|
|
2519
|
+
const browsers = (_c = (_b = webConfig.browsers) != null ? _b : (_a = this.ctx.config.web) == null ? undefined : _a.browsers) != null ? _c : [constants_default.CHROME, constants_default.EDGE, constants_default.FIREFOX, constants_default.SAFARI];
|
|
2476
2520
|
const viewports = webConfig.viewports || [];
|
|
2477
2521
|
let allVariantsDropped = true;
|
|
2478
2522
|
if (!snapshot.options) {
|
|
@@ -2510,8 +2554,8 @@ var Queue = class {
|
|
|
2510
2554
|
snapshot.options = {};
|
|
2511
2555
|
}
|
|
2512
2556
|
const devices = mobileConfig.devices || [];
|
|
2513
|
-
const orientation = (_c = (_b = mobileConfig.orientation) != null ? _b : (_a = this.ctx.config.mobile) == null ?
|
|
2514
|
-
const fullPage = (_f = (_e = mobileConfig.fullPage) != null ? _e : (_d = this.ctx.config.mobile) == null ?
|
|
2557
|
+
const orientation = (_c = (_b = mobileConfig.orientation) != null ? _b : (_a = this.ctx.config.mobile) == null ? undefined : _a.orientation) != null ? _c : constants_default.MOBILE_ORIENTATION_PORTRAIT;
|
|
2558
|
+
const fullPage = (_f = (_e = mobileConfig.fullPage) != null ? _e : (_d = this.ctx.config.mobile) == null ? undefined : _d.fullPage) != null ? _f : true;
|
|
2515
2559
|
let allVariantsDropped = true;
|
|
2516
2560
|
snapshot.options.mobile = { devices: [], orientation: constants_default.MOBILE_ORIENTATION_PORTRAIT, fullPage };
|
|
2517
2561
|
for (const device of devices) {
|
|
@@ -2551,7 +2595,15 @@ var Queue = class {
|
|
|
2551
2595
|
}
|
|
2552
2596
|
if (!drop) {
|
|
2553
2597
|
let { processedSnapshot, warnings } = yield processSnapshot(snapshot, this.ctx);
|
|
2554
|
-
|
|
2598
|
+
if (this.ctx.build && this.ctx.build.useKafkaFlow) {
|
|
2599
|
+
const snapshotUuid = uuid.v4();
|
|
2600
|
+
const presignedResponse = yield this.ctx.client.getS3PresignedURLForSnapshotUpload(this.ctx, processedSnapshot.name, snapshotUuid);
|
|
2601
|
+
const uploadUrl = presignedResponse.data.url;
|
|
2602
|
+
yield this.ctx.client.uploadSnapshotToS3(this.ctx, uploadUrl, processedSnapshot);
|
|
2603
|
+
yield this.ctx.client.processSnapshot(this.ctx, processedSnapshot, snapshotUuid);
|
|
2604
|
+
} else {
|
|
2605
|
+
yield this.ctx.client.uploadSnapshot(this.ctx, processedSnapshot);
|
|
2606
|
+
}
|
|
2555
2607
|
this.ctx.totalSnapshots++;
|
|
2556
2608
|
this.processedSnapshots.push({ name: snapshot.name, warnings });
|
|
2557
2609
|
}
|
|
@@ -2710,9 +2762,9 @@ function verifyFigmaWebConfig(ctx) {
|
|
|
2710
2762
|
if (ctx.env.LT_ACCESS_KEY == "") {
|
|
2711
2763
|
throw new Error("Missing LT_ACCESS_KEY in Environment Variables");
|
|
2712
2764
|
}
|
|
2713
|
-
let figma = ctx.config && ((_a = ctx.config) == null ?
|
|
2765
|
+
let figma = ctx.config && ((_a = ctx.config) == null ? undefined : _a.figma) || {};
|
|
2714
2766
|
const screenshots = [];
|
|
2715
|
-
for (let c of figma == null ?
|
|
2767
|
+
for (let c of figma == null ? undefined : figma.configs) {
|
|
2716
2768
|
if (c.screenshot_names && c.screenshot_names.length > 0 && c.figma_ids && c.figma_ids.length != c.screenshot_names.length) {
|
|
2717
2769
|
throw new Error("Mismatch in Figma Ids and Screenshot Names in figma config");
|
|
2718
2770
|
}
|
|
@@ -2788,8 +2840,8 @@ function captureScreenshotsForConfig(_0, _1, _2, _3, _4) {
|
|
|
2788
2840
|
} catch (error) {
|
|
2789
2841
|
throw new Error(`captureScreenshotsForConfig failed for browser ${browserName}; error: ${error}`);
|
|
2790
2842
|
} finally {
|
|
2791
|
-
yield page == null ?
|
|
2792
|
-
yield context == null ?
|
|
2843
|
+
yield page == null ? undefined : page.close();
|
|
2844
|
+
yield context == null ? undefined : context.close();
|
|
2793
2845
|
}
|
|
2794
2846
|
});
|
|
2795
2847
|
}
|
|
@@ -3056,7 +3108,7 @@ function processChunk(ctx, urlConfig) {
|
|
|
3056
3108
|
var captureScreenshots_default = (ctx) => {
|
|
3057
3109
|
return {
|
|
3058
3110
|
title: "Capturing screenshots",
|
|
3059
|
-
task: (ctx2, task) => __async(
|
|
3111
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
3060
3112
|
try {
|
|
3061
3113
|
ctx2.task = task;
|
|
3062
3114
|
if (ctx2.options.fetchResults) {
|
|
@@ -3143,7 +3195,7 @@ var capture_default = command2;
|
|
|
3143
3195
|
var uploadScreenshots_default = (ctx) => {
|
|
3144
3196
|
return {
|
|
3145
3197
|
title: "Uploading screenshots",
|
|
3146
|
-
task: (ctx2, task) => __async(
|
|
3198
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
3147
3199
|
try {
|
|
3148
3200
|
ctx2.task = task;
|
|
3149
3201
|
if (ctx2.options.fetchResults) {
|
|
@@ -3215,7 +3267,7 @@ command3.name("upload").description("Upload screenshots from given directory").a
|
|
|
3215
3267
|
var upload_default = command3;
|
|
3216
3268
|
|
|
3217
3269
|
// src/lib/uploadFigmaDesigns.ts
|
|
3218
|
-
var uploadFigmaDesigns_default = (ctx) => __async(
|
|
3270
|
+
var uploadFigmaDesigns_default = (ctx) => __async(undefined, null, function* () {
|
|
3219
3271
|
const depth = ctx.figmaDesignConfig.depth;
|
|
3220
3272
|
const figmaConfigs = ctx.figmaDesignConfig.figma_config;
|
|
3221
3273
|
let results = "";
|
|
@@ -3242,7 +3294,7 @@ var uploadFigmaDesigns_default = (ctx) => __async(void 0, null, function* () {
|
|
|
3242
3294
|
var uploadFigmaDesigns_default2 = (ctx) => {
|
|
3243
3295
|
return {
|
|
3244
3296
|
title: "Uploading Figma Designs",
|
|
3245
|
-
task: (ctx2, task) => __async(
|
|
3297
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
3246
3298
|
try {
|
|
3247
3299
|
ctx2.task = task;
|
|
3248
3300
|
updateLogContext({ task: "upload-figma" });
|
|
@@ -3264,13 +3316,13 @@ var uploadFigmaDesigns_default2 = (ctx) => {
|
|
|
3264
3316
|
};
|
|
3265
3317
|
|
|
3266
3318
|
// src/lib/uploadWebFigma.ts
|
|
3267
|
-
var uploadWebFigma_default = (ctx) => __async(
|
|
3319
|
+
var uploadWebFigma_default = (ctx) => __async(undefined, null, function* () {
|
|
3268
3320
|
var _a, _b;
|
|
3269
|
-
const figmaConfig = ctx.config && ((_a = ctx.config) == null ?
|
|
3270
|
-
const webConfig = ctx.config && ((_b = ctx.config) == null ?
|
|
3321
|
+
const figmaConfig = ctx.config && ((_a = ctx.config) == null ? undefined : _a.figma) || {};
|
|
3322
|
+
const webConfig = ctx.config && ((_b = ctx.config) == null ? undefined : _b.web) || {};
|
|
3271
3323
|
let results = "";
|
|
3272
3324
|
const buildName = ctx.options.buildName;
|
|
3273
|
-
if (figmaConfig
|
|
3325
|
+
if (figmaConfig.configs && figmaConfig.configs.length > 0) {
|
|
3274
3326
|
const authToken = `Basic ${Buffer.from(`${ctx.env.LT_USERNAME}:${ctx.env.LT_ACCESS_KEY}`).toString("base64")}`;
|
|
3275
3327
|
const requestBody = {
|
|
3276
3328
|
figma_token: ctx.env.FIGMA_TOKEN,
|
|
@@ -3297,7 +3349,7 @@ var uploadWebFigma_default = (ctx) => __async(void 0, null, function* () {
|
|
|
3297
3349
|
});
|
|
3298
3350
|
|
|
3299
3351
|
// src/lib/fetchFigma.ts
|
|
3300
|
-
var fetchFigma_default = (ctx) => __async(
|
|
3352
|
+
var fetchFigma_default = (ctx) => __async(undefined, null, function* () {
|
|
3301
3353
|
const buildId = ctx.build.id;
|
|
3302
3354
|
ctx.log.debug(`Fetching figma results for buildId ${buildId}`);
|
|
3303
3355
|
const startTime = Date.now();
|
|
@@ -3342,7 +3394,7 @@ function callFetchWebFigmaRecursive(startTime, buildId, ctx) {
|
|
|
3342
3394
|
var uploadWebFigma_default2 = (ctx) => {
|
|
3343
3395
|
return {
|
|
3344
3396
|
title: "Processing Web Figma",
|
|
3345
|
-
task: (ctx2, task) => __async(
|
|
3397
|
+
task: (ctx2, task) => __async(undefined, null, function* () {
|
|
3346
3398
|
try {
|
|
3347
3399
|
ctx2.task = task;
|
|
3348
3400
|
updateLogContext({ task: "upload-figma-web" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lambdatest/smartui-cli",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.20",
|
|
4
4
|
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/**/*"
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"listr2": "^7.0.1",
|
|
36
36
|
"sharp": "^0.33.4",
|
|
37
37
|
"tsup": "^7.2.0",
|
|
38
|
+
"uuid": "^11.0.3",
|
|
38
39
|
"which": "^4.0.0",
|
|
39
40
|
"winston": "^3.10.0"
|
|
40
41
|
},
|