@uipath/test-manager-tool 1.206.0-preview.303 → 1.206.0-preview.310

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
@@ -358,7 +358,7 @@ stays in the target project, so check or delete it before importing again.
358
358
 
359
359
  | Command | Description |
360
360
  |---------|-------------|
361
- | `uip tm run --type package` | Run every test in a package already uploaded to Orchestrator. `--package-version` takes an app version (`1.0`, runs its latest patch) or an exact version (refused if a newer patch of the same app version exists, since Test Manager always runs the latest). It waits for Test Manager to see the package, build a hidden test set, apply `--input-path` overrides, run it, re-run failed and cancelled tests (`--max-retries`), and write a JUnit or UiPath JSON report (`--format`, `--result-path`). Assertions are read only for tests that did not pass, unless `--include-passed-assertions` is set. One `--timeout` covers the whole command, retries included; waiting for Test Manager to index the package is also capped at 5 minutes. 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. A timeout or other error after the tests started still writes the report, with unfinished tests marked skipped. A run fails rather than pass when Test Manager counts more tests than it has results for (`MissingResults`), and tests whose assertions could not be read are listed in `AssertionsNotRead`. The login token is refreshed during long runs. Each run leaves its hidden test set in the project; nothing deletes it yet, as with uipcli. Needs `--project-key` or `--project-id`. Made for CI, as the replacement for `uipcli test run`. |
361
+ | `uip tm run --type package` | Run every test in a package already uploaded to Orchestrator. `--package-version` takes an app version (`1.0`, runs its latest patch) or an exact version (refused if a newer patch of the same app version exists, since Test Manager always runs the latest). It waits for Test Manager to see the package, build a hidden test set, apply `--input-path` overrides, run it, re-run failed and cancelled tests (`--max-retries`), and write a JUnit or UiPath JSON report (`--format`, `--result-path`). Assertions are read only for tests that did not pass, unless `--include-passed-assertions` is set. One `--timeout` covers the whole command, retries included; waiting for Test Manager to index the package is also capped at 5 minutes. 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. A timeout or other error after the tests started still writes the report, with unfinished tests marked skipped. A run fails rather than pass when Test Manager counts more tests than it has results for (`MissingResults`), and tests whose assertions could not be read are listed in `AssertionsNotRead`. The login token is refreshed during long runs. Each run leaves its hidden test set in the project; nothing deletes it yet, as with uipcli. Without `--project-key` or `--project-id` it runs in the tenant's default project (the one `uip tm project get-default` returns, created on first use) and `Data.ProjectKey` names it. Made for CI, as the replacement for `uipcli test run`. |
362
362
 
363
363
  ### `wait` — Wait for execution
364
364
 
@@ -383,6 +383,9 @@ uip tm testsets run --test-set-key DEMO:10 --wait
383
383
  # CI: run every test in an uploaded package, retry failures, write JUnit
384
384
  uip tm run --type package --project-key DEMO --package-name MyTests --package-version 1.0.3 --folder-path Shared --max-retries 2 --result-path ./results
385
385
 
386
+ # CI: the same, in the tenant's default project (no --project-key)
387
+ uip tm run --type package --package-name MyTests --package-version 1.0.3 --folder-path Shared --result-path ./results
388
+
386
389
  # Download execution results as JUnit XML
387
390
  uip tm result download --execution-id a1b2c3d4-0000-0000-0000-000000000001 --project-key DEMO --result-path ./junit.xml
388
391
 
package/dist/index.js CHANGED
@@ -5,11 +5,11 @@ import {
5
5
  import"./tool-6mpkbszw.js";
6
6
  import"./tool-1nkyed5m.js";
7
7
  import"./tool-vgc9gpy6.js";
8
- import"./tool-fz859vt8.js";
8
+ import"./tool-584bn9db.js";
9
9
  import {
10
10
  metadata2,
11
11
  registerCommands2
12
- } from "./tool-s7ja999v.js";
12
+ } from "./tool-f9ps96f6.js";
13
13
  import"./tool-967s3mts.js";
14
14
 
15
15
  // src/index.ts
@@ -40,7 +40,7 @@ import {
40
40
  checkContentSelection,
41
41
  waitForMigrationJob,
42
42
  recheckJobHint
43
- } from "./tool-fz859vt8.js";
43
+ } from "./tool-584bn9db.js";
44
44
 
45
45
  // ../../node_modules/fflate/esm/index.mjs
46
46
  import { createRequire } from "module";
@@ -668,6 +668,20 @@ async function resolveContextWithProject(options) {
668
668
  }
669
669
  return ctx;
670
670
  }
671
+ async function resolveContext(options) {
672
+ const [authError, ctx] = await catchError(initializeContext(options));
673
+ if (authError) {
674
+ OutputFormatter.error({
675
+ Result: RESULTS.Failure,
676
+ ErrorCode: "authentication_required",
677
+ Message: authError.message,
678
+ Instructions: instructionsFor("auth")
679
+ });
680
+ processContext.exit(1);
681
+ return null;
682
+ }
683
+ return ctx;
684
+ }
671
685
  async function ensureProjectKey(ctx) {
672
686
  if (ctx.projectKey !== undefined) {
673
687
  return ctx.projectKey;
@@ -1669,6 +1683,6 @@ var registerMigrationCommand = (program) => {
1669
1683
  return migrationCmd;
1670
1684
  };
1671
1685
 
1672
- export { stripEncodingMarkers, ROBOT_LOG_LEVELS, TERMINAL_STATUSES, msToDuration, calcPassRate, DEFAULT_TEST_CASE_VERSION, SCHEMA_FORBIDDEN_MESSAGE, PROJECT_CONFIG_IMPORT_FORBIDDEN_MESSAGE, TM_FORBIDDEN_MESSAGE, TM_LICENSED_USER_FORBIDDEN_MESSAGE, TM_TEST_CLOUD_FORBIDDEN_MESSAGE, TM_NOT_AVAILABLE_MESSAGE, TM_NOT_AVAILABLE_INSTRUCTIONS, TAGGED_UPLOAD_NOT_SUPPORTED_INSTRUCTIONS, parseCustomFieldObjectType, parseCustomFieldDataType, validateIdentity, findExactByNamePaged, splitKeys, resolvePaginationOptions, hasText, sameGuid, resolveWaitTiming, toOutput, toIsoDate, isPortalShellDocument, isFeatureDisabledError, extractErrorDetails, emitTmFailure, emitTmFailureDetails, refuseUnexpectedContentType, emitInvalidArgument, emitAttachmentNotFound, instructiveError, readInstructions, readClassification, tmWebUrl, initializeContext, initializeContextWithProject, resolveContextWithProject, ensureProjectKey, 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 };
1686
+ export { stripEncodingMarkers, ROBOT_LOG_LEVELS, TERMINAL_STATUSES, msToDuration, calcPassRate, DEFAULT_TEST_CASE_VERSION, SCHEMA_FORBIDDEN_MESSAGE, PROJECT_CONFIG_IMPORT_FORBIDDEN_MESSAGE, TM_FORBIDDEN_MESSAGE, TM_LICENSED_USER_FORBIDDEN_MESSAGE, TM_TEST_CLOUD_FORBIDDEN_MESSAGE, TM_NOT_AVAILABLE_MESSAGE, TM_NOT_AVAILABLE_INSTRUCTIONS, TAGGED_UPLOAD_NOT_SUPPORTED_INSTRUCTIONS, parseCustomFieldObjectType, parseCustomFieldDataType, validateIdentity, findExactByNamePaged, splitKeys, resolvePaginationOptions, hasText, sameGuid, resolveWaitTiming, toOutput, toIsoDate, isPortalShellDocument, isFeatureDisabledError, extractErrorDetails, emitTmFailure, emitTmFailureDetails, refuseUnexpectedContentType, emitInvalidArgument, emitAttachmentNotFound, instructiveError, readInstructions, readClassification, tmWebUrl, initializeContext, initializeContextWithProject, resolveContextWithProject, resolveContext, ensureProjectKey, 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 };
1673
1687
 
1674
- //# debugId=6868C82965129C4264756E2164756E21
1688
+ //# debugId=F1F724440CE8976B64756E2164756E21
@@ -141,6 +141,7 @@ import {
141
141
  initializeContext,
142
142
  initializeContextWithProject,
143
143
  resolveContextWithProject,
144
+ resolveContext,
144
145
  ensureProjectKey,
145
146
  projectKeyOption,
146
147
  projectIdOption,
@@ -158,7 +159,7 @@ import {
158
159
  writeZipResponse,
159
160
  registerProjectExportCommand,
160
161
  registerMigrationCommand
161
- } from "./tool-fz859vt8.js";
162
+ } from "./tool-584bn9db.js";
162
163
  import {
163
164
  FolderDtoFeedTypeEnum2,
164
165
  FoldersApi2,
@@ -9259,7 +9260,7 @@ var package_default = {
9259
9260
  name: "@uipath/test-manager-tool",
9260
9261
  author: "UiPath",
9261
9262
  license: "SEE LICENSE IN LICENSE.txt",
9262
- version: "1.206.0-preview.303",
9263
+ version: "1.206.0-preview.310",
9263
9264
  description: "Manage test cases, test sets, executions, and results.",
9264
9265
  private: false,
9265
9266
  repository: {
@@ -18545,6 +18546,39 @@ function toSettingsRow(s) {
18545
18546
  };
18546
18547
  }
18547
18548
 
18549
+ // src/utils/default-project.ts
18550
+ var USE_YOUR_OWN = "Or use a project of your own: `uip tm project list` shows the ones you can open.";
18551
+ var RUN_WITH_PROJECT_KEY = "Or re-run with --project-key <PROJECT_KEY>: `uip tm project list` shows the projects you can open.";
18552
+ async function explainGetDefaultError(error, otherwise) {
18553
+ const response = error.response;
18554
+ if (response?.status === 401 && await readErrorCode(response) === "noPermission") {
18555
+ 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");
18556
+ }
18557
+ if (response?.status === 403) {
18558
+ 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");
18559
+ }
18560
+ return error;
18561
+ }
18562
+ async function fetchDefaultProject(tmConfig, otherwise = USE_YOUR_OWN) {
18563
+ return new ProjectsApi2(tmConfig).projectsGetOrCreateDefaultProject().catch(async (error) => {
18564
+ throw await explainGetDefaultError(error, otherwise);
18565
+ });
18566
+ }
18567
+ async function getDefaultProject(tmConfig, otherwise = USE_YOUR_OWN) {
18568
+ const project = await fetchDefaultProject(tmConfig, otherwise);
18569
+ const projectKey = project.projectPrefix?.trim();
18570
+ if (!project.id || !projectKey) {
18571
+ throw instructiveError("Test Manager returned the default project without an id or key.", "Pass --project-key or --project-id instead.", "server_error");
18572
+ }
18573
+ return { projectId: project.id, projectKey, name: project.name ?? "" };
18574
+ }
18575
+ async function readErrorCode(response) {
18576
+ const body = await response.clone().json().catch(() => {
18577
+ return;
18578
+ });
18579
+ return body?.errorCode;
18580
+ }
18581
+
18548
18582
  // src/commands/migration-import.ts
18549
18583
  var IMPORT_EXAMPLES = [
18550
18584
  {
@@ -18589,7 +18623,7 @@ var IMPORT_EXAMPLES = [
18589
18623
  ];
18590
18624
  var registerProjectImportCommand = (parent) => {
18591
18625
  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>")).option("--log-level <level>", "Log verbosity: debug, info, warn, error", "Information").examples(IMPORT_EXAMPLES).trackedAction(processContext, async (options) => {
18592
- const { executeImport } = await import("./migration-import-run-as5rrfvn.js");
18626
+ const { executeImport } = await import("./migration-import-run-eazzhh0h.js");
18593
18627
  await executeImport(options);
18594
18628
  });
18595
18629
  };
@@ -18909,29 +18943,12 @@ async function reportProjectError(error, { prefix = "" } = {}) {
18909
18943
  details: readInstructions(error) ?? classified.details
18910
18944
  });
18911
18945
  }
18912
- var USE_YOUR_OWN = "Or use a project of your own: `uip tm project list` shows the ones you can open.";
18913
- async function explainGetDefaultError(error) {
18914
- const response = error.response;
18915
- if (response?.status === 401 && await readErrorCode(response) === "noPermission") {
18916
- 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");
18917
- }
18918
- if (response?.status === 403) {
18919
- 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");
18920
- }
18921
- return error;
18922
- }
18923
18946
  function explainSetDefaultError(error, projectKey) {
18924
18947
  if (error.response?.status !== 403) {
18925
18948
  return error;
18926
18949
  }
18927
18950
  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");
18928
18951
  }
18929
- async function readErrorCode(response) {
18930
- const body = await response.clone().json().catch(() => {
18931
- return;
18932
- });
18933
- return body?.errorCode;
18934
- }
18935
18952
  var SET_DEFAULT_DESCRIPTION = "Make this project the tenant's default. Who can open it does not change.";
18936
18953
  var registerProjectCommand = (program) => {
18937
18954
  const projectCmd = program.command("project").description("Manage Test Manager projects");
@@ -18973,19 +18990,12 @@ var registerProjectCommand = (program) => {
18973
18990
  OutputFormatter.success(new SuccessOutput("ProjectsList", projects.map(toListRow)));
18974
18991
  });
18975
18992
  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>")).option("--log-level <level>", "Log verbosity: debug, info, warn, error", "Information").examples(PROJECT_GET_DEFAULT_EXAMPLES).trackedAction(processContext, async (options) => {
18976
- const [authError, ctx] = await catchError(initializeContext(options));
18977
- if (authError) {
18978
- OutputFormatter.error({
18979
- Result: RESULTS.Failure,
18980
- Message: authError.message,
18981
- Instructions: instructionsFor("auth")
18982
- });
18983
- processContext.exit(1);
18993
+ const ctx = await resolveContext(options);
18994
+ if (!ctx)
18984
18995
  return;
18985
- }
18986
- const [error, project] = await catchError(new ProjectsApi2(ctx.tmConfig).projectsGetOrCreateDefaultProject());
18996
+ const [error, project] = await catchError(fetchDefaultProject(ctx.tmConfig));
18987
18997
  if (error) {
18988
- await reportProjectError(await explainGetDefaultError(error));
18998
+ await reportProjectError(error);
18989
18999
  return;
18990
19000
  }
18991
19001
  OutputFormatter.success(new SuccessOutput("ProjectGetDefault", toListRow(project)));
@@ -22556,7 +22566,8 @@ function toRunSummary(input) {
22556
22566
  ...input.ignoredInputs.length > 0 && {
22557
22567
  IgnoredInputs: input.ignoredInputs,
22558
22568
  DeclaredInputs: input.declaredInputs
22559
- }
22569
+ },
22570
+ ProjectKey: input.projectKey
22560
22571
  };
22561
22572
  }
22562
22573
  function ignoredInputsNote(data) {
@@ -23467,7 +23478,8 @@ var EXAMPLE_DATA = {
23467
23478
  Cancelled: 0,
23468
23479
  Retries: 0,
23469
23480
  Format: "junit",
23470
- OutputPath: "./results/junit.xml"
23481
+ OutputPath: "./results/junit.xml",
23482
+ ProjectKey: "DEMO"
23471
23483
  };
23472
23484
  var RUN_PACKAGE_EXAMPLES = [
23473
23485
  {
@@ -23475,6 +23487,18 @@ var RUN_PACKAGE_EXAMPLES = [
23475
23487
  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",
23476
23488
  Output: { Code: "RunPackage", Data: EXAMPLE_DATA }
23477
23489
  },
23490
+ {
23491
+ Description: "Run an uploaded package in the tenant's default project (no --project-key)",
23492
+ Command: "uip tm run --type package --package-name MyTests --package-version 1.0.3 --folder-path Shared --result-path ./results/junit.xml",
23493
+ Output: {
23494
+ Code: "RunPackage",
23495
+ Data: {
23496
+ ...EXAMPLE_DATA,
23497
+ ProjectKey: "TMDP",
23498
+ ExecutionUrl: "https://cloud.uipath.com/org/tenant/testmanager_/TMDP/testexecutions/a1b2c3d4-0000-0000-0000-000000000001"
23499
+ }
23500
+ }
23501
+ },
23478
23502
  {
23479
23503
  Description: "Run the latest 1.0.x patch, override inputs, retry failed tests twice, and write the UiPath JSON report",
23480
23504
  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",
@@ -23491,7 +23515,7 @@ var RUN_PACKAGE_EXAMPLES = [
23491
23515
  ];
23492
23516
  var RUN_TYPES = ["package"];
23493
23517
  var registerRunCommand = (program) => {
23494
- program.command("run").description("Run tests in Test Manager, wait for the results, and write a report. --type package runs every test in 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 package already uploaded to Orchestrator)`).choices(RUN_TYPES).makeOptionMandatory()).addOption(projectKeyOption()).addOption(projectIdOption()).requiredOption("--package-name <name>", "Package id as uploaded to Orchestrator (e.g. MyTests)").requiredOption("--package-version <version>", "App version (e.g. 1.0) to run its latest patch, or an exact version (e.g. 1.0.244878764) to wait for that upload. Test Manager always runs the latest patch, so an older exact version is refused.").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", {
23518
+ program.command("run").description("Run tests in Test Manager, wait for the results, and write a report. --type package runs every test in 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 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()).requiredOption("--package-name <name>", "Package id as uploaded to Orchestrator (e.g. MyTests)").requiredOption("--package-version <version>", "App version (e.g. 1.0) to run its latest patch, or an exact version (e.g. 1.0.244878764) to wait for that upload. Test Manager always runs the latest patch, so an older exact version is refused.").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", {
23495
23519
  min: 0,
23496
23520
  max: MAX_RETRIES
23497
23521
  }), 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", {
@@ -23510,14 +23534,14 @@ var registerRunCommand = (program) => {
23510
23534
  await reportFailure(inputError);
23511
23535
  return;
23512
23536
  }
23513
- const resolved = await resolveContextWithProject(options);
23537
+ const resolved = await resolveRunContext(options);
23514
23538
  if (!resolved)
23515
23539
  return;
23516
- const ctx = withRefreshingToken2(resolved, options.tenant);
23540
+ const ctx = withRefreshingToken2(resolved.ctx, options.tenant);
23517
23541
  const projectKey = await ensureProjectKey(ctx);
23518
23542
  if (projectKey === null)
23519
23543
  return;
23520
- const [error, data] = await catchError(runPackage(ctx, projectKey, options, limits, deadline, inputs));
23544
+ const [error, data] = await catchError(runPackage(ctx, projectKey, resolved.folder, options, limits, deadline, inputs));
23521
23545
  if (error) {
23522
23546
  await reportFailure(error);
23523
23547
  return;
@@ -23525,6 +23549,43 @@ var registerRunCommand = (program) => {
23525
23549
  reportOutcome(data);
23526
23550
  });
23527
23551
  };
23552
+ async function resolveRunContext(options) {
23553
+ if (options.projectKey !== undefined || options.projectId !== undefined) {
23554
+ const ctx = await resolveContextWithProject(options);
23555
+ if (!ctx)
23556
+ return null;
23557
+ const folder = await readFolder(options);
23558
+ return folder ? { ctx, folder } : null;
23559
+ }
23560
+ const base = await resolveContext(options);
23561
+ if (!base)
23562
+ return null;
23563
+ const folder = await readFolder(options);
23564
+ if (!folder)
23565
+ return null;
23566
+ const [error, project] = await catchError(getDefaultProject(base.tmConfig, RUN_WITH_PROJECT_KEY));
23567
+ if (error) {
23568
+ await reportFailure(error);
23569
+ return null;
23570
+ }
23571
+ logger.info(`No project given; running in the tenant's default project '${project.projectKey}'.`);
23572
+ return {
23573
+ ctx: {
23574
+ ...base,
23575
+ projectId: project.projectId,
23576
+ projectKey: project.projectKey
23577
+ },
23578
+ folder
23579
+ };
23580
+ }
23581
+ async function readFolder(options) {
23582
+ const [error, folder] = await catchError(resolveRunFolder(options, options.tenant));
23583
+ if (error) {
23584
+ await reportFailure(error);
23585
+ return null;
23586
+ }
23587
+ return folder;
23588
+ }
23528
23589
  function parseLimits(options) {
23529
23590
  const fail = (message, instructions) => {
23530
23591
  OutputFormatter.error({
@@ -23536,9 +23597,6 @@ function parseLimits(options) {
23536
23597
  processContext.exit(EXIT_CODES.ValidationError);
23537
23598
  return null;
23538
23599
  };
23539
- if (options.projectKey === undefined && options.projectId === undefined) {
23540
- return fail("No project was given.", "Pass --project-key (e.g. DEMO) or --project-id.");
23541
- }
23542
23600
  const hasPath = options.folderPath !== undefined;
23543
23601
  const hasKey = options.folderKey !== undefined;
23544
23602
  if (hasPath === hasKey) {
@@ -23549,10 +23607,9 @@ function parseLimits(options) {
23549
23607
  }
23550
23608
  return toRunLimits(options);
23551
23609
  }
23552
- async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
23610
+ async function runPackage(ctx, projectKey, folder, options, limits, deadline, inputs) {
23553
23611
  const { tmConfig, projectId } = ctx;
23554
23612
  const api = new TransientTestSetsApi2(tmConfig);
23555
- const folder = await resolveRunFolder(options, options.tenant);
23556
23613
  const pkg = {
23557
23614
  packageName: options.packageName,
23558
23615
  packageVersion: await resolvePackageVersion(options.packageName, options.packageVersion, folder, options.tenant)
@@ -23587,6 +23644,10 @@ async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
23587
23644
  if (runError) {
23588
23645
  const started = startedRunOf(runError);
23589
23646
  if (started) {
23647
+ locateRun(runError, {
23648
+ projectKey,
23649
+ executionUrl: `${tmWebUrl}/${projectKey}/testexecutions/${started.executionId}`
23650
+ });
23590
23651
  await writePartialReport(ctx, projectKey, started, reportOptions);
23591
23652
  if (runError instanceof RunPackageTimeoutError) {
23592
23653
  runError.reportPath = started.reportPath;
@@ -23597,8 +23658,12 @@ async function runPackage(ctx, projectKey, options, limits, deadline, inputs) {
23597
23658
  const executionUrl = `${tmWebUrl}/${projectKey}/testexecutions/${outcome.executionId}`;
23598
23659
  const [reportError, report] = await catchError(writeCompleteReport(ctx, projectKey, outcome.executionId, reportOptions, limits.intervalMs));
23599
23660
  if (reportError)
23600
- throw reportFailedAfterRun(reportError, outcome, executionUrl);
23661
+ throw locateRun(tagStartedRun(reportFailedAfterRun(reportError, outcome, executionUrl), {
23662
+ executionId: outcome.executionId,
23663
+ retries: outcome.retries
23664
+ }), { projectKey, executionUrl });
23601
23665
  return toRunSummary({
23666
+ projectKey,
23602
23667
  executionId: outcome.executionId,
23603
23668
  executionUrl,
23604
23669
  packageName: pkg.packageName,
@@ -23686,6 +23751,17 @@ function reportFailedAfterRun(error, outcome, executionUrl) {
23686
23751
  });
23687
23752
  return wrapped;
23688
23753
  }
23754
+ var RUN_LOCATION = Symbol("runLocation");
23755
+ function locateRun(error, location) {
23756
+ return Object.assign(error, { [RUN_LOCATION]: location });
23757
+ }
23758
+ function locationData(error) {
23759
+ const location = error[RUN_LOCATION];
23760
+ return location ? {
23761
+ ProjectKey: location.projectKey,
23762
+ ExecutionUrl: location.executionUrl
23763
+ } : {};
23764
+ }
23689
23765
  async function reportFailure(error) {
23690
23766
  if (error instanceof RunPackageTimeoutError) {
23691
23767
  const partial = error.reportPath !== undefined ? ` A report of the tests that finished is at ${error.reportPath}.` : "";
@@ -23701,7 +23777,8 @@ async function reportFailure(error) {
23701
23777
  Retries: error.retries ?? 0,
23702
23778
  ...error.reportPath !== undefined && {
23703
23779
  OutputPath: error.reportPath
23704
- }
23780
+ },
23781
+ ...locationData(error)
23705
23782
  }
23706
23783
  }
23707
23784
  });
@@ -23728,7 +23805,8 @@ async function reportFailure(error) {
23728
23805
  Retries: started.retries,
23729
23806
  ...started.reportPath !== undefined && {
23730
23807
  OutputPath: started.reportPath
23731
- }
23808
+ },
23809
+ ...locationData(error)
23732
23810
  }
23733
23811
  }
23734
23812
  });
@@ -32679,4 +32757,4 @@ var registerCommands2 = async (program) => {
32679
32757
 
32680
32758
  export { metadata2, registerCommands2 };
32681
32759
 
32682
- //# debugId=586F02F0A1C160DC64756E2164756E21
32760
+ //# debugId=FFFFB230CAC6782A64756E2164756E21
package/dist/tool.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  metadata2,
3
3
  registerCommands2
4
- } from "./tool-s7ja999v.js";
5
- import"./tool-fz859vt8.js";
4
+ } from "./tool-f9ps96f6.js";
5
+ import"./tool-584bn9db.js";
6
6
  import"./tool-vgc9gpy6.js";
7
7
  import"./tool-967s3mts.js";
8
8
  import"./tool-0650qfw3.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.206.0-preview.303",
5
+ "version": "1.206.0-preview.310",
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": "7d17b8a3c1a50892d42c9302087abc8307b04409"
30
+ "gitHead": "493ebd2c2baccd31ad19b739e42605d7c89f720d"
31
31
  }