@lambdatest/smartui-cli 4.0.11 → 4.0.12
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 +48 -14
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -861,7 +861,8 @@ var env_default = () => {
|
|
|
861
861
|
LT_ACCESS_KEY,
|
|
862
862
|
LT_SDK_DEBUG,
|
|
863
863
|
BASELINE_BRANCH,
|
|
864
|
-
CURRENT_BRANCH
|
|
864
|
+
CURRENT_BRANCH,
|
|
865
|
+
PROJECT_NAME
|
|
865
866
|
} = process.env;
|
|
866
867
|
return {
|
|
867
868
|
PROJECT_TOKEN,
|
|
@@ -878,7 +879,8 @@ var env_default = () => {
|
|
|
878
879
|
BASELINE_BRANCH,
|
|
879
880
|
CURRENT_BRANCH,
|
|
880
881
|
LT_SDK_DEBUG: LT_SDK_DEBUG === "true",
|
|
881
|
-
SMARTUI_DO_NOT_USE_CAPTURED_COOKIES: SMARTUI_DO_NOT_USE_CAPTURED_COOKIES === "true"
|
|
882
|
+
SMARTUI_DO_NOT_USE_CAPTURED_COOKIES: SMARTUI_DO_NOT_USE_CAPTURED_COOKIES === "true",
|
|
883
|
+
PROJECT_NAME
|
|
882
884
|
};
|
|
883
885
|
};
|
|
884
886
|
var logContext = {};
|
|
@@ -941,8 +943,14 @@ var auth_default = (ctx) => {
|
|
|
941
943
|
task: (ctx2, task) => __async(void 0, null, function* () {
|
|
942
944
|
updateLogContext({ task: "auth" });
|
|
943
945
|
try {
|
|
944
|
-
yield ctx2.client.auth(ctx2.log);
|
|
945
|
-
|
|
946
|
+
const authResult = yield ctx2.client.auth(ctx2.log, ctx2.env);
|
|
947
|
+
if (authResult === 2) {
|
|
948
|
+
task.output = chalk6__default.default.gray(`New project '${ctx2.env.PROJECT_NAME}' created successfully`);
|
|
949
|
+
} else if (authResult === 0) {
|
|
950
|
+
task.output = chalk6__default.default.gray(`Using existing project token '******#${ctx2.env.PROJECT_TOKEN.split("#").pop()}'`);
|
|
951
|
+
} else if (authResult === 1) {
|
|
952
|
+
task.output = chalk6__default.default.gray(`Using existing project '${ctx2.env.PROJECT_NAME}'`);
|
|
953
|
+
}
|
|
946
954
|
task.title = "Authenticated with SmartUI";
|
|
947
955
|
} catch (error) {
|
|
948
956
|
ctx2.log.debug(error);
|
|
@@ -955,7 +963,7 @@ var auth_default = (ctx) => {
|
|
|
955
963
|
};
|
|
956
964
|
|
|
957
965
|
// package.json
|
|
958
|
-
var version = "4.0.
|
|
966
|
+
var version = "4.0.12";
|
|
959
967
|
var package_default = {
|
|
960
968
|
name: "@lambdatest/smartui-cli",
|
|
961
969
|
version,
|
|
@@ -1006,10 +1014,20 @@ var package_default = {
|
|
|
1006
1014
|
}
|
|
1007
1015
|
};
|
|
1008
1016
|
var httpClient = class {
|
|
1009
|
-
constructor({ SMARTUI_CLIENT_API_URL, PROJECT_TOKEN }) {
|
|
1017
|
+
constructor({ SMARTUI_CLIENT_API_URL, PROJECT_TOKEN, PROJECT_NAME, LT_USERNAME, LT_ACCESS_KEY }) {
|
|
1018
|
+
this.projectToken = PROJECT_TOKEN || "";
|
|
1019
|
+
this.projectName = PROJECT_NAME || "";
|
|
1020
|
+
this.username = LT_USERNAME || "";
|
|
1021
|
+
this.accessKey = LT_ACCESS_KEY || "";
|
|
1010
1022
|
this.axiosInstance = axios__default.default.create({
|
|
1011
|
-
baseURL: SMARTUI_CLIENT_API_URL
|
|
1012
|
-
|
|
1023
|
+
baseURL: SMARTUI_CLIENT_API_URL
|
|
1024
|
+
});
|
|
1025
|
+
this.axiosInstance.interceptors.request.use((config) => {
|
|
1026
|
+
config.headers["projectToken"] = this.projectToken;
|
|
1027
|
+
config.headers["projectName"] = this.projectName;
|
|
1028
|
+
config.headers["username"] = this.username;
|
|
1029
|
+
config.headers["accessKey"] = this.accessKey;
|
|
1030
|
+
return config;
|
|
1013
1031
|
});
|
|
1014
1032
|
}
|
|
1015
1033
|
request(config, log2) {
|
|
@@ -1041,11 +1059,27 @@ var httpClient = class {
|
|
|
1041
1059
|
});
|
|
1042
1060
|
});
|
|
1043
1061
|
}
|
|
1044
|
-
auth(log2) {
|
|
1045
|
-
return this
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1062
|
+
auth(log2, env) {
|
|
1063
|
+
return __async(this, null, function* () {
|
|
1064
|
+
let result = 1;
|
|
1065
|
+
if (this.projectToken) {
|
|
1066
|
+
result = 0;
|
|
1067
|
+
}
|
|
1068
|
+
const response = yield this.request({
|
|
1069
|
+
url: "/token/verify",
|
|
1070
|
+
method: "GET"
|
|
1071
|
+
}, log2);
|
|
1072
|
+
if (response && response.projectToken) {
|
|
1073
|
+
this.projectToken = response.projectToken;
|
|
1074
|
+
env.PROJECT_TOKEN = response.projectToken;
|
|
1075
|
+
if (response.message && response.message.includes("Project created successfully")) {
|
|
1076
|
+
result = 2;
|
|
1077
|
+
}
|
|
1078
|
+
return result;
|
|
1079
|
+
} else {
|
|
1080
|
+
throw new Error("Authentication failed, project token not received");
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1049
1083
|
}
|
|
1050
1084
|
createBuild(git, config, log2) {
|
|
1051
1085
|
return this.request({
|
|
@@ -2310,7 +2344,7 @@ var Queue = class {
|
|
|
2310
2344
|
let drop = false;
|
|
2311
2345
|
if (!this.ctx.config.delayedUpload && snapshot && snapshot.name && this.snapshotNames.includes(snapshot.name)) {
|
|
2312
2346
|
drop = true;
|
|
2313
|
-
this.ctx.log.info(`Skipping duplicate SmartUI snapshot '${snapshot.name}'. To capture duplicate screenshots, please set the '
|
|
2347
|
+
this.ctx.log.info(`Skipping duplicate SmartUI snapshot '${snapshot.name}'. To capture duplicate screenshots, please set the 'delayedUpload' configuration as true in your config file.`);
|
|
2314
2348
|
}
|
|
2315
2349
|
if (this.ctx.config.delayedUpload && snapshot && snapshot.name && this.snapshotNames.includes(snapshot.name)) {
|
|
2316
2350
|
drop = this.filterExistingVariants(snapshot, this.ctx.config);
|