@lambdatest/smartui-cli 4.1.27 → 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 +25 -12
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -2076,7 +2076,7 @@ var authExec_default = (ctx) => {
2076
2076
  };
2077
2077
 
2078
2078
  // package.json
2079
- var version = "4.1.27";
2079
+ var version = "4.1.28";
2080
2080
  var package_default = {
2081
2081
  name: "@lambdatest/smartui-cli",
2082
2082
  version,
@@ -2245,7 +2245,11 @@ var httpClient = class {
2245
2245
  }
2246
2246
  const response = yield this.request({
2247
2247
  url: "/token/verify",
2248
- method: "GET"
2248
+ method: "GET",
2249
+ headers: {
2250
+ userName: env.LT_USERNAME,
2251
+ accessKey: env.LT_ACCESS_KEY
2252
+ }
2249
2253
  }, log2);
2250
2254
  if (response && response.projectToken) {
2251
2255
  this.projectToken = response.projectToken;
@@ -2263,8 +2267,8 @@ var httpClient = class {
2263
2267
  return __async(this, null, function* () {
2264
2268
  var _a, _b;
2265
2269
  let authResult = 1;
2266
- let userName = "";
2267
- let passWord = "";
2270
+ let userName = ctx.env.LT_USERNAME;
2271
+ let passWord = ctx.env.LT_ACCESS_KEY;
2268
2272
  if (ctx.config.tunnel) {
2269
2273
  if (((_a = ctx.config.tunnel) == null ? void 0 : _a.user) && ((_b = ctx.config.tunnel) == null ? void 0 : _b.key)) {
2270
2274
  userName = ctx.config.tunnel.user;
@@ -2308,10 +2312,14 @@ var httpClient = class {
2308
2312
  }
2309
2313
  });
2310
2314
  }
2311
- createBuild(git, config, log2, buildName, isStartExec, smartGit, markBaseline, baselineBuild, scheduled) {
2315
+ createBuild(git, config, log2, buildName, isStartExec, smartGit, markBaseline, baselineBuild, scheduled, userName, accessKey) {
2312
2316
  return this.request({
2313
2317
  url: "/build",
2314
2318
  method: "POST",
2319
+ headers: {
2320
+ userName,
2321
+ accessKey
2322
+ },
2315
2323
  data: {
2316
2324
  git,
2317
2325
  config,
@@ -2478,7 +2486,7 @@ var httpClient = class {
2478
2486
  }
2479
2487
  }, ctx.log);
2480
2488
  }
2481
- uploadScreenshot({ id: buildId, name: buildName, baseline }, ssPath, ssName, browserName, viewport, log2) {
2489
+ uploadScreenshot({ id: buildId, name: buildName, baseline }, ssPath, ssName, browserName, viewport, url = "", log2) {
2482
2490
  browserName = browserName === constants_default.SAFARI ? constants_default.WEBKIT : browserName;
2483
2491
  const file = fs5__default.default.readFileSync(ssPath);
2484
2492
  const form = new FormData__default.default();
@@ -2489,6 +2497,7 @@ var httpClient = class {
2489
2497
  form.append("buildName", buildName);
2490
2498
  form.append("screenshotName", ssName);
2491
2499
  form.append("baseline", baseline.toString());
2500
+ form.append("pageUrl", url);
2492
2501
  return this.axiosInstance.request({
2493
2502
  url: `/screenshot`,
2494
2503
  method: "POST",
@@ -2981,7 +2990,7 @@ var createBuildExec_default = (ctx) => {
2981
2990
  updateLogContext({ task: "createBuild" });
2982
2991
  try {
2983
2992
  if (ctx2.authenticatedInitially && !ctx2.config.skipBuildCreation) {
2984
- 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);
2985
2994
  if (resp && resp.data && resp.data.buildId) {
2986
2995
  ctx2.build = {
2987
2996
  id: resp.data.buildId,
@@ -3081,7 +3090,6 @@ var exec_default = (ctx) => {
3081
3090
  if (code !== null) {
3082
3091
  task.title = `Execution of '${(_a3 = ctx2.args.execCommand) == null ? void 0 : _a3.join(" ")}' completed; exited with code ${code}`;
3083
3092
  if (code !== 0) {
3084
- reject();
3085
3093
  process.exitCode = code;
3086
3094
  }
3087
3095
  } else if (signal !== null) {
@@ -3181,7 +3189,6 @@ var finalizeBuild_default = (ctx) => {
3181
3189
  } else {
3182
3190
  is_baseline = false;
3183
3191
  }
3184
- console.log(`start polling was called at finalize build for buildId: ${buildId}`);
3185
3192
  startPolling(ctx2, buildId, is_baseline, capabilities.projectToken);
3186
3193
  yield new Promise((resolve) => setTimeout(resolve, 7e3));
3187
3194
  ctx2.fetchResultsForBuild.push(buildId);
@@ -3216,6 +3223,12 @@ var finalizeBuild_default = (ctx) => {
3216
3223
  let resp = ctx2.client.sendCliLogsToLSRS(ctx2);
3217
3224
  }
3218
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
+ }
3219
3232
  } catch (error) {
3220
3233
  ctx2.log.debug(error);
3221
3234
  }
@@ -4537,7 +4550,7 @@ var createBuild_default = (ctx) => {
4537
4550
  task: (ctx2, task) => __async(void 0, null, function* () {
4538
4551
  updateLogContext({ task: "createBuild" });
4539
4552
  try {
4540
- 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);
4541
4554
  if (resp && resp.data && resp.data.buildId) {
4542
4555
  ctx2.build = {
4543
4556
  id: resp.data.buildId,
@@ -4608,7 +4621,7 @@ function captureScreenshotsForConfig(ctx, browsers, urlConfig, browserName, rend
4608
4621
  yield page == null ? void 0 : page.waitForTimeout(waitForTimeout || 0);
4609
4622
  yield executeDocumentScripts(ctx, page, "beforeSnapshot", beforeSnapshotScript);
4610
4623
  yield page == null ? void 0 : page.screenshot({ path: ssPath, fullPage });
4611
- 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);
4612
4625
  }
4613
4626
  } catch (error) {
4614
4627
  throw new Error(`captureScreenshotsForConfig failed for browser ${browserName}; error: ${error}`);
@@ -4778,7 +4791,7 @@ function uploadScreenshots(ctx) {
4778
4791
  viewport = `${width}x${height}`;
4779
4792
  }
4780
4793
  }
4781
- 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);
4782
4795
  ctx.log.info(`${filePath} : uploaded successfully`);
4783
4796
  noOfScreenshots++;
4784
4797
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdatest/smartui-cli",
3
- "version": "4.1.27",
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/**/*"