@uipath/test-manager-tool 1.207.0-preview.307 → 1.207.0-preview.308

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/README.md CHANGED
@@ -44,6 +44,7 @@ uip tm testcases create --project-key DEMO --name "Login smoke"
44
44
  uip tm testsets run --test-set-key DEMO:10 --wait
45
45
  uip tm run --type package --project-key DEMO --project-path ./MyTests/project.json --folder-path Shared --result-path ./results
46
46
  uip tm run --type package --project-key DEMO --package-name MyTests --package-version 1.0 --result-path ./results
47
+ uip tm run --type package --package-name MyTests --package-version 1.0 --folder-path Shared --result-path ./results # tenant's default project
47
48
  uip tm result download --execution-id <EXECUTION_ID> --project-key DEMO --result-path ./junit.xml
48
49
  ```
49
50
 
@@ -51,7 +52,7 @@ uip tm result download --execution-id <EXECUTION_ID> --project-key DEMO --result
51
52
 
52
53
  - `--output <format>` - Output format: table, json, yaml, plain, markdown (default: json)
53
54
  - `--output-filter <expression>` - JMESPath expression applied to the `Data` field
54
- - `--project-key <key>` / `--project-id <id>` - Target project for project-scoped commands
55
+ - `--project-key <key>` / `--project-id <id>` - Target project for project-scoped commands (`tm run` falls back to the tenant's default project)
55
56
  - `-t, --tenant <name>` - Tenant name
56
57
  - `--limit <number>` - Number of items to return
57
58
  - `--offset <number>` - Number of items to skip
package/dist/index.js CHANGED
@@ -9,11 +9,11 @@ import"./tool-bvkzq6jr.js";
9
9
  import {
10
10
  metadata2,
11
11
  registerCommands2
12
- } from "./tool-we9qwvqr.js";
12
+ } from "./tool-mj8vempn.js";
13
13
  import"./tool-b24ehgnz.js";
14
- import"./tool-w2tgc8pr.js";
14
+ import"./tool-r36bqhrb.js";
15
15
  import"./tool-246df0cd.js";
16
- import"./tool-begvxz7a.js";
16
+ import"./tool-kgbbngwg.js";
17
17
 
18
18
  // src/index.ts
19
19
  var program = new Command;
@@ -16,7 +16,7 @@ import {
16
16
  isFullVersion,
17
17
  transientVersion,
18
18
  RunPackageTimeoutError
19
- } from "./tool-begvxz7a.js";
19
+ } from "./tool-kgbbngwg.js";
20
20
  import"./tool-hm0kg56c.js";
21
21
  import {
22
22
  __toESM
@@ -56,7 +56,7 @@ async function packAndUploadTestProject(options) {
56
56
  await fs.mkdir(outputDir);
57
57
  try {
58
58
  await ensurePackagerFactory("rpa");
59
- const { createNodeProjectPackager, PackService, ProjectPackOptions } = await import("./node-jh0df6sp.js");
59
+ const { createNodeProjectPackager, PackService, ProjectPackOptions } = await import("./node-rva8rvxb.js");
60
60
  const requestedId = new PackService().sanitizePackageId(project.name);
61
61
  const packager = await createNodeProjectPackager({
62
62
  logHandler: logger.handleLog
@@ -207,7 +207,7 @@ async function readLocalProject(projectPath) {
207
207
  throw instructiveError(`Project path '${projectPath}' is not a UiPath project manifest.`, "Pass a project directory, project.json, or project.uiproj.", "invalid_argument");
208
208
  }
209
209
  }
210
- const { ProjectLoader } = await import("./node-jh0df6sp.js");
210
+ const { ProjectLoader } = await import("./node-rva8rvxb.js");
211
211
  const [loadError, project] = await catchError(new ProjectLoader(fs).loadProject(stats.isDirectory() ? absolutePath : fs.path.dirname(absolutePath)));
212
212
  if (loadError || !project) {
213
213
  throw instructiveError(loadError?.message ?? `Project '${projectPath}' could not be read.`, "Pass a UiPath RPA project directory with a valid project.json or project.uiproj.", "invalid_argument");
@@ -34,7 +34,7 @@ import {
34
34
  checkContentSelection,
35
35
  waitForMigrationJob,
36
36
  recheckJobHint
37
- } from "./tool-w2tgc8pr.js";
37
+ } from "./tool-r36bqhrb.js";
38
38
  import {
39
39
  PROJECT_CONFIG_IMPORT_FORBIDDEN_MESSAGE,
40
40
  TM_FORBIDDEN_MESSAGE,
@@ -4581,7 +4581,7 @@ var package_default = {
4581
4581
  name: "@uipath/project-packager",
4582
4582
  author: "UiPath",
4583
4583
  license: "SEE LICENSE IN LICENSE.txt",
4584
- version: "1.207.0-preview.307",
4584
+ version: "1.207.0-preview.308",
4585
4585
  description: "UiPath Project Packager - core library for packing individual UiPath projects",
4586
4586
  type: "module",
4587
4587
  main: "./dist/index.js",
@@ -5619,4 +5619,4 @@ export {
5619
5619
  createNodeProjectPackager
5620
5620
  };
5621
5621
 
5622
- //# debugId=14C432B2DEE7586364756E2164756E21
5622
+ //# debugId=DF4D64FBAF19EC7564756E2164756E21
@@ -1286,6 +1286,6 @@ function sleep2(ms) {
1286
1286
  return new Promise((resolve) => setTimeout(resolve, ms));
1287
1287
  }
1288
1288
 
1289
- export { buildExecutionReport, toGetPackageEntryPointsRequest, toUpdatePackageAutomationRequest, toStartExecuteRequest, resolveAutomationFolder, matchesPackageName, fetchPackageEntryPoints, linkPackageEntryPoints, readOverrideParameters, matchOverrideParameters, isAppVersion, isFullVersion, transientVersion, toFilteredTestCasesRequest, toDynamicTestCasesRequest, toGetDynamicLabelsRequest, toAssignDynamicLabelsRequest, toPlaywrightProjectContextRequest, toUpdateTestSetPackagesRequest, DEFAULT_TIMEOUT_MS, DEFAULT_INTERVAL_MS, MAX_EXECUTION_TIMEOUT_S, stopOnPermanentError, reportPollError, reportTerminalExecution, handleExecutionWait, startedRunOf, runMayHaveStarted, RunPackageTimeoutError, Deadline, resolveRunFolder, resolvePackageVersion, resolveUploadedPackageVersion, waitForPackageInTestManager, createTransientTestSet, applyInputOverrides, runAndRetry };
1289
+ export { buildExecutionReport, toGetPackageEntryPointsRequest, toUpdatePackageAutomationRequest, toStartExecuteRequest, resolveAutomationFolder, matchesPackageName, fetchPackageEntryPoints, linkPackageEntryPoints, readOverrideParameters, matchOverrideParameters, isAppVersion, isFullVersion, transientVersion, toFilteredTestCasesRequest, toDynamicTestCasesRequest, toGetDynamicLabelsRequest, toAssignDynamicLabelsRequest, toPlaywrightProjectContextRequest, toUpdateTestSetPackagesRequest, DEFAULT_TIMEOUT_MS, DEFAULT_INTERVAL_MS, MAX_EXECUTION_TIMEOUT_S, stopOnPermanentError, reportPollError, reportTerminalExecution, handleExecutionWait, tagStartedRun, startedRunOf, runMayHaveStarted, RunPackageTimeoutError, Deadline, resolveRunFolder, resolvePackageVersion, resolveUploadedPackageVersion, waitForPackageInTestManager, createTransientTestSet, applyInputOverrides, runAndRetry };
1290
1290
 
1291
- //# debugId=5366C23A46960D5B64756E2164756E21
1291
+ //# debugId=59EDD598B8FD387D64756E2164756E21
@@ -145,6 +145,7 @@ import {
145
145
  initializeContext,
146
146
  initializeContextWithProject,
147
147
  resolveContextWithProject,
148
+ resolveContext,
148
149
  ensureProjectKey,
149
150
  enumOption,
150
151
  projectKeyOption,
@@ -163,7 +164,7 @@ import {
163
164
  writeZipResponse,
164
165
  registerProjectExportCommand,
165
166
  registerMigrationCommand
166
- } from "./tool-w2tgc8pr.js";
167
+ } from "./tool-r36bqhrb.js";
167
168
  import {
168
169
  FolderDtoFeedTypeEnum2,
169
170
  FoldersApi2,
@@ -199,6 +200,7 @@ import {
199
200
  reportPollError,
200
201
  reportTerminalExecution,
201
202
  handleExecutionWait,
203
+ tagStartedRun,
202
204
  startedRunOf,
203
205
  runMayHaveStarted,
204
206
  RunPackageTimeoutError,
@@ -210,7 +212,7 @@ import {
210
212
  createTransientTestSet,
211
213
  applyInputOverrides,
212
214
  runAndRetry
213
- } from "./tool-begvxz7a.js";
215
+ } from "./tool-kgbbngwg.js";
214
216
  import {
215
217
  __toESM
216
218
  } from "./tool-epsr41wx.js";
@@ -219,7 +221,7 @@ var package_default = {
219
221
  name: "@uipath/test-manager-tool",
220
222
  author: "UiPath",
221
223
  license: "SEE LICENSE IN LICENSE.txt",
222
- version: "1.207.0-preview.307",
224
+ version: "1.207.0-preview.308",
223
225
  description: "Manage test cases, test sets, executions, and results.",
224
226
  private: false,
225
227
  repository: {
@@ -9553,6 +9555,39 @@ function toSettingsRow(s) {
9553
9555
  };
9554
9556
  }
9555
9557
 
9558
+ // src/utils/default-project.ts
9559
+ var USE_YOUR_OWN = "Or use a project of your own: `uip tm project list` shows the ones you can open.";
9560
+ var RUN_WITH_PROJECT_KEY = "Or re-run with --project-key <PROJECT_KEY>: `uip tm project list` shows the projects you can open.";
9561
+ async function explainGetDefaultError(error, otherwise) {
9562
+ const response = error.response;
9563
+ if (response?.status === 401 && await readErrorCode(response) === "noPermission") {
9564
+ return instructiveError("You don't have permission to access the tenant's default project.", `Please contact a Test Manager administrator to request access. ${otherwise}`, "permission_denied");
9565
+ }
9566
+ if (response?.status === 403) {
9567
+ return instructiveError("Test Manager refused to get or create the tenant's default project (403).", `This needs a Test Manager license, the TM.Projects scope, and the tenant's Project.Create permission. ${otherwise}`, "permission_denied");
9568
+ }
9569
+ return error;
9570
+ }
9571
+ async function fetchDefaultProject(tmConfig, otherwise = USE_YOUR_OWN) {
9572
+ return new ProjectsApi2(tmConfig).projectsGetOrCreateDefaultProject().catch(async (error) => {
9573
+ throw await explainGetDefaultError(error, otherwise);
9574
+ });
9575
+ }
9576
+ async function getDefaultProject(tmConfig, otherwise = USE_YOUR_OWN) {
9577
+ const project = await fetchDefaultProject(tmConfig, otherwise);
9578
+ const projectKey = project.projectPrefix?.trim();
9579
+ if (!project.id || !projectKey) {
9580
+ throw instructiveError("Test Manager returned the default project without an id or key.", "Pass --project-key or --project-id instead.", "server_error");
9581
+ }
9582
+ return { projectId: project.id, projectKey, name: project.name ?? "" };
9583
+ }
9584
+ async function readErrorCode(response) {
9585
+ const body = await response.clone().json().catch(() => {
9586
+ return;
9587
+ });
9588
+ return body?.errorCode;
9589
+ }
9590
+
9556
9591
  // src/commands/migration-import.ts
9557
9592
  var IMPORT_EXAMPLES = [
9558
9593
  {
@@ -9597,7 +9632,7 @@ var IMPORT_EXAMPLES = [
9597
9632
  ];
9598
9633
  var registerProjectImportCommand = (parent) => {
9599
9634
  parent.command("import").description("Import a .tmh package into a project, an existing one or one created from the package. The file is uploaded in chunks and the service processes it as a background job; this returns the job id unless --wait is given.").addOption(projectKeyOption()).addOption(projectIdOption()).requiredOption("--file <path>", "The .tmh package to import. It is read into memory whole, and packages over 2 GiB are refused").option("--create-project", "Create the target project from the name, key and description recorded in the package, instead of importing into an existing one. It stays inactive until the import finishes").option("--new-project-name <name>", "Name for the project --create-project makes, instead of the package's").option("--new-project-key <key>", "Key for the project --create-project makes, instead of the package's. Must be free in this tenant").addOption(new Option("--include <content...>", `Content to bring in, space-separated. ${describeContentDefaults(IMPORT_CONTENT)}`).choices(IMPORT_CONTENT_CHOICES)).addOption(new Option("--exclude <content...>", `Content to leave out, space-separated. ${describeContentDefaults(IMPORT_CONTENT)}`).choices(IMPORT_CONTENT_CHOICES)).option("--wait", "Poll until the import finishes").option("--timeout <seconds>", "Maximum seconds to wait (0 = no timeout). Requires --wait.", String(DEFAULT_IMPORT_TIMEOUT_MS / 1000)).option("--poll-interval <seconds>", "Seconds between status checks. Requires --wait.", String(DEFAULT_MIGRATION_INTERVAL_MS / 1000)).addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(IMPORT_EXAMPLES).trackedAction(processContext, async (options) => {
9600
- const { executeImport } = await import("./migration-import-run-29hzw92p.js");
9635
+ const { executeImport } = await import("./migration-import-run-haxyebwa.js");
9601
9636
  await executeImport(options);
9602
9637
  });
9603
9638
  };
@@ -9917,29 +9952,12 @@ async function reportProjectError(error, { prefix = "" } = {}) {
9917
9952
  details: readInstructions(error) ?? classified.details
9918
9953
  });
9919
9954
  }
9920
- var USE_YOUR_OWN = "Or use a project of your own: `uip tm project list` shows the ones you can open.";
9921
- async function explainGetDefaultError(error) {
9922
- const response = error.response;
9923
- if (response?.status === 401 && await readErrorCode(response) === "noPermission") {
9924
- return instructiveError("You do not have access to the tenant's default project.", `Ask a Test Manager administrator to give you access to it. ${USE_YOUR_OWN}`, "permission_denied");
9925
- }
9926
- if (response?.status === 403) {
9927
- return instructiveError("Test Manager refused to get or create the tenant's default project (403).", `This needs a Test Manager license, the TM.Projects scope, and the tenant's Project.Create permission. ${USE_YOUR_OWN}`, "permission_denied");
9928
- }
9929
- return error;
9930
- }
9931
9955
  function explainSetDefaultError(error, projectKey) {
9932
9956
  if (error.response?.status !== 403) {
9933
9957
  return error;
9934
9958
  }
9935
9959
  return instructiveError(`Test Manager refused to make '${projectKey}' the default project (403).`, "An external application needs the TM.Administration and TM.Projects scopes. A user needs to be a tenant administrator.", "permission_denied");
9936
9960
  }
9937
- async function readErrorCode(response) {
9938
- const body = await response.clone().json().catch(() => {
9939
- return;
9940
- });
9941
- return body?.errorCode;
9942
- }
9943
9961
  var SET_DEFAULT_DESCRIPTION = "Make this project the tenant's default. Who can open it does not change.";
9944
9962
  var registerProjectCommand = (program) => {
9945
9963
  const projectCmd = program.command("project").description("Manage Test Manager projects");
@@ -9981,19 +9999,12 @@ var registerProjectCommand = (program) => {
9981
9999
  OutputFormatter.success(new SuccessOutput("ProjectsList", projects.map(toListRow)));
9982
10000
  });
9983
10001
  projectCmd.command("get-default").description("Get the tenant's default Test Manager project, creating it if there is none.").addOption(createHiddenDeprecatedTenantOption("-t, --tenant <tenant-name>")).examples(PROJECT_GET_DEFAULT_EXAMPLES).trackedAction(processContext, async (options) => {
9984
- const [authError, ctx] = await catchError(initializeContext(options));
9985
- if (authError) {
9986
- OutputFormatter.error({
9987
- Result: RESULTS.Failure,
9988
- Message: authError.message,
9989
- Instructions: instructionsFor("auth")
9990
- });
9991
- processContext.exit(1);
10002
+ const ctx = await resolveContext(options);
10003
+ if (!ctx)
9992
10004
  return;
9993
- }
9994
- const [error, project] = await catchError(new ProjectsApi2(ctx.tmConfig).projectsGetOrCreateDefaultProject());
10005
+ const [error, project] = await catchError(fetchDefaultProject(ctx.tmConfig));
9995
10006
  if (error) {
9996
- await reportProjectError(await explainGetDefaultError(error));
10007
+ await reportProjectError(error);
9997
10008
  return;
9998
10009
  }
9999
10010
  OutputFormatter.success(new SuccessOutput("ProjectGetDefault", toListRow(project)));
@@ -13233,7 +13244,8 @@ function toRunSummary(input) {
13233
13244
  ...input.ignoredInputs.length > 0 && {
13234
13245
  IgnoredInputs: input.ignoredInputs,
13235
13246
  DeclaredInputs: input.declaredInputs
13236
- }
13247
+ },
13248
+ ProjectKey: input.projectKey
13237
13249
  };
13238
13250
  }
13239
13251
  function ignoredInputsNote(data) {
@@ -13329,7 +13341,8 @@ var EXAMPLE_DATA = {
13329
13341
  Cancelled: 0,
13330
13342
  Retries: 0,
13331
13343
  Format: "junit",
13332
- OutputPath: "./results/junit.xml"
13344
+ OutputPath: "./results/junit.xml",
13345
+ ProjectKey: "DEMO"
13333
13346
  };
13334
13347
  var RUN_PACKAGE_EXAMPLES = [
13335
13348
  {
@@ -13342,6 +13355,18 @@ var RUN_PACKAGE_EXAMPLES = [
13342
13355
  Command: "uip tm run --type package --project-key DEMO --package-name MyTests --package-version 1.0.3 --folder-path Shared --result-path ./results/junit.xml",
13343
13356
  Output: { Code: "RunPackage", Data: EXAMPLE_DATA }
13344
13357
  },
13358
+ {
13359
+ Description: "Run an uploaded package in the tenant's default project (no --project-key)",
13360
+ Command: "uip tm run --type package --package-name MyTests --package-version 1.0.3 --folder-path Shared --result-path ./results/junit.xml",
13361
+ Output: {
13362
+ Code: "RunPackage",
13363
+ Data: {
13364
+ ...EXAMPLE_DATA,
13365
+ ProjectKey: "TMDP",
13366
+ ExecutionUrl: "https://cloud.uipath.com/org/tenant/testmanager_/TMDP/testexecutions/a1b2c3d4-0000-0000-0000-000000000001"
13367
+ }
13368
+ }
13369
+ },
13345
13370
  {
13346
13371
  Description: "Run the latest 1.0.x patch, override inputs, retry failed tests twice, and write the UiPath JSON report",
13347
13372
  Command: "uip tm run --type package --project-key DEMO --package-name MyTests --package-version 1.0 --folder-path Shared --input-path ./inputs.json --max-retries 2 --format uipath",
@@ -13358,7 +13383,7 @@ var RUN_PACKAGE_EXAMPLES = [
13358
13383
  ];
13359
13384
  var RUN_TYPES = ["package"];
13360
13385
  var registerRunCommand = (program) => {
13361
- program.command("run").description("Run tests in Test Manager, wait for the results, and write a report. --type package either packs and uploads --project-path, or runs a package already uploaded to Orchestrator. Exits 0 when every test passes, 1 when a test fails or the run is cancelled, 2 on a login or permission problem, 3 on a bad option or input, 4 on timeout.").addOption(new Option("--type <type>", `What to run: ${RUN_TYPES.join(", ")} (a local project or a package already uploaded to Orchestrator)`).choices(RUN_TYPES).makeOptionMandatory()).addOption(projectKeyOption()).addOption(projectIdOption()).option("--project-path <path>", "Local RPA test project directory, project.json, or project.uiproj to pack and upload before running").option("--package-name <name>", "Package id already uploaded to Orchestrator (e.g. MyTests); cannot be used with --project-path").option("--package-version <version>", "For an uploaded package: app version (e.g. 1.0) or exact version. With --project-path: optional full version; by default each run packs a new one, projectVersion's major.minor with the seconds since 2019 as patch, as uipcli did.").option("--folder-path <path>", "Orchestrator folder to run the tests in (e.g. Shared or Shared/CI)").option("--folder-key <uuid>", "Orchestrator folder key, instead of --folder-path").option("--input-path <file>", 'JSON file with parameter overrides: [{"name":"Param","type":"String","value":"v"}]').option("--max-retries <count>", "Re-run failed test cases up to this many times", (raw) => parseBoundedInt(raw, "--max-retries", {
13386
+ program.command("run").description("Run tests in Test Manager, wait for the results, and write a report. --type package either packs and uploads --project-path, or runs a package already uploaded to Orchestrator. Exits 0 when every test passes, 1 when a test fails or the run is cancelled, 2 on a login or permission problem, 3 on a bad option or input, 4 on timeout.").addOption(new Option("--type <type>", `What to run: ${RUN_TYPES.join(", ")} (a local project or a package already uploaded to Orchestrator)`).choices(RUN_TYPES).makeOptionMandatory()).addOption(projectKeyOption("Test Manager project key. Without this or --project-id, the tests run in the tenant's default project, which Test Manager creates if there is none; that needs the tenant's Project.Create permission")).addOption(projectIdOption()).option("--project-path <path>", "Local RPA test project directory, project.json, or project.uiproj to pack and upload before running").option("--package-name <name>", "Package id already uploaded to Orchestrator (e.g. MyTests); cannot be used with --project-path").option("--package-version <version>", "For an uploaded package: app version (e.g. 1.0) or exact version. With --project-path: optional full version; by default each run packs a new one, projectVersion's major.minor with the seconds since 2019 as patch, as uipcli did.").option("--folder-path <path>", "Orchestrator folder to run the tests in (e.g. Shared or Shared/CI)").option("--folder-key <uuid>", "Orchestrator folder key, instead of --folder-path").option("--input-path <file>", 'JSON file with parameter overrides: [{"name":"Param","type":"String","value":"v"}]').option("--max-retries <count>", "Re-run failed test cases up to this many times", (raw) => parseBoundedInt(raw, "--max-retries", {
13362
13387
  min: 0,
13363
13388
  max: MAX_RETRIES
13364
13389
  }), 0).addOption(new Option("--format <format>", "Report format").choices(REPORT_FORMATS).default("junit")).option("--result-path <path>", "Report file or directory (default: current working directory)").option("--include-passed-assertions", "Also read the assertions of passed tests for the report (one more request per passed test). By default only tests that did not pass get their assertions.").option("--timeout <seconds>", "Maximum seconds for the whole run, retries included (0 = no timeout)", (raw) => parseBoundedInt(raw, "--timeout", {
@@ -13377,14 +13402,14 @@ var registerRunCommand = (program) => {
13377
13402
  await reportFailure(inputError);
13378
13403
  return;
13379
13404
  }
13380
- const resolved = await resolveContextWithProject(options);
13405
+ const resolved = await resolveRunContext(options);
13381
13406
  if (!resolved)
13382
13407
  return;
13383
- const ctx = withRefreshingToken2(resolved, options.tenant);
13408
+ const ctx = withRefreshingToken2(resolved.ctx, options.tenant);
13384
13409
  const projectKey = await ensureProjectKey(ctx);
13385
13410
  if (projectKey === null)
13386
13411
  return;
13387
- const [error, data] = await catchError(runPackage(ctx, projectKey, options, limits, deadline, inputs));
13412
+ const [error, data] = await catchError(runPackage(ctx, projectKey, resolved.folder, options, limits, deadline, inputs));
13388
13413
  if (error) {
13389
13414
  await reportFailure(error);
13390
13415
  return;
@@ -13392,6 +13417,43 @@ var registerRunCommand = (program) => {
13392
13417
  reportOutcome(data);
13393
13418
  });
13394
13419
  };
13420
+ async function resolveRunContext(options) {
13421
+ if (options.projectKey !== undefined || options.projectId !== undefined) {
13422
+ const ctx = await resolveContextWithProject(options);
13423
+ if (!ctx)
13424
+ return null;
13425
+ const folder = await readFolder(options);
13426
+ return folder ? { ctx, folder } : null;
13427
+ }
13428
+ const base = await resolveContext(options);
13429
+ if (!base)
13430
+ return null;
13431
+ const folder = await readFolder(options);
13432
+ if (!folder)
13433
+ return null;
13434
+ const [error, project] = await catchError(getDefaultProject(base.tmConfig, RUN_WITH_PROJECT_KEY));
13435
+ if (error) {
13436
+ await reportFailure(error);
13437
+ return null;
13438
+ }
13439
+ logger.info(`No project given; running in the tenant's default project '${project.projectKey}'.`);
13440
+ return {
13441
+ ctx: {
13442
+ ...base,
13443
+ projectId: project.projectId,
13444
+ projectKey: project.projectKey
13445
+ },
13446
+ folder
13447
+ };
13448
+ }
13449
+ async function readFolder(options) {
13450
+ const [error, folder] = await catchError(resolveRunFolder(options, options.tenant));
13451
+ if (error) {
13452
+ await reportFailure(error);
13453
+ return null;
13454
+ }
13455
+ return folder;
13456
+ }
13395
13457
  function parseLimits(options) {
13396
13458
  const fail = (message, instructions) => {
13397
13459
  OutputFormatter.error({
@@ -13403,9 +13465,6 @@ function parseLimits(options) {
13403
13465
  processContext.exit(EXIT_CODES.ValidationError);
13404
13466
  return null;
13405
13467
  };
13406
- if (options.projectKey === undefined && options.projectId === undefined) {
13407
- return fail("No project was given.", "Pass --project-key (e.g. DEMO) or --project-id.");
13408
- }
13409
13468
  if (options.projectPath !== undefined) {
13410
13469
  if (options.packageName !== undefined) {
13411
13470
  return fail("--project-path and --package-name are mutually exclusive.", "Pass --project-path to pack and upload a local project, or pass --package-name with --package-version for an uploaded package.");
@@ -13426,11 +13485,10 @@ function parseLimits(options) {
13426
13485
  }
13427
13486
  return toRunLimits(options);
13428
13487
  }
13429
- async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
13488
+ async function runPackage(ctx, projectKey, folder, options, limits, deadline, inputs) {
13430
13489
  const { tmConfig, projectId } = ctx;
13431
13490
  const api = new TransientTestSetsApi2(tmConfig);
13432
- const folder = await resolveRunFolder(options, options.tenant);
13433
- const selected = options.projectPath !== undefined ? await (await import("./local-test-package-6ce2nqvj.js")).packAndUploadTestProject({
13491
+ const selected = options.projectPath !== undefined ? await (await import("./local-test-package-v32pqmbp.js")).packAndUploadTestProject({
13434
13492
  projectPath: options.projectPath,
13435
13493
  packageVersion: options.packageVersion,
13436
13494
  folder,
@@ -13453,6 +13511,7 @@ async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
13453
13511
  let keepTestSet = false;
13454
13512
  let runPassed = false;
13455
13513
  let reportPath;
13514
+ let finished;
13456
13515
  try {
13457
13516
  let ignoredInputs = [];
13458
13517
  let declaredInputs = [];
@@ -13462,7 +13521,7 @@ async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
13462
13521
  ignoredInputs = overrides.ignored;
13463
13522
  declaredInputs = overrides.declared;
13464
13523
  }
13465
- const tmWebUrl = `${ctx.baseUrl}/${ctx.organizationName ?? ctx.organizationId}/${ctx.tenantName}/testmanager_`;
13524
+ const webUrl = tmWebUrl(ctx);
13466
13525
  const reportOptions = {
13467
13526
  packageName: pkg.packageName,
13468
13527
  packageVersion: pkg.packageVersion,
@@ -13470,7 +13529,7 @@ async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
13470
13529
  format: options.format,
13471
13530
  resultPath: options.resultPath,
13472
13531
  includePassedAssertions: options.includePassedAssertions === true,
13473
- tmWebUrl,
13532
+ tmWebUrl: webUrl,
13474
13533
  leftMs: () => deadline.leftMs()
13475
13534
  };
13476
13535
  const [runError, outcome] = await catchError(runAndRetry(api, testSetId, limits.maxRetries, {
@@ -13484,6 +13543,12 @@ async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
13484
13543
  if (started || runMayHaveStarted(runError)) {
13485
13544
  keepTestSet = true;
13486
13545
  }
13546
+ if (started) {
13547
+ locateRun(runError, {
13548
+ projectKey,
13549
+ executionUrl: `${webUrl}/${projectKey}/testexecutions/${started.executionId}`
13550
+ });
13551
+ }
13487
13552
  if (started) {
13488
13553
  await writePartialReport(ctx, projectKey, started, reportOptions);
13489
13554
  if (runError instanceof RunPackageTimeoutError) {
@@ -13492,11 +13557,15 @@ async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
13492
13557
  }
13493
13558
  throw runError;
13494
13559
  }
13495
- const executionUrl = `${tmWebUrl}/${projectKey}/testexecutions/${outcome.executionId}`;
13560
+ const executionUrl = `${webUrl}/${projectKey}/testexecutions/${outcome.executionId}`;
13496
13561
  const [reportError, report] = await catchError(writeCompleteReport(ctx, projectKey, outcome.executionId, reportOptions, limits.intervalMs));
13497
13562
  if (reportError)
13498
- throw reportFailedAfterRun(reportError, outcome, executionUrl);
13563
+ throw locateRun(tagStartedRun(reportFailedAfterRun(reportError, outcome, executionUrl), {
13564
+ executionId: outcome.executionId,
13565
+ retries: outcome.retries
13566
+ }), { projectKey, executionUrl });
13499
13567
  const summary = toRunSummary({
13568
+ projectKey,
13500
13569
  executionId: outcome.executionId,
13501
13570
  executionUrl,
13502
13571
  packageName: pkg.packageName,
@@ -13510,10 +13579,16 @@ async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
13510
13579
  });
13511
13580
  reportPath = summary.OutputPath;
13512
13581
  runPassed = isSuccessfulRun(summary);
13582
+ finished = {
13583
+ executionId: outcome.executionId,
13584
+ retries: outcome.retries,
13585
+ projectKey,
13586
+ executionUrl
13587
+ };
13513
13588
  return summary;
13514
13589
  } finally {
13515
13590
  if (!keepTestSet) {
13516
- await deleteTransientTestSet(tmConfig, projectId, testSetId, runPassed, reportPath);
13591
+ await deleteTransientTestSet(tmConfig, projectId, testSetId, runPassed, reportPath, finished);
13517
13592
  }
13518
13593
  }
13519
13594
  }
@@ -13527,7 +13602,7 @@ function uploadedPackageSelectors(options) {
13527
13602
  packageVersion
13528
13603
  };
13529
13604
  }
13530
- async function deleteTransientTestSet(tmConfig, projectId, testSetId, failOnError, reportPath) {
13605
+ async function deleteTransientTestSet(tmConfig, projectId, testSetId, failOnError, reportPath, finished) {
13531
13606
  const [error] = await catchError(new TestSetsApi2(tmConfig).testSetsDelete({
13532
13607
  projectId,
13533
13608
  id: testSetId
@@ -13542,7 +13617,11 @@ async function deleteTransientTestSet(tmConfig, projectId, testSetId, failOnErro
13542
13617
  return;
13543
13618
  }
13544
13619
  if (failOnError) {
13545
- throw instructiveError(`The tests finished, but transient test set '${testSetId}' could not be deleted: ${classified.message}`, `${classified.details} The report was written to ${reportPath ?? "the requested output path"}. Delete the transient test set in Test Manager after fixing the cleanup failure.`, classified.errorCode, classified.retry);
13620
+ const cleanupError = instructiveError(`The tests finished, but transient test set '${testSetId}' could not be deleted: ${classified.message}`, `${classified.details} The report was written to ${reportPath ?? "the requested output path"}. Delete the transient test set in Test Manager after fixing the cleanup failure.`, classified.errorCode, classified.retry);
13621
+ if (!finished)
13622
+ throw cleanupError;
13623
+ const { executionId, retries, ...location } = finished;
13624
+ throw locateRun(tagStartedRun(cleanupError, { executionId, retries }), location);
13546
13625
  }
13547
13626
  logger.warn(`Could not delete transient test set '${testSetId}': ${error.message}`);
13548
13627
  }
@@ -13626,6 +13705,17 @@ function reportFailedAfterRun(error, outcome, executionUrl) {
13626
13705
  });
13627
13706
  return wrapped;
13628
13707
  }
13708
+ var RUN_LOCATION = Symbol("runLocation");
13709
+ function locateRun(error, location) {
13710
+ return Object.assign(error, { [RUN_LOCATION]: location });
13711
+ }
13712
+ function locationData(error) {
13713
+ const location = error[RUN_LOCATION];
13714
+ return location ? {
13715
+ ProjectKey: location.projectKey,
13716
+ ExecutionUrl: location.executionUrl
13717
+ } : {};
13718
+ }
13629
13719
  async function reportFailure(error) {
13630
13720
  if (error instanceof RunPackageTimeoutError) {
13631
13721
  const partial = error.reportPath !== undefined ? ` A report of the tests that finished is at ${error.reportPath}.` : "";
@@ -13641,7 +13731,8 @@ async function reportFailure(error) {
13641
13731
  Retries: error.retries ?? 0,
13642
13732
  ...error.reportPath !== undefined && {
13643
13733
  OutputPath: error.reportPath
13644
- }
13734
+ },
13735
+ ...locationData(error)
13645
13736
  }
13646
13737
  }
13647
13738
  });
@@ -13668,7 +13759,8 @@ async function reportFailure(error) {
13668
13759
  Retries: started.retries,
13669
13760
  ...started.reportPath !== undefined && {
13670
13761
  OutputPath: started.reportPath
13671
- }
13762
+ },
13763
+ ...locationData(error)
13672
13764
  }
13673
13765
  }
13674
13766
  });
@@ -22610,4 +22702,4 @@ var registerCommands2 = async (program) => {
22610
22702
 
22611
22703
  export { metadata2, registerCommands2 };
22612
22704
 
22613
- //# debugId=68F523C8F589902864756E2164756E21
22705
+ //# debugId=6D59C111FB05233964756E2164756E21
@@ -311,6 +311,20 @@ async function resolveContextWithProject(options) {
311
311
  }
312
312
  return ctx;
313
313
  }
314
+ async function resolveContext(options) {
315
+ const [authError, ctx] = await catchError(initializeContext(options));
316
+ if (authError) {
317
+ OutputFormatter.error({
318
+ Result: RESULTS.Failure,
319
+ ErrorCode: "authentication_required",
320
+ Message: authError.message,
321
+ Instructions: instructionsFor("auth")
322
+ });
323
+ processContext.exit(1);
324
+ return null;
325
+ }
326
+ return ctx;
327
+ }
314
328
  async function ensureProjectKey(ctx) {
315
329
  if (ctx.projectKey !== undefined) {
316
330
  return ctx.projectKey;
@@ -1326,6 +1340,6 @@ var registerMigrationCommand = (program) => {
1326
1340
  return migrationCmd;
1327
1341
  };
1328
1342
 
1329
- export { toOutput, toIsoDate, tmWebUrl, initializeContext, initializeContextWithProject, resolveContextWithProject, ensureProjectKey, enumOption, projectKeyOption, projectIdOption, blankValueMessage, blankFilterGiven, IMPORT_CONTENT, IMPORT_CONTENT_CHOICES, toImportJobRequest, toChunkUploadRequest, toJobUpdateRequest, toMigrationJobOutput, toSchemaVersionRows, DEFAULT_IMPORT_TIMEOUT_MS, DEFAULT_MIGRATION_INTERVAL_MS, CHUNK_UPLOAD_ATTEMPTS, CHUNK_RETRY_BACKOFF_MS, CHUNK_SIZE_BYTES, MAX_PACKAGE_NAME_LENGTH, MAX_IMPORT_PACKAGE_BYTES, CHUNK_NOT_SENT_CODES, checkOutputTarget, resolveOutputPath, withRefreshingToken, describeContentDefaults, checkContentSelection, waitForMigrationJob, recheckJobHint, writeZipResponse, registerProjectExportCommand, registerMigrationCommand };
1343
+ export { toOutput, toIsoDate, tmWebUrl, initializeContext, initializeContextWithProject, resolveContextWithProject, resolveContext, ensureProjectKey, enumOption, projectKeyOption, projectIdOption, blankValueMessage, blankFilterGiven, IMPORT_CONTENT, IMPORT_CONTENT_CHOICES, toImportJobRequest, toChunkUploadRequest, toJobUpdateRequest, toMigrationJobOutput, toSchemaVersionRows, DEFAULT_IMPORT_TIMEOUT_MS, DEFAULT_MIGRATION_INTERVAL_MS, CHUNK_UPLOAD_ATTEMPTS, CHUNK_RETRY_BACKOFF_MS, CHUNK_SIZE_BYTES, MAX_PACKAGE_NAME_LENGTH, MAX_IMPORT_PACKAGE_BYTES, CHUNK_NOT_SENT_CODES, checkOutputTarget, resolveOutputPath, withRefreshingToken, describeContentDefaults, checkContentSelection, waitForMigrationJob, recheckJobHint, writeZipResponse, registerProjectExportCommand, registerMigrationCommand };
1330
1344
 
1331
- //# debugId=45341E7131C483BB64756E2164756E21
1345
+ //# debugId=DAF26A3FB3BBBE3A64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-we9qwvqr.js";
5
- import"./tool-w2tgc8pr.js";
4
+ } from "./tool-mj8vempn.js";
5
+ import"./tool-r36bqhrb.js";
6
6
  import"./tool-y8kmsg4w.js";
7
7
  import"./tool-b24ehgnz.js";
8
- import"./tool-begvxz7a.js";
8
+ import"./tool-kgbbngwg.js";
9
9
  import"./tool-bvkzq6jr.js";
10
10
  import"./tool-246df0cd.js";
11
11
  import"./tool-4xdq18pz.js";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@uipath/test-manager-tool",
3
3
  "author": "UiPath",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
- "version": "1.207.0-preview.307",
5
+ "version": "1.207.0-preview.308",
6
6
  "description": "Manage test cases, test sets, executions, and results.",
7
7
  "private": false,
8
8
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "files": [
28
28
  "dist"
29
29
  ],
30
- "gitHead": "a625ed8ac421089170db3cb8b95c497f3c7b0d62"
30
+ "gitHead": "19a9499acd8ec6a8df34a9f011b645126f098c50"
31
31
  }