@lambdatest/smartui-cli 4.1.46 → 4.1.47

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 +45 -3
  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.47";
2829
2829
  var package_default = {
2830
2830
  name: "@lambdatest/smartui-cli",
2831
2831
  version,
@@ -3369,6 +3369,19 @@ var httpClient = class {
3369
3369
  }
3370
3370
  }, ctx.log);
3371
3371
  }
3372
+ getS3PreSignedURLForCaps(ctx, capsBuildId, capsProjectToken) {
3373
+ return this.request({
3374
+ url: `/loguploadurl`,
3375
+ method: "POST",
3376
+ headers: {
3377
+ "Content-Type": "application/json",
3378
+ projectToken: capsProjectToken !== "" ? capsProjectToken : this.projectToken
3379
+ },
3380
+ data: {
3381
+ buildId: capsBuildId
3382
+ }
3383
+ }, ctx.log);
3384
+ }
3372
3385
  getS3PresignedURLForSnapshotUpload(ctx, snapshotName, snapshotUuid) {
3373
3386
  return this.request({
3374
3387
  url: `/snapshotuploadurl`,
@@ -3427,7 +3440,7 @@ var httpClient = class {
3427
3440
  }, ctx.log);
3428
3441
  }
3429
3442
  uploadLogs(ctx, uploadURL) {
3430
- const fileStream = fs6__default.default.createReadStream(constants_default.LOG_FILE_PATH);
3443
+ const logContent = fs6__default.default.readFileSync(constants_default.LOG_FILE_PATH);
3431
3444
  const { size } = fs6__default.default.statSync(constants_default.LOG_FILE_PATH);
3432
3445
  return this.request({
3433
3446
  url: uploadURL,
@@ -3436,7 +3449,7 @@ var httpClient = class {
3436
3449
  "Content-Type": "text/plain",
3437
3450
  "Content-Length": size
3438
3451
  },
3439
- data: fileStream,
3452
+ data: logContent,
3440
3453
  maxBodyLength: Infinity,
3441
3454
  // prevent axios from limiting the body size
3442
3455
  maxContentLength: Infinity
@@ -3455,6 +3468,22 @@ var httpClient = class {
3455
3468
  }
3456
3469
  }, ctx.log);
3457
3470
  }
3471
+ sendCliLogsToLSRSForCaps(ctx, capsBuildId, capsProjectToken) {
3472
+ const logContent = fs6__default.default.readFileSync(constants_default.LOG_FILE_PATH, "utf-8");
3473
+ return this.request({
3474
+ url: `/upload/logs`,
3475
+ method: "POST",
3476
+ headers: {
3477
+ "Content-Type": "application/json",
3478
+ projectToken: capsProjectToken !== "" ? capsProjectToken : this.projectToken
3479
+ },
3480
+ data: {
3481
+ buildId: capsBuildId,
3482
+ logContent,
3483
+ skipLogging: true
3484
+ }
3485
+ }, ctx.log);
3486
+ }
3458
3487
  uploadSnapshotToS3(ctx, uploadURL, snapshot) {
3459
3488
  return this.request({
3460
3489
  url: uploadURL,
@@ -4186,6 +4215,7 @@ var finalizeBuild_default = (ctx) => {
4186
4215
  clearInterval(pingIntervalId);
4187
4216
  ctx2.log.debug("Ping polling stopped immediately from Finalize Build");
4188
4217
  }
4218
+ let uploadedCliLogsBuildIds = /* @__PURE__ */ new Set();
4189
4219
  for (const [sessionId, capabilities] of ctx2.sessionCapabilitiesMap.entries()) {
4190
4220
  try {
4191
4221
  const buildId = (capabilities == null ? void 0 : capabilities.buildId) || "";
@@ -4208,6 +4238,18 @@ var finalizeBuild_default = (ctx) => {
4208
4238
  }
4209
4239
  ctx2.log.debug(`Capabilities for sessionId ${sessionId}: ${JSON.stringify(capabilities)}`);
4210
4240
  if (buildId && projectToken) {
4241
+ if (ctx2.isSnapshotCaptured && !uploadedCliLogsBuildIds.has(buildId)) {
4242
+ let uploadCLILogsToS3 = ctx2.config.useLambdaInternal || uploadDomToS3ViaEnv2;
4243
+ if (!uploadCLILogsToS3) {
4244
+ ctx2.log.debug(`Log file to be uploaded`);
4245
+ let resp = yield ctx2.client.getS3PreSignedURLForCaps(ctx2, buildId, projectToken);
4246
+ yield ctx2.client.uploadLogs(ctx2, resp.data.url);
4247
+ } else {
4248
+ ctx2.log.debug(`Log file to be uploaded via LSRS`);
4249
+ ctx2.client.sendCliLogsToLSRSForCaps(ctx2, buildId, projectToken);
4250
+ }
4251
+ uploadedCliLogsBuildIds.add(buildId);
4252
+ }
4211
4253
  yield ctx2.client.finalizeBuildForCapsWithToken(buildId, totalSnapshots, projectToken, ctx2.log);
4212
4254
  if (ctx2.autoTunnelStarted) {
4213
4255
  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.47",
4
4
  "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
5
5
  "files": [
6
6
  "dist/**/*"