@lambdatest/smartui-cli 4.1.26 → 4.1.28

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 +27 -15
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1824,8 +1824,7 @@ var server_default = (ctx) => __async(void 0, null, function* () {
1824
1824
  let resp = yield ctx.client.getS3PreSignedURL(ctx);
1825
1825
  yield ctx.client.uploadLogs(ctx, resp.data.url);
1826
1826
  } else {
1827
- ctx.log.debug(`Log file to be uploaded via LSRS`);
1828
- let resp = ctx.client.sendCliLogsToLSRS(ctx);
1827
+ ctx.log.debug(`Skipping upload of CLI logs as useLambdaInternal is set`);
1829
1828
  }
1830
1829
  if (pingIntervalId !== null) {
1831
1830
  clearInterval(pingIntervalId);
@@ -2077,7 +2076,7 @@ var authExec_default = (ctx) => {
2077
2076
  };
2078
2077
 
2079
2078
  // package.json
2080
- var version = "4.1.26";
2079
+ var version = "4.1.28";
2081
2080
  var package_default = {
2082
2081
  name: "@lambdatest/smartui-cli",
2083
2082
  version,
@@ -2246,7 +2245,11 @@ var httpClient = class {
2246
2245
  }
2247
2246
  const response = yield this.request({
2248
2247
  url: "/token/verify",
2249
- method: "GET"
2248
+ method: "GET",
2249
+ headers: {
2250
+ userName: env.LT_USERNAME,
2251
+ accessKey: env.LT_ACCESS_KEY
2252
+ }
2250
2253
  }, log2);
2251
2254
  if (response && response.projectToken) {
2252
2255
  this.projectToken = response.projectToken;
@@ -2264,8 +2267,8 @@ var httpClient = class {
2264
2267
  return __async(this, null, function* () {
2265
2268
  var _a, _b;
2266
2269
  let authResult = 1;
2267
- let userName = "";
2268
- let passWord = "";
2270
+ let userName = ctx.env.LT_USERNAME;
2271
+ let passWord = ctx.env.LT_ACCESS_KEY;
2269
2272
  if (ctx.config.tunnel) {
2270
2273
  if (((_a = ctx.config.tunnel) == null ? void 0 : _a.user) && ((_b = ctx.config.tunnel) == null ? void 0 : _b.key)) {
2271
2274
  userName = ctx.config.tunnel.user;
@@ -2309,10 +2312,14 @@ var httpClient = class {
2309
2312
  }
2310
2313
  });
2311
2314
  }
2312
- createBuild(git, config, log2, buildName, isStartExec, smartGit, markBaseline, baselineBuild, scheduled) {
2315
+ createBuild(git, config, log2, buildName, isStartExec, smartGit, markBaseline, baselineBuild, scheduled, userName, accessKey) {
2313
2316
  return this.request({
2314
2317
  url: "/build",
2315
2318
  method: "POST",
2319
+ headers: {
2320
+ userName,
2321
+ accessKey
2322
+ },
2316
2323
  data: {
2317
2324
  git,
2318
2325
  config,
@@ -2479,7 +2486,7 @@ var httpClient = class {
2479
2486
  }
2480
2487
  }, ctx.log);
2481
2488
  }
2482
- uploadScreenshot({ id: buildId, name: buildName, baseline }, ssPath, ssName, browserName, viewport, log2) {
2489
+ uploadScreenshot({ id: buildId, name: buildName, baseline }, ssPath, ssName, browserName, viewport, url = "", log2) {
2483
2490
  browserName = browserName === constants_default.SAFARI ? constants_default.WEBKIT : browserName;
2484
2491
  const file = fs5__default.default.readFileSync(ssPath);
2485
2492
  const form = new FormData__default.default();
@@ -2490,6 +2497,7 @@ var httpClient = class {
2490
2497
  form.append("buildName", buildName);
2491
2498
  form.append("screenshotName", ssName);
2492
2499
  form.append("baseline", baseline.toString());
2500
+ form.append("pageUrl", url);
2493
2501
  return this.axiosInstance.request({
2494
2502
  url: `/screenshot`,
2495
2503
  method: "POST",
@@ -2982,7 +2990,7 @@ var createBuildExec_default = (ctx) => {
2982
2990
  updateLogContext({ task: "createBuild" });
2983
2991
  try {
2984
2992
  if (ctx2.authenticatedInitially && !ctx2.config.skipBuildCreation) {
2985
- let resp = yield ctx2.client.createBuild(ctx2.git, ctx2.config, ctx2.log, ctx2.build.name, ctx2.isStartExec, ctx2.env.SMART_GIT, ctx2.options.markBaseline, ctx2.options.baselineBuild, ctx2.options.scheduled);
2993
+ let resp = yield ctx2.client.createBuild(ctx2.git, ctx2.config, ctx2.log, ctx2.build.name, ctx2.isStartExec, ctx2.env.SMART_GIT, ctx2.options.markBaseline, ctx2.options.baselineBuild, ctx2.options.scheduled, ctx2.env.LT_USERNAME, ctx2.env.LT_ACCESS_KEY);
2986
2994
  if (resp && resp.data && resp.data.buildId) {
2987
2995
  ctx2.build = {
2988
2996
  id: resp.data.buildId,
@@ -3082,7 +3090,6 @@ var exec_default = (ctx) => {
3082
3090
  if (code !== null) {
3083
3091
  task.title = `Execution of '${(_a3 = ctx2.args.execCommand) == null ? void 0 : _a3.join(" ")}' completed; exited with code ${code}`;
3084
3092
  if (code !== 0) {
3085
- reject();
3086
3093
  process.exitCode = code;
3087
3094
  }
3088
3095
  } else if (signal !== null) {
@@ -3182,7 +3189,6 @@ var finalizeBuild_default = (ctx) => {
3182
3189
  } else {
3183
3190
  is_baseline = false;
3184
3191
  }
3185
- console.log(`start polling was called at finalize build for buildId: ${buildId}`);
3186
3192
  startPolling(ctx2, buildId, is_baseline, capabilities.projectToken);
3187
3193
  yield new Promise((resolve) => setTimeout(resolve, 7e3));
3188
3194
  ctx2.fetchResultsForBuild.push(buildId);
@@ -3217,6 +3223,12 @@ var finalizeBuild_default = (ctx) => {
3217
3223
  let resp = ctx2.client.sendCliLogsToLSRS(ctx2);
3218
3224
  }
3219
3225
  }
3226
+ if (process.exitCode && process.exitCode !== 0) {
3227
+ ctx2.log.error(`Exiting process with code ${process.exitCode}`);
3228
+ task.output = chalk__default.default.gray(`Exiting process with code ${process.exitCode}`);
3229
+ task.title = "Build finalized with errors";
3230
+ throw new Error(`Process exited with code ${process.exitCode}`);
3231
+ }
3220
3232
  } catch (error) {
3221
3233
  ctx2.log.debug(error);
3222
3234
  }
@@ -4117,7 +4129,7 @@ var Queue = class {
4117
4129
  }
4118
4130
  if (!this.ctx.config.delayedUpload && snapshot && snapshot.name && this.snapshotNames.includes(snapshot.name) && !this.ctx.config.allowDuplicateSnapshotNames) {
4119
4131
  drop = true;
4120
- 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.`);
4132
+ this.ctx.log.info(`Skipping duplicate SmartUI snapshot '${snapshot.name}'. To capture duplicate screenshots, please set the 'allowDuplicateSnapshotNames' or 'delayedUpload' configuration as true in your config file.`);
4121
4133
  }
4122
4134
  if (this.ctx.config.delayedUpload && snapshot && snapshot.name && this.snapshotNames.includes(snapshot.name)) {
4123
4135
  drop = this.filterExistingVariants(snapshot, this.ctx.config);
@@ -4538,7 +4550,7 @@ var createBuild_default = (ctx) => {
4538
4550
  task: (ctx2, task) => __async(void 0, null, function* () {
4539
4551
  updateLogContext({ task: "createBuild" });
4540
4552
  try {
4541
- let resp = yield ctx2.client.createBuild(ctx2.git, ctx2.config, ctx2.log, ctx2.build.name, ctx2.isStartExec, ctx2.env.SMART_GIT, ctx2.options.markBaseline, ctx2.options.baselineBuild, ctx2.options.scheduled);
4553
+ let resp = yield ctx2.client.createBuild(ctx2.git, ctx2.config, ctx2.log, ctx2.build.name, ctx2.isStartExec, ctx2.env.SMART_GIT, ctx2.options.markBaseline, ctx2.options.baselineBuild, ctx2.options.scheduled, ctx2.env.LT_USERNAME, ctx2.env.LT_ACCESS_KEY);
4542
4554
  if (resp && resp.data && resp.data.buildId) {
4543
4555
  ctx2.build = {
4544
4556
  id: resp.data.buildId,
@@ -4609,7 +4621,7 @@ function captureScreenshotsForConfig(ctx, browsers, urlConfig, browserName, rend
4609
4621
  yield page == null ? void 0 : page.waitForTimeout(waitForTimeout || 0);
4610
4622
  yield executeDocumentScripts(ctx, page, "beforeSnapshot", beforeSnapshotScript);
4611
4623
  yield page == null ? void 0 : page.screenshot({ path: ssPath, fullPage });
4612
- yield ctx.client.uploadScreenshot(ctx.build, ssPath, name, browserName, viewportString, ctx.log);
4624
+ yield ctx.client.uploadScreenshot(ctx.build, ssPath, name, browserName, viewportString, url, ctx.log);
4613
4625
  }
4614
4626
  } catch (error) {
4615
4627
  throw new Error(`captureScreenshotsForConfig failed for browser ${browserName}; error: ${error}`);
@@ -4779,7 +4791,7 @@ function uploadScreenshots(ctx) {
4779
4791
  viewport = `${width}x${height}`;
4780
4792
  }
4781
4793
  }
4782
- yield ctx.client.uploadScreenshot(ctx.build, filePath, ssId, "default", viewport, ctx.log);
4794
+ yield ctx.client.uploadScreenshot(ctx.build, filePath, ssId, "default", viewport, "", ctx.log);
4783
4795
  ctx.log.info(`${filePath} : uploaded successfully`);
4784
4796
  noOfScreenshots++;
4785
4797
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdatest/smartui-cli",
3
- "version": "4.1.26",
3
+ "version": "4.1.28",
4
4
  "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
5
5
  "files": [
6
6
  "dist/**/*"