@lambdatest/smartui-cli 4.1.57 → 4.1.59
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 +414 -114
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -306,6 +306,15 @@ var constants_default = {
|
|
|
306
306
|
// Disallowed file extension
|
|
307
307
|
FILE_EXTENSION_ZIP: ".zip",
|
|
308
308
|
FILE_EXTENSION_GIFS: "gif",
|
|
309
|
+
// command types
|
|
310
|
+
COMMAND_TYPE_EXEC: "exec",
|
|
311
|
+
COMMAND_TYPE_EXEC_START: "exec-start",
|
|
312
|
+
COMMAND_TYPE_CAPTURE: "capture",
|
|
313
|
+
COMMAND_TYPE_UPLOAD: "upload",
|
|
314
|
+
COMMAND_TYPE_UPLOAD_FIGMA: "upload-figma",
|
|
315
|
+
COMMAND_TYPE_UPLOAD_PDF: "upload-pdf",
|
|
316
|
+
COMMAND_TYPE_MERGE: "merge",
|
|
317
|
+
ALLOWED_CUSTOM_VIEWPORT_COMMANDS: ["exec", "exec-start"],
|
|
309
318
|
// Default scrollTime
|
|
310
319
|
DEFAULT_SCROLL_TIME: 8,
|
|
311
320
|
// Default page load time
|
|
@@ -443,6 +452,7 @@ var constants_default = {
|
|
|
443
452
|
"iPad 10.2 (2019)": { os: "ios", viewport: { width: 810, height: 1080 } },
|
|
444
453
|
"iPad 10.2 (2020)": { os: "ios", viewport: { width: 834, height: 1194 } },
|
|
445
454
|
"iPad 10.2 (2021)": { os: "ios", viewport: { width: 810, height: 1080 } },
|
|
455
|
+
"iPad (9th generation)": { os: "ios", viewport: { width: 810, height: 1080 } },
|
|
446
456
|
"iPad 9.7 (2017)": { os: "ios", viewport: { width: 768, height: 1024 } },
|
|
447
457
|
"iPad Air (2019)": { os: "ios", viewport: { width: 834, height: 1112 } },
|
|
448
458
|
"iPad Air (2020)": { os: "ios", viewport: { width: 820, height: 1180 } },
|
|
@@ -631,11 +641,16 @@ var ConfigSchema = {
|
|
|
631
641
|
type: "array",
|
|
632
642
|
items: { type: "string", enum: [constants_default.CHROME, constants_default.FIREFOX, constants_default.SAFARI, constants_default.EDGE] },
|
|
633
643
|
uniqueItems: true,
|
|
644
|
+
minItems: 1,
|
|
634
645
|
maxItems: 4,
|
|
635
|
-
errorMessage:
|
|
646
|
+
errorMessage: {
|
|
647
|
+
minItems: "Invalid config; browsers must have at least one entry",
|
|
648
|
+
_: `Invalid config; allowed browsers - ${constants_default.CHROME}, ${constants_default.FIREFOX}, ${constants_default.SAFARI}, ${constants_default.EDGE}`
|
|
649
|
+
}
|
|
636
650
|
},
|
|
637
651
|
viewports: {
|
|
638
652
|
type: "array",
|
|
653
|
+
minItems: 1,
|
|
639
654
|
items: {
|
|
640
655
|
type: "array",
|
|
641
656
|
oneOf: [
|
|
@@ -657,11 +672,51 @@ var ConfigSchema = {
|
|
|
657
672
|
},
|
|
658
673
|
uniqueItems: true,
|
|
659
674
|
maxItems: 5,
|
|
660
|
-
errorMessage:
|
|
675
|
+
errorMessage: {
|
|
676
|
+
minItems: "Invalid config; viewports must have at least one entry",
|
|
677
|
+
maxItems: "Invalid config; max unique viewports allowed - 5"
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
customViewports: {
|
|
681
|
+
type: "array",
|
|
682
|
+
minItems: 1,
|
|
683
|
+
items: {
|
|
684
|
+
type: "object",
|
|
685
|
+
properties: {
|
|
686
|
+
browser: {
|
|
687
|
+
type: "string",
|
|
688
|
+
enum: [constants_default.CHROME, constants_default.FIREFOX, constants_default.SAFARI, constants_default.EDGE],
|
|
689
|
+
errorMessage: `Invalid config; allowed browsers - ${constants_default.CHROME}, ${constants_default.FIREFOX}, ${constants_default.SAFARI}, ${constants_default.EDGE}`
|
|
690
|
+
},
|
|
691
|
+
viewport: {
|
|
692
|
+
type: "array",
|
|
693
|
+
oneOf: [
|
|
694
|
+
{
|
|
695
|
+
items: [{ type: "number", minimum: 320, maximum: 7680 }],
|
|
696
|
+
minItems: 1,
|
|
697
|
+
maxItems: 1
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
items: [
|
|
701
|
+
{ type: "number", minimum: 320, maximum: 7680 },
|
|
702
|
+
{ type: "number", minimum: 320, maximum: 7680 }
|
|
703
|
+
],
|
|
704
|
+
minItems: 2,
|
|
705
|
+
maxItems: 2
|
|
706
|
+
}
|
|
707
|
+
],
|
|
708
|
+
errorMessage: "Invalid config; customViewports viewport width/height must be >= 320 and <= 7680"
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
required: ["browser", "viewport"],
|
|
712
|
+
additionalProperties: false
|
|
713
|
+
},
|
|
714
|
+
errorMessage: {
|
|
715
|
+
minItems: "Invalid config; customViewports must have at least one entry",
|
|
716
|
+
_: "Invalid config; customViewports must be an array of {browser, viewport} objects"
|
|
717
|
+
}
|
|
661
718
|
}
|
|
662
|
-
}
|
|
663
|
-
required: ["browsers", "viewports"],
|
|
664
|
-
additionalProperties: false
|
|
719
|
+
}
|
|
665
720
|
},
|
|
666
721
|
mobile: {
|
|
667
722
|
type: "object",
|
|
@@ -1171,10 +1226,30 @@ var SnapshotSchema = {
|
|
|
1171
1226
|
},
|
|
1172
1227
|
uniqueItems: true,
|
|
1173
1228
|
errorMessage: "Invalid snapshot options; viewports must be an array of unique arrays."
|
|
1229
|
+
},
|
|
1230
|
+
customViewports: {
|
|
1231
|
+
type: "array",
|
|
1232
|
+
items: {
|
|
1233
|
+
type: "object",
|
|
1234
|
+
properties: {
|
|
1235
|
+
browser: {
|
|
1236
|
+
type: "string",
|
|
1237
|
+
enum: [constants_default.CHROME, constants_default.FIREFOX, constants_default.SAFARI, constants_default.EDGE]
|
|
1238
|
+
},
|
|
1239
|
+
viewport: {
|
|
1240
|
+
type: "array",
|
|
1241
|
+
items: { type: "number", minimum: 1 },
|
|
1242
|
+
minItems: 1,
|
|
1243
|
+
maxItems: 2
|
|
1244
|
+
}
|
|
1245
|
+
},
|
|
1246
|
+
required: ["browser", "viewport"],
|
|
1247
|
+
additionalProperties: false
|
|
1248
|
+
},
|
|
1249
|
+
errorMessage: "Invalid snapshot options; customViewports must be an array of {browser, viewport} objects"
|
|
1174
1250
|
}
|
|
1175
1251
|
},
|
|
1176
|
-
|
|
1177
|
-
errorMessage: "Invalid snapshot options; web must include viewports property."
|
|
1252
|
+
errorMessage: "Invalid snapshot options; web must include viewports or customViewports property."
|
|
1178
1253
|
},
|
|
1179
1254
|
mobile: {
|
|
1180
1255
|
type: "object",
|
|
@@ -1659,20 +1734,55 @@ function closeBrowsers(browsers) {
|
|
|
1659
1734
|
function getWebRenderViewports(ctx) {
|
|
1660
1735
|
let webRenderViewports = [];
|
|
1661
1736
|
if (ctx.config.web) {
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1737
|
+
if (ctx.config.web.browserViewports) {
|
|
1738
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1739
|
+
for (const viewports of Object.values(ctx.config.web.browserViewports)) {
|
|
1740
|
+
for (const viewport of viewports) {
|
|
1741
|
+
const key = `${viewport.width}x${viewport.height}`;
|
|
1742
|
+
if (!seen.has(key)) {
|
|
1743
|
+
seen.add(key);
|
|
1744
|
+
webRenderViewports.push({
|
|
1745
|
+
viewport,
|
|
1746
|
+
viewportString: `${viewport.width}${viewport.height ? "x" + viewport.height : ""}`,
|
|
1747
|
+
fullPage: viewport.height ? false : true,
|
|
1748
|
+
device: false
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
} else {
|
|
1754
|
+
for (const viewport of ctx.config.web.viewports) {
|
|
1755
|
+
webRenderViewports.push({
|
|
1756
|
+
viewport,
|
|
1757
|
+
viewportString: `${viewport.width}${viewport.height ? "x" + viewport.height : ""}`,
|
|
1758
|
+
fullPage: viewport.height ? false : true,
|
|
1759
|
+
device: false
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1669
1762
|
}
|
|
1670
1763
|
}
|
|
1671
1764
|
return webRenderViewports;
|
|
1672
1765
|
}
|
|
1673
1766
|
function getWebRenderViewportsForOptions(options) {
|
|
1674
1767
|
let webRenderViewports = [];
|
|
1675
|
-
if (options.web && Array.isArray(options.web.
|
|
1768
|
+
if (options.web && Array.isArray(options.web.customViewports) && options.web.customViewports.length > 0) {
|
|
1769
|
+
const browserViewports = transformCustomViewportsToBrowserViewports(options.web.customViewports);
|
|
1770
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1771
|
+
for (const viewports of Object.values(browserViewports)) {
|
|
1772
|
+
for (const vp of viewports) {
|
|
1773
|
+
const key = `${vp.width}x${vp.height}`;
|
|
1774
|
+
if (!seen.has(key)) {
|
|
1775
|
+
seen.add(key);
|
|
1776
|
+
webRenderViewports.push({
|
|
1777
|
+
viewport: vp,
|
|
1778
|
+
viewportString: `${vp.width}${vp.height ? "x" + vp.height : ""}`,
|
|
1779
|
+
fullPage: vp.height ? false : true,
|
|
1780
|
+
device: false
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
} else if (options.web && Array.isArray(options.web.viewports)) {
|
|
1676
1786
|
for (const viewport of options.web.viewports) {
|
|
1677
1787
|
if (Array.isArray(viewport) && viewport.length > 0) {
|
|
1678
1788
|
let viewportObj = {
|
|
@@ -1692,6 +1802,22 @@ function getWebRenderViewportsForOptions(options) {
|
|
|
1692
1802
|
}
|
|
1693
1803
|
return webRenderViewports;
|
|
1694
1804
|
}
|
|
1805
|
+
function transformCustomViewportsToBrowserViewports(customViewports) {
|
|
1806
|
+
const browserViewports = {};
|
|
1807
|
+
for (const entry of customViewports) {
|
|
1808
|
+
if (!browserViewports[entry.browser]) {
|
|
1809
|
+
browserViewports[entry.browser] = [];
|
|
1810
|
+
}
|
|
1811
|
+
const vp = { width: entry.viewport[0], height: entry.viewport[1] || 0 };
|
|
1812
|
+
const exists = browserViewports[entry.browser].some(
|
|
1813
|
+
(existing) => existing.width === vp.width && existing.height === vp.height
|
|
1814
|
+
);
|
|
1815
|
+
if (!exists) {
|
|
1816
|
+
browserViewports[entry.browser].push(vp);
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
return browserViewports;
|
|
1820
|
+
}
|
|
1695
1821
|
function getMobileRenderViewports(ctx) {
|
|
1696
1822
|
var _a;
|
|
1697
1823
|
let mobileRenderViewports = {};
|
|
@@ -1970,9 +2096,15 @@ function stopTunnelHelper(ctx) {
|
|
|
1970
2096
|
function calculateVariantCount(config) {
|
|
1971
2097
|
let variantCount = 0;
|
|
1972
2098
|
if (config.web) {
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2099
|
+
if (config.web.browserViewports) {
|
|
2100
|
+
for (const viewports of Object.values(config.web.browserViewports)) {
|
|
2101
|
+
variantCount += viewports.length;
|
|
2102
|
+
}
|
|
2103
|
+
} else {
|
|
2104
|
+
const browsers = config.web.browsers || [];
|
|
2105
|
+
const viewports = config.web.viewports || [];
|
|
2106
|
+
variantCount += browsers.length * viewports.length;
|
|
2107
|
+
}
|
|
1976
2108
|
}
|
|
1977
2109
|
if (config.mobile) {
|
|
1978
2110
|
const devices = config.mobile.devices || [];
|
|
@@ -1984,9 +2116,15 @@ function calculateVariantCountFromSnapshot(snapshot, globalConfig) {
|
|
|
1984
2116
|
var _a, _b;
|
|
1985
2117
|
let variantCount = 0;
|
|
1986
2118
|
if ((_a = snapshot.options) == null ? void 0 : _a.web) {
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
2119
|
+
if (snapshot.options.web.browserViewports) {
|
|
2120
|
+
for (const viewports of Object.values(snapshot.options.web.browserViewports)) {
|
|
2121
|
+
variantCount += viewports.length;
|
|
2122
|
+
}
|
|
2123
|
+
} else {
|
|
2124
|
+
const browsers = snapshot.options.web.browsers || [];
|
|
2125
|
+
const viewports = snapshot.options.web.viewports || [];
|
|
2126
|
+
variantCount += browsers.length * viewports.length;
|
|
2127
|
+
}
|
|
1990
2128
|
}
|
|
1991
2129
|
if ((_b = snapshot.options) == null ? void 0 : _b.mobile) {
|
|
1992
2130
|
const devices = snapshot.options.mobile.devices || [];
|
|
@@ -2987,7 +3125,7 @@ var authExec_default = (ctx) => {
|
|
|
2987
3125
|
};
|
|
2988
3126
|
|
|
2989
3127
|
// package.json
|
|
2990
|
-
var version = "4.1.
|
|
3128
|
+
var version = "4.1.59";
|
|
2991
3129
|
var package_default = {
|
|
2992
3130
|
name: "@lambdatest/smartui-cli",
|
|
2993
3131
|
version,
|
|
@@ -3844,7 +3982,7 @@ var httpClient = class {
|
|
|
3844
3982
|
}
|
|
3845
3983
|
};
|
|
3846
3984
|
var ctx_default = (options) => {
|
|
3847
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3985
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
3848
3986
|
let env = env_default();
|
|
3849
3987
|
let webConfig;
|
|
3850
3988
|
let mobileConfig;
|
|
@@ -3922,18 +4060,49 @@ var ctx_default = (options) => {
|
|
|
3922
4060
|
env.LT_USERNAME = options.userName;
|
|
3923
4061
|
env.LT_ACCESS_KEY = options.accessKey;
|
|
3924
4062
|
}
|
|
4063
|
+
if (((_b = config.web) == null ? void 0 : _b.customViewports) && !constants_default.ALLOWED_CUSTOM_VIEWPORT_COMMANDS.includes(options.commandType)) {
|
|
4064
|
+
throw new Error("customViewports is only supported for the exec command. Use browsers and viewports instead.");
|
|
4065
|
+
}
|
|
3925
4066
|
} catch (error) {
|
|
3926
4067
|
console.log(`[smartui] Error: ${error.message}`);
|
|
3927
4068
|
process.exit(1);
|
|
3928
4069
|
}
|
|
3929
4070
|
if (config.web) {
|
|
3930
|
-
|
|
3931
|
-
|
|
4071
|
+
const hasCustomViewports = config.web.customViewports && Array.isArray(config.web.customViewports) && config.web.customViewports.length > 0;
|
|
4072
|
+
const hasBrowsersAndViewports = config.web.browsers && config.web.browsers.length > 0 && config.web.viewports && config.web.viewports.length > 0;
|
|
4073
|
+
if (!hasCustomViewports && !hasBrowsersAndViewports) {
|
|
4074
|
+
throw new Error("Invalid config; web config must have either customViewports or both browsers and viewports");
|
|
4075
|
+
}
|
|
4076
|
+
if (hasCustomViewports) {
|
|
4077
|
+
const browserViewports = {};
|
|
4078
|
+
for (const entry of config.web.customViewports) {
|
|
4079
|
+
const vp = { width: entry.viewport[0], height: entry.viewport[1] || 0 };
|
|
4080
|
+
if (!browserViewports[entry.browser]) browserViewports[entry.browser] = [];
|
|
4081
|
+
if (!browserViewports[entry.browser].some((v) => v.width === vp.width && v.height === vp.height)) {
|
|
4082
|
+
browserViewports[entry.browser].push(vp);
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
const browsers = Object.keys(browserViewports);
|
|
4086
|
+
const allViewports = [];
|
|
4087
|
+
for (const vps of Object.values(browserViewports)) {
|
|
4088
|
+
for (const vp of vps) {
|
|
4089
|
+
if (!allViewports.some((v) => v.width === vp.width && v.height === vp.height)) {
|
|
4090
|
+
allViewports.push(vp);
|
|
4091
|
+
}
|
|
4092
|
+
}
|
|
4093
|
+
}
|
|
4094
|
+
webConfig = { browsers, viewports: allViewports, browserViewports };
|
|
4095
|
+
} else {
|
|
4096
|
+
webConfig = { browsers: config.web.browsers, viewports: [] };
|
|
4097
|
+
if ((_c = config.web) == null ? void 0 : _c.viewports) {
|
|
4098
|
+
for (let viewport of config.web.viewports) webConfig.viewports.push({ width: viewport[0], height: viewport[1] || 0 });
|
|
4099
|
+
}
|
|
4100
|
+
}
|
|
3932
4101
|
}
|
|
3933
4102
|
if (config.mobile) {
|
|
3934
4103
|
mobileConfig = {
|
|
3935
4104
|
devices: config.mobile.devices,
|
|
3936
|
-
fullPage: (
|
|
4105
|
+
fullPage: (_d = config.mobile.fullPage) != null ? _d : true,
|
|
3937
4106
|
orientation: config.mobile.orientation || constants_default.MOBILE_ORIENTATION_PORTRAIT
|
|
3938
4107
|
};
|
|
3939
4108
|
}
|
|
@@ -4000,18 +4169,18 @@ var ctx_default = (options) => {
|
|
|
4000
4169
|
waitForPageRender: config.waitForPageRender || 0,
|
|
4001
4170
|
waitForTimeout: config.waitForTimeout || 0,
|
|
4002
4171
|
waitForDiscovery: config.waitForDiscovery || 3e4,
|
|
4003
|
-
enableJavaScript: (
|
|
4004
|
-
cliEnableJavaScript: (
|
|
4172
|
+
enableJavaScript: (_e = config.enableJavaScript) != null ? _e : false,
|
|
4173
|
+
cliEnableJavaScript: (_f = config.cliEnableJavaScript) != null ? _f : true,
|
|
4005
4174
|
scrollTime: config.scrollTime || constants_default.DEFAULT_SCROLL_TIME,
|
|
4006
4175
|
allowedHostnames: config.allowedHostnames || [],
|
|
4007
4176
|
allowedAssets: config.allowedAssets || [],
|
|
4008
4177
|
basicAuthorization: basicAuthObj,
|
|
4009
4178
|
lazyLoadConfiguration: lazyLoadConfigObj,
|
|
4010
|
-
smartIgnore: (
|
|
4011
|
-
delayedUpload: (
|
|
4012
|
-
useGlobalCache: (
|
|
4013
|
-
ignoreHTTPSErrors: (
|
|
4014
|
-
skipBuildCreation: (
|
|
4179
|
+
smartIgnore: (_g = config.smartIgnore) != null ? _g : false,
|
|
4180
|
+
delayedUpload: (_h = config.delayedUpload) != null ? _h : false,
|
|
4181
|
+
useGlobalCache: (_i = config.useGlobalCache) != null ? _i : false,
|
|
4182
|
+
ignoreHTTPSErrors: (_j = config.ignoreHTTPSErrors) != null ? _j : false,
|
|
4183
|
+
skipBuildCreation: (_k = config.skipBuildCreation) != null ? _k : false,
|
|
4015
4184
|
tunnel: tunnelObj,
|
|
4016
4185
|
dedicatedProxyURL: config.dedicatedProxyURL || "",
|
|
4017
4186
|
geolocation: config.geolocation || "",
|
|
@@ -4024,7 +4193,7 @@ var ctx_default = (options) => {
|
|
|
4024
4193
|
loadDomContent,
|
|
4025
4194
|
approvalThreshold: config.approvalThreshold,
|
|
4026
4195
|
rejectionThreshold: config.rejectionThreshold,
|
|
4027
|
-
showRenderErrors: (
|
|
4196
|
+
showRenderErrors: (_l = config.showRenderErrors) != null ? _l : false,
|
|
4028
4197
|
customCSS: config.customCSS
|
|
4029
4198
|
},
|
|
4030
4199
|
uploadFilePath: "",
|
|
@@ -4152,7 +4321,7 @@ var git_default = (ctx) => {
|
|
|
4152
4321
|
commitId: gitInfo.commit_id.slice(0, 6) || "",
|
|
4153
4322
|
commitMessage: gitInfo.commit_body || "",
|
|
4154
4323
|
commitAuthor: gitInfo.commit_author || "",
|
|
4155
|
-
githubURL: githubURL ? githubURL : ctx.env.GIT_URL ? ctx.env.GIT_URL : `${constants_default.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${gitInfo.commit_id}
|
|
4324
|
+
githubURL: githubURL ? githubURL : ctx.env.GIT_URL ? ctx.env.GIT_URL : process.env.GITHUB_REPOSITORY ? `${constants_default.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${gitInfo.commit_id}` : "",
|
|
4156
4325
|
baselineBranch: ctx.options.baselineBranch || ctx.env.BASELINE_BRANCH || ""
|
|
4157
4326
|
};
|
|
4158
4327
|
} else {
|
|
@@ -4172,7 +4341,7 @@ var git_default = (ctx) => {
|
|
|
4172
4341
|
commitId: res[0] || "",
|
|
4173
4342
|
commitMessage: res[2] || "",
|
|
4174
4343
|
commitAuthor: res[7] || "",
|
|
4175
|
-
githubURL: githubURL ? githubURL : ctx.env.GIT_URL ? ctx.env.GIT_URL : `${constants_default.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${res[1]}
|
|
4344
|
+
githubURL: githubURL ? githubURL : ctx.env.GIT_URL ? ctx.env.GIT_URL : process.env.GITHUB_REPOSITORY ? `${constants_default.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${res[1]}` : "",
|
|
4176
4345
|
baselineBranch: ctx.options.baselineBranch || ctx.env.BASELINE_BRANCH || ""
|
|
4177
4346
|
};
|
|
4178
4347
|
}
|
|
@@ -4558,6 +4727,7 @@ var normalizeSameSite = (value) => {
|
|
|
4558
4727
|
};
|
|
4559
4728
|
function prepareSnapshot(snapshot, ctx) {
|
|
4560
4729
|
return __async(this, null, function* () {
|
|
4730
|
+
var _a;
|
|
4561
4731
|
let processedOptions = {};
|
|
4562
4732
|
processedOptions.cliEnableJavascript = ctx.config.cliEnableJavaScript;
|
|
4563
4733
|
processedOptions.ignoreHTTPSErrors = ctx.config.ignoreHTTPSErrors;
|
|
@@ -4579,8 +4749,8 @@ function prepareSnapshot(snapshot, ctx) {
|
|
|
4579
4749
|
if (options && Object.keys(options).length) {
|
|
4580
4750
|
ctx.log.debug(`Snapshot options: ${JSON.stringify(options)}`);
|
|
4581
4751
|
const isNotAllEmpty = (obj) => {
|
|
4582
|
-
var
|
|
4583
|
-
for (let key in obj) if ((
|
|
4752
|
+
var _a2;
|
|
4753
|
+
for (let key in obj) if ((_a2 = obj[key]) == null ? void 0 : _a2.length) return true;
|
|
4584
4754
|
return false;
|
|
4585
4755
|
};
|
|
4586
4756
|
if (options.loadDomContent) {
|
|
@@ -4601,13 +4771,20 @@ function prepareSnapshot(snapshot, ctx) {
|
|
|
4601
4771
|
}
|
|
4602
4772
|
if (options.web && Object.keys(options.web).length) {
|
|
4603
4773
|
processedOptions.web = {};
|
|
4604
|
-
if (options.web.
|
|
4605
|
-
processedOptions.web.
|
|
4606
|
-
|
|
4607
|
-
)
|
|
4774
|
+
if (options.web.customViewports && Array.isArray(options.web.customViewports) && options.web.customViewports.length > 0) {
|
|
4775
|
+
processedOptions.web.browserViewports = transformCustomViewportsToBrowserViewports(options.web.customViewports);
|
|
4776
|
+
} else {
|
|
4777
|
+
if (options.web.viewports && options.web.viewports.length > 0) {
|
|
4778
|
+
processedOptions.web.viewports = options.web.viewports.filter(
|
|
4779
|
+
(viewport) => Array.isArray(viewport) && viewport.length > 0
|
|
4780
|
+
);
|
|
4781
|
+
}
|
|
4782
|
+
if (options.web.browsers && options.web.browsers.length > 0) {
|
|
4783
|
+
processedOptions.web.browsers = options.web.browsers;
|
|
4784
|
+
}
|
|
4608
4785
|
}
|
|
4609
|
-
if (
|
|
4610
|
-
processedOptions.web
|
|
4786
|
+
if (Object.keys(processedOptions.web).length === 0) {
|
|
4787
|
+
delete processedOptions.web;
|
|
4611
4788
|
}
|
|
4612
4789
|
}
|
|
4613
4790
|
if (options.mobile && Object.keys(options.mobile).length) {
|
|
@@ -4663,6 +4840,9 @@ function prepareSnapshot(snapshot, ctx) {
|
|
|
4663
4840
|
processedOptions.ignoreType = options.ignoreType;
|
|
4664
4841
|
}
|
|
4665
4842
|
}
|
|
4843
|
+
if (!processedOptions.web && ((_a = ctx.config.web) == null ? void 0 : _a.browserViewports)) {
|
|
4844
|
+
processedOptions.web = { browserViewports: ctx.config.web.browserViewports };
|
|
4845
|
+
}
|
|
4666
4846
|
if (ctx.config.tunnel) {
|
|
4667
4847
|
if (ctx.tunnelDetails && ctx.tunnelDetails.tunnelPort != -1 && ctx.tunnelDetails.tunnelHost != "") {
|
|
4668
4848
|
const tunnelAddress = `http://${ctx.tunnelDetails.tunnelHost}:${ctx.tunnelDetails.tunnelPort}`;
|
|
@@ -4734,7 +4914,7 @@ function prepareSnapshot(snapshot, ctx) {
|
|
|
4734
4914
|
}
|
|
4735
4915
|
function processSnapshot(snapshot, ctx) {
|
|
4736
4916
|
return __async(this, null, function* () {
|
|
4737
|
-
var _a, _b;
|
|
4917
|
+
var _a, _b, _c;
|
|
4738
4918
|
updateLogContext({ task: "discovery" });
|
|
4739
4919
|
ctx.log.debug(`Processing snapshot ${snapshot.name} ${snapshot.url}`);
|
|
4740
4920
|
const isHeadless = ((_a = process.env.HEADLESS) == null ? void 0 : _a.toLowerCase()) === "false" ? false : true;
|
|
@@ -5023,13 +5203,20 @@ function processSnapshot(snapshot, ctx) {
|
|
|
5023
5203
|
}
|
|
5024
5204
|
if (options.web && Object.keys(options.web).length) {
|
|
5025
5205
|
processedOptions.web = {};
|
|
5026
|
-
if (options.web.
|
|
5027
|
-
processedOptions.web.
|
|
5028
|
-
|
|
5029
|
-
)
|
|
5206
|
+
if (options.web.customViewports && Array.isArray(options.web.customViewports) && options.web.customViewports.length > 0) {
|
|
5207
|
+
processedOptions.web.browserViewports = transformCustomViewportsToBrowserViewports(options.web.customViewports);
|
|
5208
|
+
} else {
|
|
5209
|
+
if (options.web.viewports && options.web.viewports.length > 0) {
|
|
5210
|
+
processedOptions.web.viewports = options.web.viewports.filter(
|
|
5211
|
+
(viewport) => Array.isArray(viewport) && viewport.length > 0
|
|
5212
|
+
);
|
|
5213
|
+
}
|
|
5214
|
+
if (options.web.browsers && options.web.browsers.length > 0) {
|
|
5215
|
+
processedOptions.web.browsers = options.web.browsers;
|
|
5216
|
+
}
|
|
5030
5217
|
}
|
|
5031
|
-
if (
|
|
5032
|
-
processedOptions.web
|
|
5218
|
+
if (Object.keys(processedOptions.web).length === 0) {
|
|
5219
|
+
delete processedOptions.web;
|
|
5033
5220
|
}
|
|
5034
5221
|
}
|
|
5035
5222
|
if (options.mobile && Object.keys(options.mobile).length) {
|
|
@@ -5087,6 +5274,9 @@ function processSnapshot(snapshot, ctx) {
|
|
|
5087
5274
|
processedOptions.ignoreType = options.ignoreType;
|
|
5088
5275
|
}
|
|
5089
5276
|
}
|
|
5277
|
+
if (!processedOptions.web && ((_c = ctx.config.web) == null ? void 0 : _c.browserViewports)) {
|
|
5278
|
+
processedOptions.web = { browserViewports: ctx.config.web.browserViewports };
|
|
5279
|
+
}
|
|
5090
5280
|
if (ctx.config.tunnel) {
|
|
5091
5281
|
if (ctx.tunnelDetails && ctx.tunnelDetails.tunnelPort != -1 && ctx.tunnelDetails.tunnelHost != "") {
|
|
5092
5282
|
const tunnelAddress = `http://${ctx.tunnelDetails.tunnelHost}:${ctx.tunnelDetails.tunnelPort}`;
|
|
@@ -5458,28 +5648,42 @@ var Queue = class {
|
|
|
5458
5648
|
}
|
|
5459
5649
|
}
|
|
5460
5650
|
processGenerateVariants(snapshot) {
|
|
5651
|
+
var _a, _b;
|
|
5652
|
+
let hasWebOptions = ((_a = snapshot.options) == null ? void 0 : _a.web) && Object.keys(snapshot.options.web).length > 0;
|
|
5653
|
+
let hasMobileOptions = ((_b = snapshot.options) == null ? void 0 : _b.mobile) && Object.keys(snapshot.options.mobile).length > 0;
|
|
5461
5654
|
if (snapshot.options) {
|
|
5462
|
-
if (
|
|
5655
|
+
if (hasWebOptions) {
|
|
5463
5656
|
this.generateWebVariants(snapshot, snapshot.options.web);
|
|
5464
5657
|
}
|
|
5465
|
-
if (
|
|
5658
|
+
if (hasMobileOptions) {
|
|
5466
5659
|
this.generateMobileVariants(snapshot, snapshot.options.mobile);
|
|
5467
5660
|
}
|
|
5468
5661
|
}
|
|
5469
|
-
if (!snapshot.options ||
|
|
5662
|
+
if (!snapshot.options || !hasWebOptions && !hasMobileOptions) {
|
|
5470
5663
|
this.generateVariants(snapshot, this.ctx.config);
|
|
5471
5664
|
}
|
|
5472
5665
|
}
|
|
5473
5666
|
generateVariants(snapshot, config) {
|
|
5474
5667
|
if (config.web) {
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5668
|
+
if (config.web.browserViewports) {
|
|
5669
|
+
for (const [browser, viewports] of Object.entries(config.web.browserViewports)) {
|
|
5670
|
+
for (const viewport of viewports) {
|
|
5671
|
+
const width = viewport.width;
|
|
5672
|
+
const height = viewport.height || 0;
|
|
5673
|
+
const variant = `${snapshot.name}_${browser}_viewport[${width}]_viewport[${height}]`;
|
|
5674
|
+
this.variants.push(variant);
|
|
5675
|
+
}
|
|
5676
|
+
}
|
|
5677
|
+
} else {
|
|
5678
|
+
const browsers = config.web.browsers || [];
|
|
5679
|
+
const viewports = config.web.viewports || [];
|
|
5680
|
+
for (const browser of browsers) {
|
|
5681
|
+
for (const viewport of viewports) {
|
|
5682
|
+
const width = viewport.width;
|
|
5683
|
+
const height = viewport.height || 0;
|
|
5684
|
+
const variant = `${snapshot.name}_${browser}_viewport[${width}]_viewport[${height}]`;
|
|
5685
|
+
this.variants.push(variant);
|
|
5686
|
+
}
|
|
5483
5687
|
}
|
|
5484
5688
|
}
|
|
5485
5689
|
}
|
|
@@ -5494,15 +5698,24 @@ var Queue = class {
|
|
|
5494
5698
|
}
|
|
5495
5699
|
generateWebVariants(snapshot, webConfig) {
|
|
5496
5700
|
var _a, _b, _c;
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
const
|
|
5502
|
-
const height = viewport[1] || 0;
|
|
5503
|
-
const variant = `${snapshot.name}_${browser}_viewport[${width}]_viewport[${height}]`;
|
|
5701
|
+
if (webConfig.customViewports && Array.isArray(webConfig.customViewports) && webConfig.customViewports.length > 0) {
|
|
5702
|
+
for (const entry of webConfig.customViewports) {
|
|
5703
|
+
const width = entry.viewport[0];
|
|
5704
|
+
const height = entry.viewport[1] || 0;
|
|
5705
|
+
const variant = `${snapshot.name}_${entry.browser}_viewport[${width}]_viewport[${height}]`;
|
|
5504
5706
|
this.variants.push(variant);
|
|
5505
5707
|
}
|
|
5708
|
+
} else {
|
|
5709
|
+
const browsers = (_c = (_b = webConfig.browsers) != null ? _b : (_a = this.ctx.config.web) == null ? void 0 : _a.browsers) != null ? _c : [constants_default.CHROME, constants_default.EDGE, constants_default.FIREFOX, constants_default.SAFARI];
|
|
5710
|
+
const viewports = webConfig.viewports || [];
|
|
5711
|
+
for (const browser of browsers) {
|
|
5712
|
+
for (const viewport of viewports) {
|
|
5713
|
+
const width = viewport[0];
|
|
5714
|
+
const height = viewport[1] || 0;
|
|
5715
|
+
const variant = `${snapshot.name}_${browser}_viewport[${width}]_viewport[${height}]`;
|
|
5716
|
+
this.variants.push(variant);
|
|
5717
|
+
}
|
|
5718
|
+
}
|
|
5506
5719
|
}
|
|
5507
5720
|
}
|
|
5508
5721
|
generateMobileVariants(snapshot, mobileConfig) {
|
|
@@ -5515,16 +5728,19 @@ var Queue = class {
|
|
|
5515
5728
|
}
|
|
5516
5729
|
}
|
|
5517
5730
|
filterExistingVariants(snapshot, config) {
|
|
5731
|
+
var _a, _b;
|
|
5518
5732
|
let drop = true;
|
|
5519
|
-
|
|
5733
|
+
let hasWebOptions = ((_a = snapshot.options) == null ? void 0 : _a.web) && Object.keys(snapshot.options.web).length > 0;
|
|
5734
|
+
let hasMobileOptions = ((_b = snapshot.options) == null ? void 0 : _b.mobile) && Object.keys(snapshot.options.mobile).length > 0;
|
|
5735
|
+
if (snapshot.options && hasWebOptions) {
|
|
5520
5736
|
const webDrop = this.filterWebVariants(snapshot, snapshot.options.web);
|
|
5521
5737
|
if (!webDrop) drop = false;
|
|
5522
5738
|
}
|
|
5523
|
-
if (snapshot.options &&
|
|
5739
|
+
if (snapshot.options && hasMobileOptions) {
|
|
5524
5740
|
const mobileDrop = this.filterMobileVariants(snapshot, snapshot.options.mobile);
|
|
5525
5741
|
if (!mobileDrop) drop = false;
|
|
5526
5742
|
}
|
|
5527
|
-
if (!snapshot.options ||
|
|
5743
|
+
if (!snapshot.options || !hasWebOptions && !hasMobileOptions) {
|
|
5528
5744
|
const configDrop = this.filterVariants(snapshot, config);
|
|
5529
5745
|
if (!configDrop) drop = false;
|
|
5530
5746
|
}
|
|
@@ -5534,28 +5750,63 @@ var Queue = class {
|
|
|
5534
5750
|
var _a;
|
|
5535
5751
|
let allVariantsDropped = true;
|
|
5536
5752
|
if (config.web) {
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5753
|
+
if (config.web.browserViewports) {
|
|
5754
|
+
const customViewports = [];
|
|
5755
|
+
for (const [browser, viewports] of Object.entries(config.web.browserViewports)) {
|
|
5756
|
+
for (const viewport of viewports) {
|
|
5757
|
+
const width = viewport.width;
|
|
5758
|
+
const height = viewport.height || 0;
|
|
5759
|
+
const variant = `${snapshot.name}_${browser}_viewport[${width}]_viewport[${height}]`;
|
|
5760
|
+
if (!this.variants.includes(variant)) {
|
|
5761
|
+
allVariantsDropped = false;
|
|
5762
|
+
if (height > 0) {
|
|
5763
|
+
customViewports.push({ browser, viewport: [width, height] });
|
|
5764
|
+
} else {
|
|
5765
|
+
customViewports.push({ browser, viewport: [width] });
|
|
5766
|
+
}
|
|
5550
5767
|
}
|
|
5768
|
+
}
|
|
5769
|
+
}
|
|
5770
|
+
if (customViewports.length > 0) {
|
|
5771
|
+
if (!snapshot.options) snapshot.options = {};
|
|
5772
|
+
snapshot.options.web = { browsers: [], viewports: [], customViewports };
|
|
5773
|
+
for (const entry of customViewports) {
|
|
5774
|
+
if (!snapshot.options.web.browsers.includes(entry.browser)) {
|
|
5775
|
+
snapshot.options.web.browsers.push(entry.browser);
|
|
5776
|
+
}
|
|
5777
|
+
const vp = entry.viewport;
|
|
5551
5778
|
const viewportExists = snapshot.options.web.viewports.some(
|
|
5552
|
-
(
|
|
5779
|
+
(ev) => ev[0] === vp[0] && (ev.length < 2 || ev[1] === (vp[1] || 0))
|
|
5553
5780
|
);
|
|
5554
5781
|
if (!viewportExists) {
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5782
|
+
snapshot.options.web.viewports.push(vp);
|
|
5783
|
+
}
|
|
5784
|
+
}
|
|
5785
|
+
}
|
|
5786
|
+
} else {
|
|
5787
|
+
const browsers = config.web.browsers || [];
|
|
5788
|
+
const viewports = config.web.viewports || [];
|
|
5789
|
+
for (const browser of browsers) {
|
|
5790
|
+
for (const viewport of viewports) {
|
|
5791
|
+
const width = viewport.width;
|
|
5792
|
+
const height = viewport.height || 0;
|
|
5793
|
+
const variant = `${snapshot.name}_${browser}_viewport[${width}]_viewport[${height}]`;
|
|
5794
|
+
if (!this.variants.includes(variant)) {
|
|
5795
|
+
allVariantsDropped = false;
|
|
5796
|
+
if (!snapshot.options) snapshot.options = {};
|
|
5797
|
+
if (!snapshot.options.web) snapshot.options.web = { browsers: [], viewports: [] };
|
|
5798
|
+
if (!snapshot.options.web.browsers.includes(browser)) {
|
|
5799
|
+
snapshot.options.web.browsers.push(browser);
|
|
5800
|
+
}
|
|
5801
|
+
const viewportExists = snapshot.options.web.viewports.some(
|
|
5802
|
+
(existingViewport) => existingViewport[0] === width && (existingViewport.length < 2 || existingViewport[1] === height)
|
|
5803
|
+
);
|
|
5804
|
+
if (!viewportExists) {
|
|
5805
|
+
if (height > 0) {
|
|
5806
|
+
snapshot.options.web.viewports.push([width, height]);
|
|
5807
|
+
} else {
|
|
5808
|
+
snapshot.options.web.viewports.push([width]);
|
|
5809
|
+
}
|
|
5559
5810
|
}
|
|
5560
5811
|
}
|
|
5561
5812
|
}
|
|
@@ -5583,31 +5834,60 @@ var Queue = class {
|
|
|
5583
5834
|
}
|
|
5584
5835
|
filterWebVariants(snapshot, webConfig) {
|
|
5585
5836
|
var _a, _b, _c;
|
|
5586
|
-
const browsers = (_c = (_b = webConfig.browsers) != null ? _b : (_a = this.ctx.config.web) == null ? void 0 : _a.browsers) != null ? _c : [constants_default.CHROME, constants_default.EDGE, constants_default.FIREFOX, constants_default.SAFARI];
|
|
5587
|
-
const viewports = webConfig.viewports || [];
|
|
5588
5837
|
let allVariantsDropped = true;
|
|
5589
5838
|
if (!snapshot.options) {
|
|
5590
5839
|
snapshot.options = {};
|
|
5591
5840
|
}
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
const
|
|
5841
|
+
if (webConfig.customViewports && Array.isArray(webConfig.customViewports) && webConfig.customViewports.length > 0) {
|
|
5842
|
+
const filteredCustomViewports = [];
|
|
5843
|
+
const browsers = [];
|
|
5844
|
+
const viewports = [];
|
|
5845
|
+
for (const entry of webConfig.customViewports) {
|
|
5846
|
+
const width = entry.viewport[0];
|
|
5847
|
+
const height = entry.viewport[1] || 0;
|
|
5848
|
+
const variant = `${snapshot.name}_${entry.browser}_viewport[${width}]_viewport[${height}]`;
|
|
5598
5849
|
if (!this.variants.includes(variant)) {
|
|
5599
5850
|
allVariantsDropped = false;
|
|
5600
|
-
|
|
5601
|
-
|
|
5851
|
+
filteredCustomViewports.push(entry);
|
|
5852
|
+
if (!browsers.includes(entry.browser)) {
|
|
5853
|
+
browsers.push(entry.browser);
|
|
5602
5854
|
}
|
|
5603
|
-
const viewportExists =
|
|
5604
|
-
(
|
|
5855
|
+
const viewportExists = viewports.some(
|
|
5856
|
+
(ev) => ev[0] === width && (ev.length < 2 || ev[1] === height)
|
|
5605
5857
|
);
|
|
5606
5858
|
if (!viewportExists) {
|
|
5607
5859
|
if (height > 0) {
|
|
5608
|
-
|
|
5860
|
+
viewports.push([width, height]);
|
|
5609
5861
|
} else {
|
|
5610
|
-
|
|
5862
|
+
viewports.push([width]);
|
|
5863
|
+
}
|
|
5864
|
+
}
|
|
5865
|
+
}
|
|
5866
|
+
}
|
|
5867
|
+
snapshot.options.web = { browsers, viewports, customViewports: filteredCustomViewports };
|
|
5868
|
+
} else {
|
|
5869
|
+
snapshot.options.web = { browsers: [], viewports: [] };
|
|
5870
|
+
const browsers = (_c = (_b = webConfig.browsers) != null ? _b : (_a = this.ctx.config.web) == null ? void 0 : _a.browsers) != null ? _c : [constants_default.CHROME, constants_default.EDGE, constants_default.FIREFOX, constants_default.SAFARI];
|
|
5871
|
+
const viewports = webConfig.viewports || [];
|
|
5872
|
+
for (const browser of browsers) {
|
|
5873
|
+
for (const viewport of viewports) {
|
|
5874
|
+
const width = viewport[0];
|
|
5875
|
+
const height = viewport[1] || 0;
|
|
5876
|
+
const variant = `${snapshot.name}_${browser}_viewport[${width}]_viewport[${height}]`;
|
|
5877
|
+
if (!this.variants.includes(variant)) {
|
|
5878
|
+
allVariantsDropped = false;
|
|
5879
|
+
if (!snapshot.options.web.browsers.includes(browser)) {
|
|
5880
|
+
snapshot.options.web.browsers.push(browser);
|
|
5881
|
+
}
|
|
5882
|
+
const viewportExists = snapshot.options.web.viewports.some(
|
|
5883
|
+
(existingViewport) => existingViewport[0] === width && (existingViewport.length < 2 || existingViewport[1] === height)
|
|
5884
|
+
);
|
|
5885
|
+
if (!viewportExists) {
|
|
5886
|
+
if (height > 0) {
|
|
5887
|
+
snapshot.options.web.viewports.push([width, height]);
|
|
5888
|
+
} else {
|
|
5889
|
+
snapshot.options.web.viewports.push([width]);
|
|
5890
|
+
}
|
|
5611
5891
|
}
|
|
5612
5892
|
}
|
|
5613
5893
|
}
|
|
@@ -5918,7 +6198,9 @@ command.name("exec").description("Run test commands around SmartUI").argument("<
|
|
|
5918
6198
|
console.log(`Error: The '--buildName' option cannot be an empty string.`);
|
|
5919
6199
|
process.exit(1);
|
|
5920
6200
|
}
|
|
5921
|
-
let
|
|
6201
|
+
let opts = command11.optsWithGlobals();
|
|
6202
|
+
opts.commandType = constants_default.COMMAND_TYPE_EXEC;
|
|
6203
|
+
let ctx = ctx_default(opts);
|
|
5922
6204
|
if (!which__default.default.sync(execCommand[0], { nothrow: true })) {
|
|
5923
6205
|
ctx.log.error(`Error: Command not found "${execCommand[0]}"`);
|
|
5924
6206
|
return;
|
|
@@ -6759,7 +7041,9 @@ command2.name("capture").description("Capture screenshots of static sites").argu
|
|
|
6759
7041
|
console.log(`Error: The '--buildName' option cannot be an empty string.`);
|
|
6760
7042
|
process.exit(1);
|
|
6761
7043
|
}
|
|
6762
|
-
let
|
|
7044
|
+
let opts = command11.optsWithGlobals();
|
|
7045
|
+
opts.commandType = constants_default.COMMAND_TYPE_CAPTURE;
|
|
7046
|
+
let ctx = ctx_default(opts);
|
|
6763
7047
|
ctx.isSnapshotCaptured = true;
|
|
6764
7048
|
if (!fs6__default.default.existsSync(file)) {
|
|
6765
7049
|
ctx.log.error(`Web Static Config file ${file} not found.`);
|
|
@@ -6854,7 +7138,9 @@ command3.name("upload").description("Upload screenshots from given directory").a
|
|
|
6854
7138
|
console.log(`Error: The '--buildName' option cannot be an empty string.`);
|
|
6855
7139
|
process.exit(1);
|
|
6856
7140
|
}
|
|
6857
|
-
let
|
|
7141
|
+
let opts = command11.optsWithGlobals();
|
|
7142
|
+
opts.commandType = constants_default.COMMAND_TYPE_UPLOAD;
|
|
7143
|
+
let ctx = ctx_default(opts);
|
|
6858
7144
|
ctx.isSnapshotCaptured = true;
|
|
6859
7145
|
if (!fs6__default.default.existsSync(directory)) {
|
|
6860
7146
|
console.log(`Error: The provided directory ${directory} not found.`);
|
|
@@ -7137,7 +7423,9 @@ var uploadAppFigmaCommand = new commander.Command();
|
|
|
7137
7423
|
uploadFigma.name("upload-figma").description("Capture screenshots of static sites").argument("<file>", "figma design config file").option("--markBaseline", "Mark the uploaded images as baseline").option("--buildName <buildName>", "Name of the build").action(function(file, _, command11) {
|
|
7138
7424
|
return __async(this, null, function* () {
|
|
7139
7425
|
var _a, _b;
|
|
7140
|
-
let
|
|
7426
|
+
let opts = command11.optsWithGlobals();
|
|
7427
|
+
opts.commandType = constants_default.COMMAND_TYPE_UPLOAD_FIGMA;
|
|
7428
|
+
let ctx = ctx_default(opts);
|
|
7141
7429
|
ctx.isSnapshotCaptured = true;
|
|
7142
7430
|
if (!fs6__default.default.existsSync(file)) {
|
|
7143
7431
|
console.log(`Error: Figma Config file ${file} not found.`);
|
|
@@ -7179,7 +7467,9 @@ uploadFigma.name("upload-figma").description("Capture screenshots of static site
|
|
|
7179
7467
|
uploadWebFigmaCommand.name("upload-figma-web").description("Capture figma screenshots into CLI build").argument("<file>", "figma config config file").option("--markBaseline", "Mark the uploaded images as baseline").option("--buildName <buildName>", "Name of the build").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").action(function(file, _, command11) {
|
|
7180
7468
|
return __async(this, null, function* () {
|
|
7181
7469
|
var _a;
|
|
7182
|
-
let
|
|
7470
|
+
let opts = command11.optsWithGlobals();
|
|
7471
|
+
opts.commandType = constants_default.COMMAND_TYPE_UPLOAD_FIGMA;
|
|
7472
|
+
let ctx = ctx_default(opts);
|
|
7183
7473
|
if (!fs6__default.default.existsSync(file)) {
|
|
7184
7474
|
console.log(`Error: figma-web config file ${file} not found.`);
|
|
7185
7475
|
return;
|
|
@@ -7232,7 +7522,9 @@ uploadWebFigmaCommand.name("upload-figma-web").description("Capture figma screen
|
|
|
7232
7522
|
uploadAppFigmaCommand.name("upload-figma-app").description("Capture figma screenshots into App Build").argument("<file>", "figma config config file").option("--markBaseline", "Mark the uploaded images as baseline").option("--buildName <buildName>", "Name of the build").option("--fetch-results [filename]", "Fetch results and optionally specify an output file, e.g., <filename>.json").action(function(file, _, command11) {
|
|
7233
7523
|
return __async(this, null, function* () {
|
|
7234
7524
|
var _a;
|
|
7235
|
-
let
|
|
7525
|
+
let opts = command11.optsWithGlobals();
|
|
7526
|
+
opts.commandType = constants_default.COMMAND_TYPE_UPLOAD_FIGMA;
|
|
7527
|
+
let ctx = ctx_default(opts);
|
|
7236
7528
|
if (!fs6__default.default.existsSync(file)) {
|
|
7237
7529
|
console.log(`Error: figma-app config file ${file} not found.`);
|
|
7238
7530
|
return;
|
|
@@ -7291,7 +7583,9 @@ command4.name("exec:start").description("Start SmartUI server").option("-P, --po
|
|
|
7291
7583
|
console.log(`Error: The '--buildName' option cannot be an empty string.`);
|
|
7292
7584
|
process.exit(1);
|
|
7293
7585
|
}
|
|
7294
|
-
let
|
|
7586
|
+
let opts = command4.optsWithGlobals();
|
|
7587
|
+
opts.commandType = constants_default.COMMAND_TYPE_EXEC_START;
|
|
7588
|
+
let ctx = ctx_default(opts);
|
|
7295
7589
|
ctx.snapshotQueue = new Queue(ctx);
|
|
7296
7590
|
ctx.totalSnapshots = 0;
|
|
7297
7591
|
ctx.isStartExec = true;
|
|
@@ -7491,7 +7785,9 @@ var command7 = new commander.Command();
|
|
|
7491
7785
|
command7.name("branch").description("Merge a source branch into the target branch").requiredOption("--source <string>", "Source branch to merge").requiredOption("--target <string>", "Target branch to merge into").action(function(options) {
|
|
7492
7786
|
return __async(this, null, function* () {
|
|
7493
7787
|
const { source, target } = options;
|
|
7494
|
-
let
|
|
7788
|
+
let opts = command7.optsWithGlobals();
|
|
7789
|
+
opts.commandType = constants_default.COMMAND_TYPE_MERGE;
|
|
7790
|
+
let ctx = ctx_default(opts);
|
|
7495
7791
|
if (!source || source.trim() === "") {
|
|
7496
7792
|
ctx.log.error("Error: The --source option cannot be empty.");
|
|
7497
7793
|
process.exit(1);
|
|
@@ -7574,7 +7870,9 @@ var command8 = new commander.Command();
|
|
|
7574
7870
|
command8.name("build").description("Merge a source build into the target build").requiredOption("--source <string>", "Source build to merge").requiredOption("--target <string>", "Target build to merge into").action(function(options) {
|
|
7575
7871
|
return __async(this, null, function* () {
|
|
7576
7872
|
const { source, target } = options;
|
|
7577
|
-
let
|
|
7873
|
+
let opts = command8.optsWithGlobals();
|
|
7874
|
+
opts.commandType = constants_default.COMMAND_TYPE_MERGE;
|
|
7875
|
+
let ctx = ctx_default(opts);
|
|
7578
7876
|
if (!source || source.trim() === "") {
|
|
7579
7877
|
ctx.log.error("Error: The --source option cannot be empty.");
|
|
7580
7878
|
process.exit(1);
|
|
@@ -7746,7 +8044,9 @@ command10.name("upload-pdf").description("Upload PDFs for visual comparison").ar
|
|
|
7746
8044
|
console.log(`Error: The '--buildName' option cannot be an empty string.`);
|
|
7747
8045
|
process.exit(1);
|
|
7748
8046
|
}
|
|
7749
|
-
let
|
|
8047
|
+
let opts = command11.optsWithGlobals();
|
|
8048
|
+
opts.commandType = constants_default.COMMAND_TYPE_UPLOAD_PDF;
|
|
8049
|
+
let ctx = ctx_default(opts);
|
|
7750
8050
|
if (!fs6__default.default.existsSync(directory)) {
|
|
7751
8051
|
console.log(`Error: The provided directory ${directory} not found.`);
|
|
7752
8052
|
process.exit(1);
|