@allurereport/web-awesome 3.0.0-beta.16 → 3.0.0-beta.17

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.
Files changed (66) hide show
  1. package/dist/multi/{173.app-1e7b32b35927de455ae2.js → 173.app-3f57abaa5734556b2988.js} +1 -1
  2. package/dist/multi/{174.app-1e7b32b35927de455ae2.js → 174.app-3f57abaa5734556b2988.js} +1 -1
  3. package/dist/multi/{252.app-1e7b32b35927de455ae2.js → 252.app-3f57abaa5734556b2988.js} +1 -1
  4. package/dist/multi/{282.app-1e7b32b35927de455ae2.js → 282.app-3f57abaa5734556b2988.js} +1 -1
  5. package/dist/multi/{29.app-1e7b32b35927de455ae2.js → 29.app-3f57abaa5734556b2988.js} +1 -1
  6. package/dist/multi/{416.app-1e7b32b35927de455ae2.js → 416.app-3f57abaa5734556b2988.js} +1 -1
  7. package/dist/multi/{527.app-1e7b32b35927de455ae2.js → 527.app-3f57abaa5734556b2988.js} +1 -1
  8. package/dist/multi/{600.app-1e7b32b35927de455ae2.js → 600.app-3f57abaa5734556b2988.js} +1 -1
  9. package/dist/multi/{605.app-1e7b32b35927de455ae2.js → 605.app-3f57abaa5734556b2988.js} +1 -1
  10. package/dist/multi/{638.app-1e7b32b35927de455ae2.js → 638.app-3f57abaa5734556b2988.js} +1 -1
  11. package/dist/multi/{672.app-1e7b32b35927de455ae2.js → 672.app-3f57abaa5734556b2988.js} +1 -1
  12. package/dist/multi/{686.app-1e7b32b35927de455ae2.js → 686.app-3f57abaa5734556b2988.js} +1 -1
  13. package/dist/multi/{725.app-1e7b32b35927de455ae2.js → 725.app-3f57abaa5734556b2988.js} +1 -1
  14. package/dist/multi/{741.app-1e7b32b35927de455ae2.js → 741.app-3f57abaa5734556b2988.js} +1 -1
  15. package/dist/multi/{755.app-1e7b32b35927de455ae2.js → 755.app-3f57abaa5734556b2988.js} +1 -1
  16. package/dist/multi/{894.app-1e7b32b35927de455ae2.js → 894.app-3f57abaa5734556b2988.js} +1 -1
  17. package/dist/multi/{943.app-1e7b32b35927de455ae2.js → 943.app-3f57abaa5734556b2988.js} +1 -1
  18. package/dist/multi/{980.app-1e7b32b35927de455ae2.js → 980.app-3f57abaa5734556b2988.js} +1 -1
  19. package/dist/multi/app-3f57abaa5734556b2988.js +2 -0
  20. package/dist/multi/app-3f57abaa5734556b2988.js.LICENSE.txt +16 -0
  21. package/dist/multi/manifest.json +20 -20
  22. package/dist/multi/styles-9475296a2cbcd0e5d2d0.css +44 -0
  23. package/dist/single/app-800f7e75bb52ecb2ae21.js +2 -0
  24. package/dist/single/app-800f7e75bb52ecb2ae21.js.LICENSE.txt +16 -0
  25. package/dist/single/manifest.json +1 -1
  26. package/package.json +16 -10
  27. package/src/components/Header/CiInfo/index.tsx +51 -0
  28. package/src/components/Header/CiInfo/styles.scss +7 -0
  29. package/src/components/Header/index.tsx +6 -1
  30. package/src/components/ReportBody/Filters.tsx +1 -1
  31. package/src/components/TestResult/TrRetriesView/TrRetriesItem.tsx +24 -6
  32. package/src/components/TestResult/TrRetriesView/index.tsx +8 -1
  33. package/src/components/Tree/index.tsx +1 -3
  34. package/src/index.html +14 -1
  35. package/src/locales/az.json +1 -6
  36. package/src/locales/de.json +1 -6
  37. package/src/locales/en.json +1 -6
  38. package/src/locales/es.json +1 -6
  39. package/src/locales/fr.json +1 -6
  40. package/src/locales/he.json +1 -6
  41. package/src/locales/hy.json +1 -6
  42. package/src/locales/it.json +1 -6
  43. package/src/locales/ja.json +1 -6
  44. package/src/locales/ka.json +1 -6
  45. package/src/locales/kr.json +1 -6
  46. package/src/locales/nl.json +1 -6
  47. package/src/locales/pl.json +1 -6
  48. package/src/locales/pt.json +1 -6
  49. package/src/locales/ru.json +1 -6
  50. package/src/locales/sv.json +1 -6
  51. package/src/locales/tr.json +1 -6
  52. package/src/locales/zh.json +1 -6
  53. package/src/stores/locale.ts +0 -1
  54. package/src/utils/tree.ts +0 -2
  55. package/test/components/Header/CiInfo.test.tsx +151 -0
  56. package/test/components/Header.test.tsx +127 -0
  57. package/tsconfig.json +6 -1
  58. package/tsconfig.node.json +8 -0
  59. package/types.d.ts +2 -1
  60. package/vitest.config.ts +15 -2
  61. package/vitest.setup.ts +1 -0
  62. package/dist/multi/app-1e7b32b35927de455ae2.js +0 -2
  63. package/dist/multi/app-1e7b32b35927de455ae2.js.LICENSE.txt +0 -23
  64. package/dist/multi/styles-99f5e45d3e35c8c13cd6.css +0 -43
  65. package/dist/single/app-b4be944c6ebe4a83f366.js +0 -2
  66. package/dist/single/app-b4be944c6ebe4a83f366.js.LICENSE.txt +0 -23
@@ -116,6 +116,7 @@
116
116
  "showLess": "Visa mindre",
117
117
  "showMore": "Visa mer",
118
118
  "copy": "Kopiera",
119
+ "attempt": "Försök {{attempt}} av {{total}}",
119
120
  "at": "vid",
120
121
  "variables": "Variabler",
121
122
  "openPwTrace": "Öppna Playwright Trace"
@@ -167,12 +168,6 @@
167
168
  "title": "Testframgångsfrekvens"
168
169
  }
169
170
  },
170
- "transitions": {
171
- "new": "Ny",
172
- "fixed": "Åtgärdad",
173
- "regressed": "Regresserad",
174
- "malfunctioned": "Felaktig"
175
- },
176
171
  "transitions.description": {
177
172
  "new": "Första förekomsten av detta testresultat i rapporten",
178
173
  "fixed": "Tidigare \"misslyckad\" eller \"trasig\" test som nu är \"godkänd\"",
@@ -116,6 +116,7 @@
116
116
  "showLess": "Daha az göster",
117
117
  "showMore": "Daha fazla göster",
118
118
  "copy": "Kopyala",
119
+ "attempt": "Deneme {{attempt}} / {{total}}",
119
120
  "at": "tarihinde",
120
121
  "variables": "Değişkenler",
121
122
  "openPwTrace": "Playwright Trace'i aç"
@@ -167,12 +168,6 @@
167
168
  "title": "Test Başarı Oranı"
168
169
  }
169
170
  },
170
- "transitions": {
171
- "new": "Yeni",
172
- "fixed": "Düzeltildi",
173
- "regressed": "Geri Döndü",
174
- "malfunctioned": "Bozuk"
175
- },
176
171
  "transitions.description": {
177
172
  "new": "Bu test sonucunun rapordaki ilk görünümü",
178
173
  "fixed": "Daha önce \"başarısız\" veya \"bozuk\" olan test artık \"başarılı\"",
@@ -116,6 +116,7 @@
116
116
  "showLess": "显示更少",
117
117
  "showMore": "显示更多",
118
118
  "copy": "复制",
119
+ "attempt": "第 {{attempt}} 次尝试,共 {{total}} 次",
119
120
  "at": "在",
120
121
  "variables": "变量",
121
122
  "openPwTrace": "打开 Playwright Trace"
@@ -167,12 +168,6 @@
167
168
  "title": "测试成功率"
168
169
  }
169
170
  },
170
- "transitions": {
171
- "new": "新的",
172
- "fixed": "已修复",
173
- "regressed": "已回归",
174
- "malfunctioned": "已损坏"
175
- },
176
171
  "transitions.description": {
177
172
  "new": "此测试结果在报告中的首次出现",
178
173
  "fixed": "之前\"失败\"或\"损坏\"的测试现在\"通过\"了",
@@ -25,7 +25,6 @@ const namespaces = [
25
25
  "environments",
26
26
  "charts",
27
27
  "sections",
28
- "transitions",
29
28
  "transitions.description",
30
29
  ];
31
30
 
package/src/utils/tree.ts CHANGED
@@ -4,7 +4,6 @@ import type { AwesomeTreeLeaf } from "types";
4
4
  type Localizer = (data: string) => string;
5
5
 
6
6
  type Localizers = {
7
- value: Localizer;
8
7
  tooltip: Localizer;
9
8
  };
10
9
 
@@ -12,7 +11,6 @@ export const createLeafLocalizer =
12
11
  (t: Localizers) =>
13
12
  (leaf: AwesomeTreeLeaf): AwesomeTreeLeaf => ({
14
13
  ...leaf,
15
- transitionText: t.value(leaf.transition),
16
14
  transitionTooltip: t.tooltip(leaf.transition),
17
15
  });
18
16
 
@@ -0,0 +1,151 @@
1
+ import { CiDescriptor, CiType } from "@allurereport/core-api";
2
+ import { cleanup, render, screen } from "@testing-library/preact";
3
+ import { h } from "preact";
4
+ import { beforeEach, describe, expect, it, vi } from "vitest";
5
+ import { CiInfo } from "@/components/Header/CiInfo";
6
+
7
+ const fixtures = {
8
+ pullRequestUrl: "https://github.com/repo/pull/123",
9
+ jobUrl: "https://github.com/repo/actions/runs/123",
10
+ jobRunUrl: "https://github.com/repo/actions/runs/123/jobs/456",
11
+ pullRequestName: "PR #123",
12
+ jobName: "Build Job",
13
+ jobRunName: "Run #456",
14
+ };
15
+
16
+ vi.mock("@allurereport/web-components", async () => {
17
+ const { CiType } = await import("@allurereport/core-api");
18
+
19
+ return {
20
+ Text: (props: { children: string }) => <span>{props.children}</span>,
21
+ SvgIcon: (props: { id: string; size?: string }) => <span data-testid="icon">{props.id}</span>,
22
+ allureIcons: {
23
+ amazon: "amazon",
24
+ azure: "azure",
25
+ bitbucket: "bitbucket",
26
+ circleci: "circle",
27
+ drone: "drone",
28
+ github: "github",
29
+ gitlab: "gitlab",
30
+ jenkins: "jenkins",
31
+ },
32
+ };
33
+ });
34
+
35
+ beforeEach(() => {
36
+ cleanup();
37
+ });
38
+
39
+ describe("components > Header > CiInfo", () => {
40
+ it("should render well-known CI icon", () => {
41
+ const ciTypes: CiType[] = [
42
+ CiType.Amazon,
43
+ CiType.Azure,
44
+ CiType.Bitbucket,
45
+ CiType.Circle,
46
+ CiType.Drone,
47
+ CiType.Github,
48
+ CiType.Gitlab,
49
+ CiType.Jenkins,
50
+ ];
51
+
52
+ for (const type of ciTypes) {
53
+ const ci = {
54
+ pullRequestUrl: fixtures.pullRequestUrl,
55
+ type,
56
+ } as CiDescriptor;
57
+
58
+ cleanup();
59
+ render(<CiInfo ci={ci} />);
60
+
61
+ expect(screen.getByTestId("icon")).toHaveTextContent(type);
62
+ }
63
+ });
64
+
65
+ it("shouldn't render icon for unknown CI", () => {
66
+ const ci = {
67
+ type: undefined,
68
+ } as CiDescriptor;
69
+
70
+ render(<CiInfo ci={ci} />);
71
+
72
+ expect(screen.queryByTestId("icon")).not.toBeInTheDocument();
73
+ });
74
+
75
+ it("should render there is no link to use", () => {
76
+ const ci = {} as CiDescriptor;
77
+
78
+ render(<CiInfo ci={ci} />);
79
+
80
+ expect(screen.queryByRole("link")).not.toBeInTheDocument();
81
+ });
82
+
83
+ it("should presence pull request url as href when provided", () => {
84
+ const ci = {
85
+ pullRequestUrl: fixtures.pullRequestUrl,
86
+ jobUrl: fixtures.jobUrl,
87
+ jobRunUrl: fixtures.jobRunUrl,
88
+ } as CiDescriptor;
89
+
90
+ render(<CiInfo ci={ci} />);
91
+
92
+ expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.pullRequestUrl);
93
+ });
94
+
95
+ it("should presence use job url as href when provided", () => {
96
+ const ci = {
97
+ jobUrl: fixtures.jobUrl,
98
+ jobRunUrl: fixtures.jobRunUrl,
99
+ } as CiDescriptor;
100
+
101
+ render(<CiInfo ci={ci} />);
102
+
103
+ expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.jobUrl);
104
+ });
105
+
106
+ it("should use job run url as href when provided", () => {
107
+ const ci = {
108
+ jobRunUrl: fixtures.jobRunUrl,
109
+ } as CiDescriptor;
110
+
111
+ render(<CiInfo ci={ci} />);
112
+
113
+ expect(screen.getByRole("link")).toHaveAttribute("href", fixtures.jobRunUrl);
114
+ });
115
+
116
+ it("should presence pull request name as text when provided", () => {
117
+ const ci = {
118
+ pullRequestUrl: fixtures.pullRequestUrl,
119
+ pullRequestName: fixtures.pullRequestName,
120
+ jobName: fixtures.jobName,
121
+ jobRunName: fixtures.jobRunName,
122
+ } as CiDescriptor;
123
+
124
+ render(<CiInfo ci={ci} />);
125
+
126
+ expect(screen.getByRole("link")).toHaveTextContent(fixtures.pullRequestName);
127
+ });
128
+
129
+ it("should presence job name as text when provided", () => {
130
+ const ci = {
131
+ jobUrl: fixtures.jobUrl,
132
+ jobName: fixtures.jobName,
133
+ jobRunName: fixtures.jobRunName,
134
+ } as CiDescriptor;
135
+
136
+ render(<CiInfo ci={ci} />);
137
+
138
+ expect(screen.getByRole("link")).toHaveTextContent(fixtures.jobName);
139
+ });
140
+
141
+ it("should presence job run name as text when provided", () => {
142
+ const ci = {
143
+ jobRunUrl: fixtures.jobRunUrl,
144
+ jobRunName: fixtures.jobRunName,
145
+ } as CiDescriptor;
146
+
147
+ render(<CiInfo ci={ci} />);
148
+
149
+ expect(screen.getByRole("link")).toHaveTextContent(fixtures.jobRunName);
150
+ });
151
+ });
@@ -0,0 +1,127 @@
1
+ import { getReportOptions } from "@allurereport/web-commons";
2
+ import { cleanup, render, screen } from "@testing-library/preact";
3
+ import { Mock, beforeEach, describe, expect, it, vi } from "vitest";
4
+ import { Header } from "@/components/Header";
5
+ import { CiInfo } from "@/components/Header/CiInfo";
6
+ import { route } from "@/stores/router";
7
+ import { availableSections } from "@/stores/sections";
8
+
9
+ const fixtures = {
10
+ ci: {
11
+ type: "github",
12
+ },
13
+ };
14
+
15
+ vi.mock("@allurereport/web-commons", () => ({
16
+ getReportOptions: vi.fn().mockReturnValue({}),
17
+ }));
18
+ vi.mock("@/stores/router", async () => {
19
+ const { signal } = await import("@preact/signals");
20
+
21
+ return {
22
+ route: signal({}),
23
+ };
24
+ });
25
+ vi.mock("@/stores/sections", async () => {
26
+ const { signal } = await import("@preact/signals");
27
+
28
+ return {
29
+ availableSections: signal([]),
30
+ };
31
+ });
32
+ vi.mock("@/components/HeaderControls", () => ({
33
+ HeaderControls: () => <div data-testid="header-controls"></div>,
34
+ }));
35
+ vi.mock("@/components/SectionPicker", () => ({
36
+ SectionPicker: () => <div data-testid="section-picker"></div>,
37
+ }));
38
+ vi.mock("@/components/TestResult/TrHeader/TrBreadcrumbs", () => ({
39
+ TrBreadcrumbs: () => <div data-testid="breadcrumbs"></div>,
40
+ }));
41
+ vi.mock("@/components/Header/CiInfo", () => ({
42
+ // CiInfo: vi.fn().mockReturnValue(<div data-testid="ci-info"></div>),
43
+ CiInfo: vi.fn().mockImplementation(() => <div data-testid="ci-info"></div>),
44
+ }));
45
+
46
+ beforeEach(() => {
47
+ vi.clearAllMocks();
48
+ cleanup();
49
+ route.value = {};
50
+ availableSections.value = [];
51
+ });
52
+
53
+ describe("components > Header", () => {
54
+ it("should render sections picker when there are sections available", () => {
55
+ availableSections.value = ["section1", "section2"];
56
+
57
+ render(<Header />);
58
+
59
+ expect(screen.getByTestId("section-picker")).toBeInTheDocument();
60
+ });
61
+
62
+ it("shouldn't render sections picker when there are no sections available", () => {
63
+ render(<Header />);
64
+
65
+ expect(screen.queryByTestId("section-picker")).not.toBeInTheDocument();
66
+ });
67
+
68
+ it("should render ci info only when testResultId route parameter doesn't exists and ci report option is available", () => {
69
+ route.value = {
70
+ params: {},
71
+ };
72
+ (getReportOptions as Mock).mockReturnValue({
73
+ ci: fixtures.ci,
74
+ });
75
+
76
+ render(<Header />);
77
+
78
+ expect(CiInfo).toHaveBeenCalledWith(
79
+ {
80
+ ci: fixtures.ci,
81
+ },
82
+ expect.anything(),
83
+ );
84
+ expect(screen.getByTestId("ci-info")).toBeInTheDocument();
85
+ });
86
+
87
+ it("shouldn't render ci info when testResultId route parameter exists", () => {
88
+ route.value = {
89
+ params: {
90
+ testResultId: "1",
91
+ },
92
+ };
93
+ (getReportOptions as Mock).mockReturnValue({
94
+ ci: fixtures.ci,
95
+ });
96
+
97
+ render(<Header />);
98
+
99
+ expect(CiInfo).not.toHaveBeenCalled();
100
+ expect(screen.queryByTestId("ci-info")).not.toBeInTheDocument();
101
+ });
102
+
103
+ it("should render breadcrumbs when testResultId route parameter exists", () => {
104
+ route.value = {
105
+ params: {
106
+ testResultId: "1",
107
+ },
108
+ };
109
+ (getReportOptions as Mock).mockReturnValue({
110
+ ci: fixtures.ci,
111
+ });
112
+
113
+ render(<Header />);
114
+
115
+ expect(screen.getByTestId("breadcrumbs")).toBeInTheDocument();
116
+ });
117
+
118
+ it("shouldn't render breadcrumbs when testResultId route parameter doesn't exists", () => {
119
+ route.value = {
120
+ params: {},
121
+ };
122
+
123
+ render(<Header />);
124
+
125
+ expect(screen.queryByTestId("breadcrumbs")).not.toBeInTheDocument();
126
+ });
127
+ });
package/tsconfig.json CHANGED
@@ -23,5 +23,10 @@
23
23
  "skipLibCheck": true
24
24
  },
25
25
  "include": ["src"],
26
- "exclude": ["node_modules", "dist"]
26
+ "exclude": ["node_modules", "dist"],
27
+ "references": [
28
+ {
29
+ "path": "./tsconfig.node.json"
30
+ }
31
+ ]
27
32
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["vitest.config.ts", "./src", "./test/**/*.ts", "./test/**/*.tsx"],
4
+ "compilerOptions": {
5
+ "composite": true,
6
+ "types": ["@testing-library/jest-dom"]
7
+ }
8
+ }
package/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ CiDescriptor,
2
3
  AttachmentTestStepResult,
3
4
  DefaultTreeGroup,
4
5
  HistoryTestResult,
@@ -25,6 +26,7 @@ export type AwesomeReportOptions = {
25
26
  defaultSection?: string;
26
27
  sections?: string[];
27
28
  cacheKey: string;
29
+ ci?: CiDescriptor;
28
30
  };
29
31
 
30
32
  export type AwesomeFixtureResult = Omit<
@@ -82,7 +84,6 @@ export type AwesomeTreeLeaf = Pick<
82
84
  "duration" | "name" | "start" | "status" | "groupOrder" | "flaky" | "transition" | "retry" | "retriesCount"
83
85
  > & {
84
86
  nodeId: string;
85
- transitionText?: string;
86
87
  transitionTooltip?: string;
87
88
  };
88
89
 
package/vitest.config.ts CHANGED
@@ -1,12 +1,25 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { defineConfig } from "vitest/config";
3
+ import { resolve } from "path";
4
+ import { preact } from "@preact/preset-vite"
3
5
 
4
6
  const require = createRequire(import.meta.url);
5
7
 
6
8
  export default defineConfig({
9
+ plugins: [preact()],
10
+ resolve: {
11
+ alias: {
12
+ "@": resolve(__dirname, "./src"),
13
+ },
14
+ },
7
15
  test: {
8
- include: ["./test/**/*.test.ts"],
9
- setupFiles: [require.resolve("allure-vitest/setup")],
16
+ environment: "jsdom",
17
+ include: ["./test/**/*.test.{ts,tsx}"],
18
+ globals: true,
19
+ setupFiles: [
20
+ require.resolve("allure-vitest/setup"),
21
+ "./vitest.setup.ts",
22
+ ],
10
23
  reporters: [
11
24
  "default",
12
25
  [
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom/vitest";