transit-core-taf 1.0.8 → 1.0.10

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.
@@ -17,5 +17,6 @@ declare class TestRailReporter implements Reporter {
17
17
  constructor(options?: TestRailReporterOptions);
18
18
  onBegin(config: FullConfig, suite: Suite): Promise<void>;
19
19
  onTestEnd(test: TestCase, result: TestResult): Promise<void>;
20
+ private getCaseId;
20
21
  }
21
22
  export default TestRailReporter;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const client_1 = require("@/utils/testrail/client");
3
+ const client_1 = require("../utils/testrail/client");
4
4
  class TestRailReporter {
5
5
  client = null;
6
6
  runId = null;
@@ -57,10 +57,8 @@ class TestRailReporter {
57
57
  async onTestEnd(test, result) {
58
58
  if (!this.enabled || !this.client || !this.runId)
59
59
  return;
60
- const caseIdRegex = /C(\d+)/;
61
- const match = test.title.match(caseIdRegex);
62
- if (match) {
63
- const caseId = parseInt(match[1], 10);
60
+ const caseId = this.getCaseId(test);
61
+ if (caseId) {
64
62
  const comment = result.status === 'failed' || result.status === 'timedOut'
65
63
  ? `Test failed with error: ${result.error?.message}`
66
64
  : `Test completed with status: ${result.status}`;
@@ -73,5 +71,21 @@ class TestRailReporter {
73
71
  }
74
72
  }
75
73
  }
74
+ getCaseId(test) {
75
+ const caseIdRegex = /C(\d+)/;
76
+ // Check tags first
77
+ for (const tag of test.tags) {
78
+ const match = tag.match(caseIdRegex);
79
+ if (match) {
80
+ return parseInt(match[1], 10);
81
+ }
82
+ }
83
+ // Fallback to title
84
+ const titleMatch = test.title.match(caseIdRegex);
85
+ if (titleMatch) {
86
+ return parseInt(titleMatch[1], 10);
87
+ }
88
+ return null;
89
+ }
76
90
  }
77
91
  exports.default = TestRailReporter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transit-core-taf",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Transit Core Automation Framework",
5
5
  "main": "dist/transit-core-taf/index.js",
6
6
  "types": "dist/transit-core-taf/index.d.ts",