@lambdatest/smartui-cli 4.1.37 → 4.1.38-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +87 -69
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5,9 +5,9 @@ var commander = require('commander');
|
|
|
5
5
|
var which = require('which');
|
|
6
6
|
var listr2 = require('listr2');
|
|
7
7
|
var chalk = require('chalk');
|
|
8
|
-
var
|
|
8
|
+
var path3 = require('path');
|
|
9
9
|
var fastify = require('fastify');
|
|
10
|
-
var
|
|
10
|
+
var fs6 = require('fs');
|
|
11
11
|
var Ajv = require('ajv');
|
|
12
12
|
var addErrors = require('ajv-errors');
|
|
13
13
|
var test = require('@playwright/test');
|
|
@@ -46,9 +46,9 @@ function _interopNamespace(e) {
|
|
|
46
46
|
|
|
47
47
|
var which__default = /*#__PURE__*/_interopDefault(which);
|
|
48
48
|
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
49
|
-
var
|
|
49
|
+
var path3__default = /*#__PURE__*/_interopDefault(path3);
|
|
50
50
|
var fastify__default = /*#__PURE__*/_interopDefault(fastify);
|
|
51
|
-
var
|
|
51
|
+
var fs6__default = /*#__PURE__*/_interopDefault(fs6);
|
|
52
52
|
var Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
|
|
53
53
|
var addErrors__default = /*#__PURE__*/_interopDefault(addErrors);
|
|
54
54
|
var stringify__default = /*#__PURE__*/_interopDefault(stringify);
|
|
@@ -1487,8 +1487,8 @@ var lambdaTunnel = __require("@lambdatest/node-tunnel");
|
|
|
1487
1487
|
util$1.promisify(setTimeout);
|
|
1488
1488
|
var tunnelInstance;
|
|
1489
1489
|
function delDir(dir) {
|
|
1490
|
-
if (
|
|
1491
|
-
|
|
1490
|
+
if (fs6__default.default.existsSync(dir)) {
|
|
1491
|
+
fs6__default.default.rmSync(dir, { recursive: true });
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
1494
1494
|
function scrollToBottomAndBackToTop({
|
|
@@ -1689,7 +1689,7 @@ function startPolling(ctx, build_id, baseline, projectToken) {
|
|
|
1689
1689
|
if (ctx.options.fetchResults && ctx.options.fetchResultsFileName && ctx.build && ctx.build.id && resp.build.build_id === ctx.build.id) {
|
|
1690
1690
|
fileName = `${ctx.options.fetchResultsFileName}`;
|
|
1691
1691
|
}
|
|
1692
|
-
|
|
1692
|
+
fs6__default.default.writeFileSync(`${fileName}`, JSON.stringify(resp, null, 2));
|
|
1693
1693
|
ctx.log.debug(`Updated results in ${fileName}`);
|
|
1694
1694
|
if (resp.build.build_status_ind === constants_default.BUILD_COMPLETE || resp.build.build_status_ind === constants_default.BUILD_ERROR) {
|
|
1695
1695
|
clearInterval(intervalId);
|
|
@@ -1957,7 +1957,7 @@ function startPdfPolling(ctx) {
|
|
|
1957
1957
|
};
|
|
1958
1958
|
if (ctx.options.fetchResults && ctx.options.fetchResultsFileName) {
|
|
1959
1959
|
const filename = ctx.options.fetchResultsFileName !== "" ? ctx.options.fetchResultsFileName : "pdf-results.json";
|
|
1960
|
-
|
|
1960
|
+
fs6__default.default.writeFileSync(filename, JSON.stringify(formattedResults, null, 2));
|
|
1961
1961
|
console.log(chalk__default.default.green(`
|
|
1962
1962
|
Results saved to ${filename}`));
|
|
1963
1963
|
}
|
|
@@ -2240,7 +2240,7 @@ var server_default = (ctx) => __async(void 0, null, function* () {
|
|
|
2240
2240
|
bodyLimit: 3e7
|
|
2241
2241
|
});
|
|
2242
2242
|
const opts = {};
|
|
2243
|
-
const SMARTUI_DOM =
|
|
2243
|
+
const SMARTUI_DOM = fs6.readFileSync(path3__default.default.resolve(__dirname, "dom-serializer.js"), "utf-8");
|
|
2244
2244
|
server.get("/healthcheck", opts, (_, reply) => {
|
|
2245
2245
|
reply.code(200).send({ cliVersion: ctx.cliVersion });
|
|
2246
2246
|
});
|
|
@@ -2528,7 +2528,8 @@ var env_default = () => {
|
|
|
2528
2528
|
USE_REMOTE_DISCOVERY,
|
|
2529
2529
|
SMART_GIT,
|
|
2530
2530
|
SHOW_RENDER_ERRORS,
|
|
2531
|
-
SMARTUI_SSE_URL = "https://server-events.lambdatest.com"
|
|
2531
|
+
SMARTUI_SSE_URL = "https://server-events.lambdatest.com",
|
|
2532
|
+
LT_SDK_SKIP_EXECUTION_LOGS
|
|
2532
2533
|
} = process.env;
|
|
2533
2534
|
return {
|
|
2534
2535
|
PROJECT_TOKEN,
|
|
@@ -2553,7 +2554,8 @@ var env_default = () => {
|
|
|
2553
2554
|
USE_REMOTE_DISCOVERY: USE_REMOTE_DISCOVERY === "true",
|
|
2554
2555
|
SMART_GIT: SMART_GIT === "true",
|
|
2555
2556
|
SHOW_RENDER_ERRORS: SHOW_RENDER_ERRORS === "true",
|
|
2556
|
-
SMARTUI_SSE_URL
|
|
2557
|
+
SMARTUI_SSE_URL,
|
|
2558
|
+
LT_SDK_SKIP_EXECUTION_LOGS: LT_SDK_SKIP_EXECUTION_LOGS === "true"
|
|
2557
2559
|
};
|
|
2558
2560
|
};
|
|
2559
2561
|
var logContext = {};
|
|
@@ -2648,7 +2650,7 @@ var authExec_default = (ctx) => {
|
|
|
2648
2650
|
};
|
|
2649
2651
|
|
|
2650
2652
|
// package.json
|
|
2651
|
-
var version = "4.1.
|
|
2653
|
+
var version = "4.1.38-beta.1";
|
|
2652
2654
|
var package_default = {
|
|
2653
2655
|
name: "@lambdatest/smartui-cli",
|
|
2654
2656
|
version,
|
|
@@ -3106,7 +3108,7 @@ var httpClient = class {
|
|
|
3106
3108
|
}
|
|
3107
3109
|
uploadScreenshot({ id: buildId, name: buildName, baseline }, ssPath, ssName, browserName, viewport, url = "", log2) {
|
|
3108
3110
|
browserName = browserName === constants_default.SAFARI ? constants_default.WEBKIT : browserName;
|
|
3109
|
-
const file =
|
|
3111
|
+
const file = fs6__default.default.readFileSync(ssPath);
|
|
3110
3112
|
const form = new FormData__default.default();
|
|
3111
3113
|
form.append("screenshot", file, { filename: `${ssName}.png`, contentType: "image/png" });
|
|
3112
3114
|
form.append("browser", browserName);
|
|
@@ -3232,8 +3234,8 @@ var httpClient = class {
|
|
|
3232
3234
|
}, ctx.log);
|
|
3233
3235
|
}
|
|
3234
3236
|
uploadLogs(ctx, uploadURL) {
|
|
3235
|
-
const fileStream =
|
|
3236
|
-
const { size } =
|
|
3237
|
+
const fileStream = fs6__default.default.createReadStream(constants_default.LOG_FILE_PATH);
|
|
3238
|
+
const { size } = fs6__default.default.statSync(constants_default.LOG_FILE_PATH);
|
|
3237
3239
|
return this.request({
|
|
3238
3240
|
url: uploadURL,
|
|
3239
3241
|
method: "PUT",
|
|
@@ -3249,7 +3251,7 @@ var httpClient = class {
|
|
|
3249
3251
|
}, ctx.log);
|
|
3250
3252
|
}
|
|
3251
3253
|
sendCliLogsToLSRS(ctx) {
|
|
3252
|
-
const logContent =
|
|
3254
|
+
const logContent = fs6__default.default.readFileSync(constants_default.LOG_FILE_PATH, "utf-8");
|
|
3253
3255
|
return this.request({
|
|
3254
3256
|
url: `/upload/logs`,
|
|
3255
3257
|
method: "POST",
|
|
@@ -3416,7 +3418,7 @@ var ctx_default = (options) => {
|
|
|
3416
3418
|
let loadDomContent = false;
|
|
3417
3419
|
try {
|
|
3418
3420
|
if (options.config) {
|
|
3419
|
-
config = JSON.parse(
|
|
3421
|
+
config = JSON.parse(fs6__default.default.readFileSync(options.config, "utf-8"));
|
|
3420
3422
|
if ((_a = config.web) == null ? void 0 : _a.resolutions) {
|
|
3421
3423
|
config.web.viewports = config.web.resolutions;
|
|
3422
3424
|
delete config.web.resolutions;
|
|
@@ -3623,7 +3625,7 @@ var git_default = (ctx) => {
|
|
|
3623
3625
|
githubURL = ctx.options.githubURL;
|
|
3624
3626
|
}
|
|
3625
3627
|
if (ctx.env.SMARTUI_GIT_INFO_FILEPATH) {
|
|
3626
|
-
let gitInfo = JSON.parse(
|
|
3628
|
+
let gitInfo = JSON.parse(fs6__default.default.readFileSync(ctx.env.SMARTUI_GIT_INFO_FILEPATH, "utf-8"));
|
|
3627
3629
|
if (ctx.options.markBaseline) {
|
|
3628
3630
|
ctx.env.BASELINE_BRANCH = ctx.env.CURRENT_BRANCH || gitInfo.branch || "";
|
|
3629
3631
|
ctx.env.SMART_GIT = false;
|
|
@@ -3805,15 +3807,31 @@ var exec_default = (ctx) => {
|
|
|
3805
3807
|
}
|
|
3806
3808
|
updateLogContext({ task: "exec" });
|
|
3807
3809
|
return new Promise((resolve, reject) => {
|
|
3808
|
-
var _a2, _b, _c;
|
|
3810
|
+
var _a2, _b, _c, _d, _e;
|
|
3809
3811
|
const childProcess = spawn__default.default(ctx2.args.execCommand[0], (_a2 = ctx2.args.execCommand) == null ? void 0 : _a2.slice(1));
|
|
3810
3812
|
let totalOutput = "";
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3813
|
+
if (!ctx2.env.LT_SDK_SKIP_EXECUTION_LOGS) {
|
|
3814
|
+
const output = listr2.createWritable((chunk) => {
|
|
3815
|
+
totalOutput += chunk;
|
|
3816
|
+
task.output = chalk__default.default.gray(totalOutput);
|
|
3817
|
+
});
|
|
3818
|
+
(_b = childProcess.stdout) == null ? void 0 : _b.pipe(output);
|
|
3819
|
+
(_c = childProcess.stderr) == null ? void 0 : _c.pipe(output);
|
|
3820
|
+
} else {
|
|
3821
|
+
const logFileName = `execution-logs.log`;
|
|
3822
|
+
const logFilePath = path3__default.default.join(process.cwd(), logFileName);
|
|
3823
|
+
const logStream = fs6__default.default.createWriteStream(logFilePath, { flags: "a" });
|
|
3824
|
+
task.output = chalk__default.default.gray(`Execution logs being written to: ${logFileName}`);
|
|
3825
|
+
(_d = childProcess.stdout) == null ? void 0 : _d.on("data", (data) => {
|
|
3826
|
+
logStream.write(data);
|
|
3827
|
+
});
|
|
3828
|
+
(_e = childProcess.stderr) == null ? void 0 : _e.on("data", (data) => {
|
|
3829
|
+
logStream.write(data);
|
|
3830
|
+
});
|
|
3831
|
+
childProcess.on("close", () => {
|
|
3832
|
+
logStream.end();
|
|
3833
|
+
});
|
|
3834
|
+
}
|
|
3817
3835
|
childProcess.on("error", (error) => {
|
|
3818
3836
|
var _a3;
|
|
3819
3837
|
task.output = chalk__default.default.gray(`error: ${error.message}`);
|
|
@@ -5259,66 +5277,66 @@ command.name("exec").description("Run test commands around SmartUI").argument("<
|
|
|
5259
5277
|
var exec_default2 = command;
|
|
5260
5278
|
function createConfig(filepath) {
|
|
5261
5279
|
filepath = filepath || ".smartui.json";
|
|
5262
|
-
let filetype =
|
|
5280
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5263
5281
|
if (filetype != ".json") {
|
|
5264
5282
|
console.log("Error: Config file must have .json extension");
|
|
5265
5283
|
return;
|
|
5266
5284
|
}
|
|
5267
|
-
if (
|
|
5285
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5268
5286
|
console.log(`Error: SmartUI Config already exists: ${filepath}`);
|
|
5269
5287
|
console.log(`To create a new file, please specify the file name like: 'smartui config:create .smartui-config.json'`);
|
|
5270
5288
|
return;
|
|
5271
5289
|
}
|
|
5272
|
-
|
|
5273
|
-
|
|
5290
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5291
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_CONFIG, null, 2) + "\n");
|
|
5274
5292
|
console.log(`Created SmartUI Config: ${filepath}`);
|
|
5275
5293
|
}
|
|
5276
5294
|
function createWebStaticConfig(filepath) {
|
|
5277
5295
|
filepath = filepath || "url.json";
|
|
5278
|
-
let filetype =
|
|
5296
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5279
5297
|
if (filetype != ".json") {
|
|
5280
5298
|
console.log("Error: Config file must have .json extension");
|
|
5281
5299
|
return;
|
|
5282
5300
|
}
|
|
5283
|
-
if (
|
|
5301
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5284
5302
|
console.log(`Error: web-static config already exists: ${filepath}`);
|
|
5285
5303
|
console.log(`To create a new file, please specify the file name like: 'smartui config:create-web-static links.json'`);
|
|
5286
5304
|
return;
|
|
5287
5305
|
}
|
|
5288
|
-
|
|
5289
|
-
|
|
5306
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5307
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_WEB_STATIC_CONFIG, null, 2) + "\n");
|
|
5290
5308
|
console.log(`Created web-static config: ${filepath}`);
|
|
5291
5309
|
}
|
|
5292
5310
|
function createFigmaConfig(filepath) {
|
|
5293
5311
|
filepath = filepath || "designs.json";
|
|
5294
|
-
let filetype =
|
|
5312
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5295
5313
|
if (filetype != ".json") {
|
|
5296
5314
|
console.log("Error: designs config file must have .json extension");
|
|
5297
5315
|
return;
|
|
5298
5316
|
}
|
|
5299
|
-
if (
|
|
5317
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5300
5318
|
console.log(`Error: designs config already exists: ${filepath}`);
|
|
5301
5319
|
console.log(`To create a new file, please specify the file name like: 'smartui config:figma-config designs.json'`);
|
|
5302
5320
|
return;
|
|
5303
5321
|
}
|
|
5304
|
-
|
|
5305
|
-
|
|
5322
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5323
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.DEFAULT_FIGMA_CONFIG, null, 2) + "\n");
|
|
5306
5324
|
console.log(`Created designs config: ${filepath}`);
|
|
5307
5325
|
}
|
|
5308
5326
|
function createWebFigmaConfig(filepath) {
|
|
5309
5327
|
filepath = filepath || ".smartui.json";
|
|
5310
|
-
let filetype =
|
|
5328
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5311
5329
|
if (filetype != ".json") {
|
|
5312
5330
|
console.log("Error: figma config file must have .json extension");
|
|
5313
5331
|
return;
|
|
5314
5332
|
}
|
|
5315
|
-
if (
|
|
5333
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5316
5334
|
console.log(`Error: figma config already exists: ${filepath}`);
|
|
5317
5335
|
console.log(`To create a new file, please specify the file name like: 'smartui config:create-figma-web <fileName>.json'`);
|
|
5318
5336
|
return;
|
|
5319
5337
|
}
|
|
5320
|
-
|
|
5321
|
-
|
|
5338
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5339
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.WEB_FIGMA_CONFIG, null, 2) + "\n");
|
|
5322
5340
|
console.log(`Created figma web config: ${filepath}`);
|
|
5323
5341
|
}
|
|
5324
5342
|
function verifyFigmaWebConfig(ctx) {
|
|
@@ -5364,18 +5382,18 @@ function isValidArray(input) {
|
|
|
5364
5382
|
}
|
|
5365
5383
|
function createAppFigmaConfig(filepath) {
|
|
5366
5384
|
filepath = filepath || ".smartui.json";
|
|
5367
|
-
let filetype =
|
|
5385
|
+
let filetype = path3__default.default.extname(filepath);
|
|
5368
5386
|
if (filetype != ".json") {
|
|
5369
5387
|
console.log("Error: figma app config file must have .json extension");
|
|
5370
5388
|
return;
|
|
5371
5389
|
}
|
|
5372
|
-
if (
|
|
5390
|
+
if (fs6__default.default.existsSync(filepath)) {
|
|
5373
5391
|
console.log(`Error: figma app config already exists: ${filepath}`);
|
|
5374
5392
|
console.log(`To create a new figma app config, please specify the file name like: 'smartui config:create-figma-app <fileName>.json'`);
|
|
5375
5393
|
return;
|
|
5376
5394
|
}
|
|
5377
|
-
|
|
5378
|
-
|
|
5395
|
+
fs6__default.default.mkdirSync(path3__default.default.dirname(filepath), { recursive: true });
|
|
5396
|
+
fs6__default.default.writeFileSync(filepath, JSON.stringify(constants_default.APP_FIGMA_CONFIG, null, 2) + "\n");
|
|
5379
5397
|
console.log(`Created figma app config: ${filepath}`);
|
|
5380
5398
|
}
|
|
5381
5399
|
|
|
@@ -5619,7 +5637,7 @@ function captureScreenshots(ctx) {
|
|
|
5619
5637
|
});
|
|
5620
5638
|
}
|
|
5621
5639
|
function getImageDimensions(filePath) {
|
|
5622
|
-
const buffer =
|
|
5640
|
+
const buffer = fs6__default.default.readFileSync(filePath);
|
|
5623
5641
|
let width, height;
|
|
5624
5642
|
if (buffer.toString("hex", 0, 2) === "ffd8") {
|
|
5625
5643
|
let offset = 2;
|
|
@@ -5644,7 +5662,7 @@ function getImageDimensions(filePath) {
|
|
|
5644
5662
|
function isAllowedImage(filePath) {
|
|
5645
5663
|
return __async(this, null, function* () {
|
|
5646
5664
|
try {
|
|
5647
|
-
const fileBuffer =
|
|
5665
|
+
const fileBuffer = fs6__default.default.readFileSync(filePath);
|
|
5648
5666
|
const isMagicValid = constants_default.MAGIC_NUMBERS.some((magic) => fileBuffer.slice(0, magic.magic.length).equals(magic.magic));
|
|
5649
5667
|
const metadata = yield sharp__default.default(filePath).metadata();
|
|
5650
5668
|
if (metadata.format === constants_default.FILE_EXTENSION_GIFS) {
|
|
@@ -5668,11 +5686,11 @@ function uploadScreenshots(ctx) {
|
|
|
5668
5686
|
let noOfScreenshots = 0;
|
|
5669
5687
|
function processDirectory(directory, relativePath = "") {
|
|
5670
5688
|
return __async(this, null, function* () {
|
|
5671
|
-
const files =
|
|
5689
|
+
const files = fs6__default.default.readdirSync(directory);
|
|
5672
5690
|
for (let file of files) {
|
|
5673
|
-
const filePath =
|
|
5674
|
-
const stat =
|
|
5675
|
-
const relativeFilePath =
|
|
5691
|
+
const filePath = path3__default.default.join(directory, file);
|
|
5692
|
+
const stat = fs6__default.default.statSync(filePath);
|
|
5693
|
+
const relativeFilePath = path3__default.default.join(relativePath, file);
|
|
5676
5694
|
if (stat.isDirectory() && ctx.options.ignorePattern.includes(relativeFilePath)) {
|
|
5677
5695
|
ctx.log.info(`Ignoring Directory ${relativeFilePath}`);
|
|
5678
5696
|
continue;
|
|
@@ -5680,7 +5698,7 @@ function uploadScreenshots(ctx) {
|
|
|
5680
5698
|
if (stat.isDirectory()) {
|
|
5681
5699
|
yield processDirectory(filePath, relativeFilePath);
|
|
5682
5700
|
} else {
|
|
5683
|
-
let fileExtension =
|
|
5701
|
+
let fileExtension = path3__default.default.extname(file).toLowerCase();
|
|
5684
5702
|
if (allowedExtensions.includes(fileExtension)) {
|
|
5685
5703
|
const isValid = yield isAllowedImage(filePath);
|
|
5686
5704
|
if (!isValid) {
|
|
@@ -5689,7 +5707,7 @@ function uploadScreenshots(ctx) {
|
|
|
5689
5707
|
}
|
|
5690
5708
|
let ssId = relativeFilePath;
|
|
5691
5709
|
if (ctx.options.stripExtension) {
|
|
5692
|
-
ssId =
|
|
5710
|
+
ssId = path3__default.default.join(relativePath, path3__default.default.basename(file, fileExtension));
|
|
5693
5711
|
}
|
|
5694
5712
|
let viewport = "default";
|
|
5695
5713
|
if (!ctx.options.ignoreResolutions) {
|
|
@@ -5864,12 +5882,12 @@ command2.name("capture").description("Capture screenshots of static sites").argu
|
|
|
5864
5882
|
}
|
|
5865
5883
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
5866
5884
|
ctx.isSnapshotCaptured = true;
|
|
5867
|
-
if (!
|
|
5885
|
+
if (!fs6__default.default.existsSync(file)) {
|
|
5868
5886
|
ctx.log.error(`Web Static Config file ${file} not found.`);
|
|
5869
5887
|
return;
|
|
5870
5888
|
}
|
|
5871
5889
|
try {
|
|
5872
|
-
ctx.webStaticConfig = JSON.parse(
|
|
5890
|
+
ctx.webStaticConfig = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
|
|
5873
5891
|
if (!validateWebStaticConfig(ctx.webStaticConfig)) {
|
|
5874
5892
|
ctx.log.debug(JSON.stringify(validateWebStaticConfig.errors, null, 2));
|
|
5875
5893
|
(_a = validateWebStaticConfig.errors) == null ? void 0 : _a.forEach((error) => {
|
|
@@ -5959,11 +5977,11 @@ command3.name("upload").description("Upload screenshots from given directory").a
|
|
|
5959
5977
|
}
|
|
5960
5978
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
5961
5979
|
ctx.isSnapshotCaptured = true;
|
|
5962
|
-
if (!
|
|
5980
|
+
if (!fs6__default.default.existsSync(directory)) {
|
|
5963
5981
|
console.log(`Error: The provided directory ${directory} not found.`);
|
|
5964
5982
|
return;
|
|
5965
5983
|
}
|
|
5966
|
-
if (
|
|
5984
|
+
if (path3__default.default.extname(directory).toLowerCase() === constants_default.FILE_EXTENSION_ZIP) {
|
|
5967
5985
|
ctx.log.debug(`Error: The provided directory ${directory} is a zip file. Zips are not accepted.`);
|
|
5968
5986
|
return;
|
|
5969
5987
|
}
|
|
@@ -6242,12 +6260,12 @@ uploadFigma.name("upload-figma").description("Capture screenshots of static site
|
|
|
6242
6260
|
var _a, _b;
|
|
6243
6261
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
6244
6262
|
ctx.isSnapshotCaptured = true;
|
|
6245
|
-
if (!
|
|
6263
|
+
if (!fs6__default.default.existsSync(file)) {
|
|
6246
6264
|
console.log(`Error: Figma Config file ${file} not found.`);
|
|
6247
6265
|
return;
|
|
6248
6266
|
}
|
|
6249
6267
|
try {
|
|
6250
|
-
ctx.figmaDesignConfig = JSON.parse(
|
|
6268
|
+
ctx.figmaDesignConfig = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
|
|
6251
6269
|
if (!validateFigmaDesignConfig(ctx.figmaDesignConfig)) {
|
|
6252
6270
|
const validationError = (_b = (_a = validateFigmaDesignConfig.errors) == null ? void 0 : _a[0]) == null ? void 0 : _b.message;
|
|
6253
6271
|
throw new Error(validationError || "Invalid figma design Config");
|
|
@@ -6283,12 +6301,12 @@ uploadWebFigmaCommand.name("upload-figma-web").description("Capture figma screen
|
|
|
6283
6301
|
return __async(this, null, function* () {
|
|
6284
6302
|
var _a;
|
|
6285
6303
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
6286
|
-
if (!
|
|
6304
|
+
if (!fs6__default.default.existsSync(file)) {
|
|
6287
6305
|
console.log(`Error: figma-web config file ${file} not found.`);
|
|
6288
6306
|
return;
|
|
6289
6307
|
}
|
|
6290
6308
|
try {
|
|
6291
|
-
ctx.config = JSON.parse(
|
|
6309
|
+
ctx.config = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
|
|
6292
6310
|
ctx.log.info(JSON.stringify(ctx.config));
|
|
6293
6311
|
if (!validateWebFigmaConfig(ctx.config)) {
|
|
6294
6312
|
ctx.log.debug(JSON.stringify(validateWebFigmaConfig.errors, null, 2));
|
|
@@ -6336,12 +6354,12 @@ uploadAppFigmaCommand.name("upload-figma-app").description("Capture figma screen
|
|
|
6336
6354
|
return __async(this, null, function* () {
|
|
6337
6355
|
var _a;
|
|
6338
6356
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
6339
|
-
if (!
|
|
6357
|
+
if (!fs6__default.default.existsSync(file)) {
|
|
6340
6358
|
console.log(`Error: figma-app config file ${file} not found.`);
|
|
6341
6359
|
return;
|
|
6342
6360
|
}
|
|
6343
6361
|
try {
|
|
6344
|
-
ctx.config = JSON.parse(
|
|
6362
|
+
ctx.config = JSON.parse(fs6__default.default.readFileSync(file, "utf8"));
|
|
6345
6363
|
ctx.log.info(JSON.stringify(ctx.config));
|
|
6346
6364
|
if (!validateAppFigmaConfig(ctx.config)) {
|
|
6347
6365
|
ctx.log.debug(JSON.stringify(validateAppFigmaConfig.errors, null, 2));
|
|
@@ -6811,13 +6829,13 @@ function uploadPdfs(ctx, pdfPath) {
|
|
|
6811
6829
|
return __async(this, null, function* () {
|
|
6812
6830
|
const formData = new FormData__default.default();
|
|
6813
6831
|
if (pdfPath.endsWith(".pdf")) {
|
|
6814
|
-
formData.append("pathToFiles",
|
|
6832
|
+
formData.append("pathToFiles", fs6__default.default.createReadStream(pdfPath));
|
|
6815
6833
|
} else {
|
|
6816
|
-
const files =
|
|
6834
|
+
const files = fs6__default.default.readdirSync(pdfPath);
|
|
6817
6835
|
const pdfFiles = files.filter((file) => file.endsWith(".pdf"));
|
|
6818
6836
|
pdfFiles.forEach((pdf) => {
|
|
6819
|
-
const filePath =
|
|
6820
|
-
formData.append("pathToFiles",
|
|
6837
|
+
const filePath = path3__default.default.join(pdfPath, pdf);
|
|
6838
|
+
formData.append("pathToFiles", fs6__default.default.createReadStream(filePath));
|
|
6821
6839
|
});
|
|
6822
6840
|
}
|
|
6823
6841
|
const buildName = ctx.options.buildName;
|
|
@@ -6849,7 +6867,7 @@ command10.name("upload-pdf").description("Upload PDFs for visual comparison").ar
|
|
|
6849
6867
|
process.exit(1);
|
|
6850
6868
|
}
|
|
6851
6869
|
let ctx = ctx_default(command11.optsWithGlobals());
|
|
6852
|
-
if (!
|
|
6870
|
+
if (!fs6__default.default.existsSync(directory)) {
|
|
6853
6871
|
console.log(`Error: The provided directory ${directory} not found.`);
|
|
6854
6872
|
process.exit(1);
|
|
6855
6873
|
}
|
|
@@ -6892,7 +6910,7 @@ var commander_default = program2;
|
|
|
6892
6910
|
let client = new httpClient(env_default());
|
|
6893
6911
|
let log2 = logger_default;
|
|
6894
6912
|
try {
|
|
6895
|
-
|
|
6913
|
+
fs6__default.default.unlinkSync(constants_default.LOG_FILE_PATH);
|
|
6896
6914
|
let { data: { latestVersion, deprecated, additionalDescription } } = yield client.checkUpdate(log2);
|
|
6897
6915
|
log2.info(`
|
|
6898
6916
|
LambdaTest SmartUI CLI v${package_default.version}`);
|