@allurereport/plugin-testops 3.17.0 → 3.19.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/dist/model.d.ts CHANGED
@@ -142,7 +142,8 @@ export type UploadTestFixtureResultDto = {
142
142
  export type UploadFixturesResultsDto = {
143
143
  fixtures?: UploadTestFixtureResultDto[];
144
144
  };
145
- export type TestResultWithCategories = Pick<TestResult, "status" | "labels" | "error" | "flaky" | "duration" | "transition" | "environment"> & {
145
+ export type TestResultWithCategories = Pick<TestResult, "status" | "labels" | "error" | "flaky" | "duration" | "transition" | "environment"> & Partial<Pick<TestResult, "id" | "name" | "testCase" | "fullName" | "parameters" | "sourceMetadata">> & {
146
+ historyId?: string;
146
147
  categories?: {
147
148
  id?: string;
148
149
  name: string;
@@ -1,4 +1,5 @@
1
1
  import { EMPTY_VALUE, extractErrorMatchingData, findLastByLabelName, matchCategory } from "@allurereport/core-api";
2
+ import { calculateLegacyHistoryId } from "./legacyHistory.js";
2
3
  const formatGroupName = (key, value) => `${key}: ${value === EMPTY_VALUE ? `No ${key}` : value}`;
3
4
  const groupValue = (selector, tr) => {
4
5
  const labels = tr.labels ?? [];
@@ -45,7 +46,7 @@ const buildGrouping = (tr, category) => {
45
46
  });
46
47
  }
47
48
  if (category.groupEnvironments) {
48
- const historyValue = tr.historyId ?? tr.id ?? EMPTY_VALUE;
49
+ const historyValue = calculateLegacyHistoryId(tr) ?? tr.id ?? EMPTY_VALUE;
49
50
  const historyName = tr.name?.trim() ? tr.name : historyValue;
50
51
  grouping.push({
51
52
  key: "historyId",
@@ -0,0 +1,14 @@
1
+ import type { TestParameter } from "@allurereport/core-api";
2
+ export type LegacyHistoryIdInput = {
3
+ historyId?: string;
4
+ testCase?: {
5
+ allureId?: string;
6
+ externalId?: string;
7
+ };
8
+ fullName?: string;
9
+ parameters?: readonly TestParameter[];
10
+ sourceMetadata?: {
11
+ legacyTestCaseHash?: string;
12
+ };
13
+ };
14
+ export declare const calculateLegacyHistoryId: ({ historyId, testCase, fullName, parameters, sourceMetadata, }: LegacyHistoryIdInput) => string | undefined;
@@ -0,0 +1,25 @@
1
+ import { md5 } from "@allurereport/plugin-api";
2
+ const compareLegacyParameters = (first, second) => first.name.localeCompare(second.name) || first.value.localeCompare(second.value);
3
+ export const calculateLegacyHistoryId = ({ historyId, testCase, fullName, parameters = [], sourceMetadata, }) => {
4
+ if (historyId) {
5
+ return historyId;
6
+ }
7
+ const allureId = testCase?.allureId;
8
+ const legacyTestCaseHash = sourceMetadata?.legacyTestCaseHash ??
9
+ (allureId && allureId !== "-1"
10
+ ? md5(`ALLURE_ID=${allureId}`)
11
+ : testCase?.externalId
12
+ ? md5(testCase.externalId)
13
+ : fullName
14
+ ? md5(fullName)
15
+ : undefined);
16
+ if (!legacyTestCaseHash) {
17
+ return undefined;
18
+ }
19
+ const serializedParameters = [...parameters]
20
+ .filter(({ excluded }) => !excluded)
21
+ .sort(compareLegacyParameters)
22
+ .map(({ name, value }) => `${name}:${value}`)
23
+ .join(",");
24
+ return `${legacyTestCaseHash}.${md5(serializedParameters)}`;
25
+ };
@@ -1,4 +1,5 @@
1
1
  import { toUploadAttachmentDto } from "./attachments.js";
2
+ import { calculateLegacyHistoryId } from "./legacyHistory.js";
2
3
  import { validateExecutableName } from "./validation.js";
3
4
  export const normalizeTestStepsResults = (steps) => {
4
5
  if (!steps) {
@@ -71,7 +72,7 @@ export const toUploadTestResultDto = (tr) => {
71
72
  const category = normalizeCategory(tr.category);
72
73
  return {
73
74
  uuid: tr.id,
74
- historyId: tr.historyId,
75
+ historyId: calculateLegacyHistoryId(tr),
75
76
  testCaseId: tr.testCase?.externalId,
76
77
  name: tr.name,
77
78
  fullName: tr.fullName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-testops",
3
- "version": "3.17.0",
3
+ "version": "3.19.0",
4
4
  "description": "Allure Plugin TestOps",
5
5
  "keywords": [
6
6
  "allure",
@@ -32,14 +32,14 @@
32
32
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
33
33
  },
34
34
  "dependencies": {
35
- "@allurereport/ci": "3.17.0",
36
- "@allurereport/cli-commons": "3.17.0",
37
- "@allurereport/core-api": "3.17.0",
38
- "@allurereport/git": "3.17.0",
39
- "@allurereport/plugin-api": "3.17.0",
40
- "@allurereport/reader-api": "3.17.0",
41
- "@allurereport/service": "3.17.0",
42
- "axios": "^1.18.1",
35
+ "@allurereport/ci": "3.19.0",
36
+ "@allurereport/cli-commons": "3.19.0",
37
+ "@allurereport/core-api": "3.19.0",
38
+ "@allurereport/git": "3.19.0",
39
+ "@allurereport/plugin-api": "3.19.0",
40
+ "@allurereport/reader-api": "3.19.0",
41
+ "@allurereport/service": "3.19.0",
42
+ "axios": "^1.20.0",
43
43
  "form-data": "^4.0.6",
44
44
  "lodash-es": "^4.18.1",
45
45
  "p-limit": "^7.3.0",