@lambdatest/smartui-cli 4.1.15 → 4.1.16
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 +43 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -737,6 +737,18 @@ var ConfigSchema = {
|
|
|
737
737
|
userAgent: {
|
|
738
738
|
type: "string",
|
|
739
739
|
errorMessage: "User Agent value must be a valid string"
|
|
740
|
+
},
|
|
741
|
+
requestHeaders: {
|
|
742
|
+
type: "array",
|
|
743
|
+
items: {
|
|
744
|
+
type: "object",
|
|
745
|
+
minProperties: 1,
|
|
746
|
+
additionalProperties: { type: "string" }
|
|
747
|
+
},
|
|
748
|
+
uniqueItems: true,
|
|
749
|
+
errorMessage: {
|
|
750
|
+
uniqueItems: "Invalid config; duplicates in requestHeaders"
|
|
751
|
+
}
|
|
740
752
|
}
|
|
741
753
|
},
|
|
742
754
|
anyOf: [
|
|
@@ -1655,6 +1667,9 @@ var server_default = (ctx) => __async(void 0, null, function* () {
|
|
|
1655
1667
|
console.log(`Failed to fetch capabilities for sessionId ${sessionId}: ${error.message}`);
|
|
1656
1668
|
}
|
|
1657
1669
|
}
|
|
1670
|
+
if (capsBuildId && capsBuildId !== "") {
|
|
1671
|
+
process.env.SMARTUI_BUILD_ID = capsBuildId;
|
|
1672
|
+
}
|
|
1658
1673
|
}
|
|
1659
1674
|
ctx.testType = testType;
|
|
1660
1675
|
(_c = ctx.snapshotQueue) == null ? void 0 : _c.enqueue(snapshot);
|
|
@@ -1856,7 +1871,7 @@ var authExec_default = (ctx) => {
|
|
|
1856
1871
|
};
|
|
1857
1872
|
|
|
1858
1873
|
// package.json
|
|
1859
|
-
var version = "4.1.
|
|
1874
|
+
var version = "4.1.16";
|
|
1860
1875
|
var package_default = {
|
|
1861
1876
|
name: "@lambdatest/smartui-cli",
|
|
1862
1877
|
version,
|
|
@@ -2451,7 +2466,6 @@ var ctx_default = (options) => {
|
|
|
2451
2466
|
try {
|
|
2452
2467
|
if (options.config) {
|
|
2453
2468
|
config = JSON.parse(fs5__default.default.readFileSync(options.config, "utf-8"));
|
|
2454
|
-
logger_default.debug(`Config file ${options.config} loaded: ${JSON.stringify(config, null, 2)}`);
|
|
2455
2469
|
if ((_a = config.web) == null ? void 0 : _a.resolutions) {
|
|
2456
2470
|
config.web.viewports = config.web.resolutions;
|
|
2457
2471
|
delete config.web.resolutions;
|
|
@@ -2531,7 +2545,8 @@ var ctx_default = (options) => {
|
|
|
2531
2545
|
ignoreHTTPSErrors: (_i = config.ignoreHTTPSErrors) != null ? _i : false,
|
|
2532
2546
|
skipBuildCreation: (_j = config.skipBuildCreation) != null ? _j : false,
|
|
2533
2547
|
tunnel: tunnelObj,
|
|
2534
|
-
userAgent: config.userAgent || ""
|
|
2548
|
+
userAgent: config.userAgent || "",
|
|
2549
|
+
requestHeaders: config.requestHeaders || {}
|
|
2535
2550
|
},
|
|
2536
2551
|
uploadFilePath: "",
|
|
2537
2552
|
webStaticConfig: [],
|
|
@@ -2567,7 +2582,8 @@ var ctx_default = (options) => {
|
|
|
2567
2582
|
fetchResults: fetchResultObj,
|
|
2568
2583
|
fetchResultsFileName: fetchResultsFileObj,
|
|
2569
2584
|
baselineBranch: options.baselineBranch || "",
|
|
2570
|
-
baselineBuild: options.baselineBuild || ""
|
|
2585
|
+
baselineBuild: options.baselineBuild || "",
|
|
2586
|
+
githubURL: options.githubURL || ""
|
|
2571
2587
|
},
|
|
2572
2588
|
cliVersion: version,
|
|
2573
2589
|
totalSnapshots: -1,
|
|
@@ -2615,6 +2631,10 @@ var git_default = (ctx) => {
|
|
|
2615
2631
|
ctx.env.SMART_GIT = false;
|
|
2616
2632
|
}
|
|
2617
2633
|
}
|
|
2634
|
+
let githubURL;
|
|
2635
|
+
if (ctx.options.githubURL && ctx.options.githubURL.startsWith("https://")) {
|
|
2636
|
+
githubURL = ctx.options.githubURL;
|
|
2637
|
+
}
|
|
2618
2638
|
if (ctx.env.SMARTUI_GIT_INFO_FILEPATH) {
|
|
2619
2639
|
let gitInfo = JSON.parse(fs5__default.default.readFileSync(ctx.env.SMARTUI_GIT_INFO_FILEPATH, "utf-8"));
|
|
2620
2640
|
if (ctx.options.markBaseline) {
|
|
@@ -2626,7 +2646,7 @@ var git_default = (ctx) => {
|
|
|
2626
2646
|
commitId: gitInfo.commit_id.slice(0, 6) || "",
|
|
2627
2647
|
commitMessage: gitInfo.commit_body || "",
|
|
2628
2648
|
commitAuthor: gitInfo.commit_author || "",
|
|
2629
|
-
githubURL: ctx.env.GITHUB_ACTIONS ? `${constants_default.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${gitInfo.commit_id}` : "",
|
|
2649
|
+
githubURL: githubURL ? githubURL : ctx.env.GITHUB_ACTIONS ? `${constants_default.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${gitInfo.commit_id}` : "",
|
|
2630
2650
|
baselineBranch: ctx.options.baselineBranch || ctx.env.BASELINE_BRANCH || ""
|
|
2631
2651
|
};
|
|
2632
2652
|
} else {
|
|
@@ -2646,7 +2666,7 @@ var git_default = (ctx) => {
|
|
|
2646
2666
|
commitId: res[0] || "",
|
|
2647
2667
|
commitMessage: res[2] || "",
|
|
2648
2668
|
commitAuthor: res[7] || "",
|
|
2649
|
-
githubURL: ctx.env.GITHUB_ACTIONS ? `${constants_default.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${res[1]}` : "",
|
|
2669
|
+
githubURL: githubURL ? githubURL : ctx.env.GITHUB_ACTIONS ? `${constants_default.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${res[1]}` : "",
|
|
2650
2670
|
baselineBranch: ctx.options.baselineBranch || ctx.env.BASELINE_BRANCH || ""
|
|
2651
2671
|
};
|
|
2652
2672
|
}
|
|
@@ -2664,6 +2684,9 @@ var getGitInfo_default = (ctx) => {
|
|
|
2664
2684
|
try {
|
|
2665
2685
|
ctx2.git = git_default(ctx2);
|
|
2666
2686
|
task.output = chalk__default.default.gray(`branch: ${ctx2.git.branch}, commit: ${ctx2.git.commitId}, author: ${ctx2.git.commitAuthor}`);
|
|
2687
|
+
if (ctx2.git.githubURL && ctx2.git.githubURL !== "") {
|
|
2688
|
+
task.output += chalk__default.default.gray(`, githubURL: ${ctx2.git.githubURL}`);
|
|
2689
|
+
}
|
|
2667
2690
|
task.title = "Fetched git information";
|
|
2668
2691
|
} catch (error) {
|
|
2669
2692
|
ctx2.log.debug(error);
|
|
@@ -2931,6 +2954,9 @@ function prepareSnapshot(snapshot, ctx) {
|
|
|
2931
2954
|
if (ctx.config.basicAuthorization) {
|
|
2932
2955
|
processedOptions.basicAuthorization = ctx.config.basicAuthorization;
|
|
2933
2956
|
}
|
|
2957
|
+
if (ctx.config.requestHeaders && Array.isArray(ctx.config.requestHeaders)) {
|
|
2958
|
+
processedOptions.requestHeaders = ctx.config.requestHeaders;
|
|
2959
|
+
}
|
|
2934
2960
|
ctx.config.allowedHostnames.push(new URL(snapshot.url).hostname);
|
|
2935
2961
|
processedOptions.allowedHostnames = ctx.config.allowedHostnames;
|
|
2936
2962
|
processedOptions.skipCapturedCookies = ctx.env.SMARTUI_DO_NOT_USE_CAPTURED_COOKIES;
|
|
@@ -3076,6 +3102,9 @@ function processSnapshot(snapshot, ctx) {
|
|
|
3076
3102
|
browsers: {}
|
|
3077
3103
|
};
|
|
3078
3104
|
let processedOptions = {};
|
|
3105
|
+
if (ctx.config.requestHeaders && Array.isArray(ctx.config.requestHeaders)) {
|
|
3106
|
+
processedOptions.requestHeaders = ctx.config.requestHeaders;
|
|
3107
|
+
}
|
|
3079
3108
|
let globalViewport = "";
|
|
3080
3109
|
let globalBrowser = constants_default.CHROME;
|
|
3081
3110
|
let launchOptions = {
|
|
@@ -3150,6 +3179,13 @@ function processSnapshot(snapshot, ctx) {
|
|
|
3150
3179
|
let token = Buffer.from(`${ctx.config.basicAuthorization.username}:${ctx.config.basicAuthorization.password}`).toString("base64");
|
|
3151
3180
|
requestOptions.headers.Authorization = `Basic ${token}`;
|
|
3152
3181
|
}
|
|
3182
|
+
if (ctx.config.requestHeaders && Array.isArray(ctx.config.requestHeaders)) {
|
|
3183
|
+
ctx.config.requestHeaders.forEach((headerObj) => {
|
|
3184
|
+
Object.entries(headerObj).forEach(([key, value]) => {
|
|
3185
|
+
requestOptions.headers[key] = value;
|
|
3186
|
+
});
|
|
3187
|
+
});
|
|
3188
|
+
}
|
|
3153
3189
|
let response, body;
|
|
3154
3190
|
if (requestUrl === snapshot.url) {
|
|
3155
3191
|
response = {
|
|
@@ -5427,7 +5463,7 @@ var merge_default = program;
|
|
|
5427
5463
|
|
|
5428
5464
|
// src/commander/commander.ts
|
|
5429
5465
|
var program2 = new commander.Command();
|
|
5430
|
-
program2.name("smartui").description("CLI to help you run your SmartUI tests on LambdaTest platform").version(`v${version}`).option("-c --config <filepath>", "Config file path").option("--markBaseline", "Mark this build baseline").option("--baselineBranch <string>", "Mark this build baseline").option("--baselineBuild <string>", "Mark this build baseline").addCommand(exec_default2).addCommand(capture_default).addCommand(configWeb).addCommand(configStatic).addCommand(upload_default).addCommand(server_default2).addCommand(stopServer_default).addCommand(merge_default).addCommand(ping_default).addCommand(configFigma).addCommand(uploadFigma).addCommand(configWebFigma).addCommand(configAppFigma).addCommand(uploadWebFigmaCommand).addCommand(uploadAppFigmaCommand);
|
|
5466
|
+
program2.name("smartui").description("CLI to help you run your SmartUI tests on LambdaTest platform").version(`v${version}`).option("-c --config <filepath>", "Config file path").option("--markBaseline", "Mark this build baseline").option("--baselineBranch <string>", "Mark this build baseline").option("--baselineBuild <string>", "Mark this build baseline").option("--githubURL <string>", "GitHub URL including commitId").addCommand(exec_default2).addCommand(capture_default).addCommand(configWeb).addCommand(configStatic).addCommand(upload_default).addCommand(server_default2).addCommand(stopServer_default).addCommand(merge_default).addCommand(ping_default).addCommand(configFigma).addCommand(uploadFigma).addCommand(configWebFigma).addCommand(configAppFigma).addCommand(uploadWebFigmaCommand).addCommand(uploadAppFigmaCommand);
|
|
5431
5467
|
var commander_default = program2;
|
|
5432
5468
|
(function() {
|
|
5433
5469
|
return __async(this, null, function* () {
|