@lambdatest/smartui-cli 4.1.46 → 4.1.48

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.
Files changed (2) hide show
  1. package/dist/index.cjs +64 -4
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -2825,7 +2825,7 @@ var authExec_default = (ctx) => {
2825
2825
  };
2826
2826
 
2827
2827
  // package.json
2828
- var version = "4.1.46";
2828
+ var version = "4.1.48";
2829
2829
  var package_default = {
2830
2830
  name: "@lambdatest/smartui-cli",
2831
2831
  version,
@@ -2970,10 +2970,10 @@ var httpClient = class {
2970
2970
  request(config, log2) {
2971
2971
  return __async(this, null, function* () {
2972
2972
  log2.debug(`http request: ${config.method} ${config.url}`);
2973
- if (config && config.data && !config.data.skipLogging && !config.data.name && !config.data.snapshot) {
2973
+ if (config && config.data && !config.data.skipLogging && !config.data.name && !config.data.snapshot && config.method !== "PUT") {
2974
2974
  log2.debug(config.data);
2975
2975
  }
2976
- if (config && config.data && !config.data.skipLogging && config.data.snapshotUuid) {
2976
+ if (config && config.data && !config.data.skipLogging && config.data.snapshotUuid && config.method !== "PUT") {
2977
2977
  log2.debug(config.data);
2978
2978
  }
2979
2979
  return this.axiosInstance.request(config).then((resp) => {
@@ -3161,7 +3161,8 @@ var httpClient = class {
3161
3161
  git,
3162
3162
  config,
3163
3163
  isStartExec,
3164
- baselineBuild
3164
+ baselineBuild,
3165
+ packageVersion: package_default.version
3165
3166
  },
3166
3167
  headers: {
3167
3168
  projectToken: "",
@@ -3369,6 +3370,19 @@ var httpClient = class {
3369
3370
  }
3370
3371
  }, ctx.log);
3371
3372
  }
3373
+ getS3PreSignedURLForCaps(ctx, capsBuildId, capsProjectToken) {
3374
+ return this.request({
3375
+ url: `/loguploadurl`,
3376
+ method: "POST",
3377
+ headers: {
3378
+ "Content-Type": "application/json",
3379
+ projectToken: capsProjectToken !== "" ? capsProjectToken : this.projectToken
3380
+ },
3381
+ data: {
3382
+ buildId: capsBuildId
3383
+ }
3384
+ }, ctx.log);
3385
+ }
3372
3386
  getS3PresignedURLForSnapshotUpload(ctx, snapshotName, snapshotUuid) {
3373
3387
  return this.request({
3374
3388
  url: `/snapshotuploadurl`,
@@ -3443,6 +3457,23 @@ var httpClient = class {
3443
3457
  // prevent axios from limiting the content size
3444
3458
  }, ctx.log);
3445
3459
  }
3460
+ uploadLogsForCaps(ctx, uploadURL) {
3461
+ const logContent = fs6__default.default.readFileSync(constants_default.LOG_FILE_PATH);
3462
+ const { size } = fs6__default.default.statSync(constants_default.LOG_FILE_PATH);
3463
+ return this.request({
3464
+ url: uploadURL,
3465
+ method: "PUT",
3466
+ headers: {
3467
+ "Content-Type": "text/plain",
3468
+ "Content-Length": size
3469
+ },
3470
+ data: logContent,
3471
+ maxBodyLength: Infinity,
3472
+ // prevent axios from limiting the body size
3473
+ maxContentLength: Infinity
3474
+ // prevent axios from limiting the content size
3475
+ }, ctx.log);
3476
+ }
3446
3477
  sendCliLogsToLSRS(ctx) {
3447
3478
  const logContent = fs6__default.default.readFileSync(constants_default.LOG_FILE_PATH, "utf-8");
3448
3479
  return this.request({
@@ -3455,6 +3486,22 @@ var httpClient = class {
3455
3486
  }
3456
3487
  }, ctx.log);
3457
3488
  }
3489
+ sendCliLogsToLSRSForCaps(ctx, capsBuildId, capsProjectToken) {
3490
+ const logContent = fs6__default.default.readFileSync(constants_default.LOG_FILE_PATH, "utf-8");
3491
+ return this.request({
3492
+ url: `/upload/logs`,
3493
+ method: "POST",
3494
+ headers: {
3495
+ "Content-Type": "application/json",
3496
+ projectToken: capsProjectToken !== "" ? capsProjectToken : this.projectToken
3497
+ },
3498
+ data: {
3499
+ buildId: capsBuildId,
3500
+ logContent,
3501
+ skipLogging: true
3502
+ }
3503
+ }, ctx.log);
3504
+ }
3458
3505
  uploadSnapshotToS3(ctx, uploadURL, snapshot) {
3459
3506
  return this.request({
3460
3507
  url: uploadURL,
@@ -4186,6 +4233,7 @@ var finalizeBuild_default = (ctx) => {
4186
4233
  clearInterval(pingIntervalId);
4187
4234
  ctx2.log.debug("Ping polling stopped immediately from Finalize Build");
4188
4235
  }
4236
+ let uploadedCliLogsBuildIds = /* @__PURE__ */ new Set();
4189
4237
  for (const [sessionId, capabilities] of ctx2.sessionCapabilitiesMap.entries()) {
4190
4238
  try {
4191
4239
  const buildId = (capabilities == null ? void 0 : capabilities.buildId) || "";
@@ -4208,6 +4256,18 @@ var finalizeBuild_default = (ctx) => {
4208
4256
  }
4209
4257
  ctx2.log.debug(`Capabilities for sessionId ${sessionId}: ${JSON.stringify(capabilities)}`);
4210
4258
  if (buildId && projectToken) {
4259
+ if (ctx2.isSnapshotCaptured && !uploadedCliLogsBuildIds.has(buildId)) {
4260
+ let uploadCLILogsToS3 = ctx2.config.useLambdaInternal || uploadDomToS3ViaEnv2;
4261
+ if (!uploadCLILogsToS3) {
4262
+ ctx2.log.debug(`Log file to be uploaded`);
4263
+ let resp = yield ctx2.client.getS3PreSignedURLForCaps(ctx2, buildId, projectToken);
4264
+ yield ctx2.client.uploadLogsForCaps(ctx2, resp.data.url);
4265
+ } else {
4266
+ ctx2.log.debug(`Log file to be uploaded via LSRS`);
4267
+ ctx2.client.sendCliLogsToLSRSForCaps(ctx2, buildId, projectToken);
4268
+ }
4269
+ uploadedCliLogsBuildIds.add(buildId);
4270
+ }
4211
4271
  yield ctx2.client.finalizeBuildForCapsWithToken(buildId, totalSnapshots, projectToken, ctx2.log);
4212
4272
  if (ctx2.autoTunnelStarted) {
4213
4273
  yield startPollingForTunnel(ctx2, buildId, false, projectToken, capabilities == null ? void 0 : capabilities.buildName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdatest/smartui-cli",
3
- "version": "4.1.46",
3
+ "version": "4.1.48",
4
4
  "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
5
5
  "files": [
6
6
  "dist/**/*"