@testcollab/cli 1.7.0 → 1.8.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testcollab/cli",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Command-line interface for TestCollab operations",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -775,6 +775,18 @@ class TcApiClient {
775
775
  return false;
776
776
  }
777
777
  }
778
+
779
+ async bulkSkipTestCases(data) {
780
+ try {
781
+ const result = await this.request('/testplantestcases/bulkAction', {
782
+ method: 'POST',
783
+ body: data
784
+ });
785
+ return result;
786
+ } catch {
787
+ return null;
788
+ }
789
+ }
778
790
  }
779
791
 
780
792
  function findMatchingExecutedCase(casesAssigned, runRecord, hasConfig, configId) {
@@ -967,37 +979,50 @@ async function uploadUsingReporterFlow({
967
979
 
968
980
  if (missingCases.length) {
969
981
  console.log(`\n⏭️ --skip-missing: marking ${missingCases.length} unmatched test case(s) as skipped...`);
970
- }
971
982
 
972
- for (const execCase of missingCases) {
973
- try {
974
- const skipPayload = {
975
- id: execCase.id,
976
- test_plan_test_case: execCase.test_plan_test_case?.id || execCase.test_plan_test_case,
983
+ // Group missing cases by config ID — the bulkAction endpoint requires
984
+ // test_plan_config when configs exist, so we need one call per config
985
+ const missingByConfig = {};
986
+ for (const c of missingCases) {
987
+ const tptc = c.test_plan_test_case;
988
+ const testCaseId = tptc && typeof tptc === 'object' ? tptc.test_case : null;
989
+ if (testCaseId === null || testCaseId === undefined) {
990
+ continue;
991
+ }
992
+ const configId = c.test_plan_config && typeof c.test_plan_config === 'object'
993
+ ? String(c.test_plan_config.id)
994
+ : c.test_plan_config ? String(c.test_plan_config) : '0';
995
+ if (!missingByConfig[configId]) {
996
+ missingByConfig[configId] = [];
997
+ }
998
+ missingByConfig[configId].push(testCaseId);
999
+ }
1000
+
1001
+ for (const [configId, testCaseIds] of Object.entries(missingByConfig)) {
1002
+ if (!testCaseIds.length) {
1003
+ continue;
1004
+ }
1005
+
1006
+ const bulkPayload = {
1007
+ actionType: 'skip',
1008
+ testcases: testCaseIds,
977
1009
  project: projectId,
978
- status: RUN_RESULT_MAP.skip,
979
- test_plan: testPlanId
1010
+ testplan: testPlanId
980
1011
  };
981
1012
 
982
- if (execCase.test_plan_config && execCase.test_plan_config.id) {
983
- skipPayload.test_plan_config = execCase.test_plan_config.id;
1013
+ if (configId && configId !== '0') {
1014
+ bulkPayload.test_plan_config = Number(configId);
984
1015
  }
985
1016
 
986
- if (Array.isArray(execCase?.test_case_revision?.steps) && execCase.test_case_revision.steps.length) {
987
- skipPayload.step_wise_result = execCase.test_case_revision.steps.map((step) => ({
988
- ...step,
989
- status: RUN_RESULT_MAP.skip
990
- }));
991
- }
1017
+ const bulkResult = await tcApiInstance.bulkSkipTestCases(bulkPayload);
992
1018
 
993
- const updateResult = await tcApiInstance.updateCaseRunResult(execCase.id, skipPayload);
994
- if (updateResult && updateResult.id) {
995
- skippedMissing += 1;
1019
+ if (bulkResult && bulkResult.status === true) {
1020
+ skippedMissing += bulkResult.affected || testCaseIds.length;
996
1021
  } else {
997
- errors += 1;
1022
+ const errMsg = (bulkResult && bulkResult.message) || 'Unknown error';
1023
+ console.warn(`⚠️ Bulk skip failed for config ${configId}: ${errMsg}`);
1024
+ errors += testCaseIds.length;
998
1025
  }
999
- } catch {
1000
- errors += 1;
1001
1026
  }
1002
1027
  }
1003
1028
  }