@allurereport/web-summary 3.0.1 → 3.2.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.
@@ -1,15 +1,29 @@
1
1
  {
2
2
  "summary": {
3
- "passed": "geslaagd",
4
- "failed": "mislukt",
5
- "broken": "gebroken",
6
- "skipped": "overgeslagen",
7
- "unknown": "onbekend",
3
+ "status": {
4
+ "passed": "geslaagd",
5
+ "failed": "mislukt",
6
+ "broken": "gebroken",
7
+ "skipped": "overgeslagen",
8
+ "unknown": "onbekend"
9
+ },
10
+ "createdAt": "{{createdAt, timestamp_long_no_seconds}}",
8
11
  "total": "totaal",
9
12
  "in": "in",
10
- "new": "nieuwe tests",
11
- "flaky": "onstabiele tests",
12
- "retry": "herhaalde tests"
13
+ "metadata": {
14
+ "new_zero": "Geen nieuwe tests",
15
+ "new_one": "{{count}} nieuwe test",
16
+ "new_other": "{{count}} nieuwe tests",
17
+ "flaky_zero": "Geen onstabiele tests",
18
+ "flaky_one": "{{count}} onstabiele test",
19
+ "flaky_other": "{{count}} onstabiele tests",
20
+ "retry_zero": "Geen herhaalde tests",
21
+ "retry_one": "{{count}} herhaalde test",
22
+ "retry_other": "{{count}} herhaalde tests"
23
+ }
24
+ },
25
+ "ui": {
26
+ "at": "om"
13
27
  },
14
28
  "empty": {
15
29
  "no-reports": "Geen rapporten gevonden"
@@ -1,15 +1,29 @@
1
1
  {
2
2
  "summary": {
3
- "passed": "zdany",
4
- "failed": "niezdany",
5
- "broken": "zepsuty",
6
- "skipped": "pominięty",
7
- "unknown": "nieznany",
3
+ "status": {
4
+ "passed": "zdany",
5
+ "failed": "niezdany",
6
+ "broken": "zepsuty",
7
+ "skipped": "pominięty",
8
+ "unknown": "nieznany"
9
+ },
10
+ "createdAt": "{{createdAt, timestamp_long_no_seconds}}",
8
11
  "total": "wszystkie",
9
12
  "in": "za",
10
- "new": "nowe testy",
11
- "flaky": "niestabilne testy",
12
- "retry": "powtórzone testy"
13
+ "metadata": {
14
+ "new_zero": "Brak nowych testów",
15
+ "new_one": "{{count}} nowy test",
16
+ "new_other": "{{count}} nowych testów",
17
+ "flaky_zero": "Brak niestabilnych testów",
18
+ "flaky_one": "{{count}} niestabilny test",
19
+ "flaky_other": "{{count}} niestabilnych testów",
20
+ "retry_zero": "Brak powtórzonych testów",
21
+ "retry_one": "{{count}} powtórzony test",
22
+ "retry_other": "{{count}} powtórzonych testów"
23
+ }
24
+ },
25
+ "ui": {
26
+ "at": "o"
13
27
  },
14
28
  "empty": {
15
29
  "no-reports": "Brak raportów"
@@ -1,15 +1,29 @@
1
1
  {
2
2
  "summary": {
3
- "passed": "aprovado",
4
- "failed": "falhou",
5
- "broken": "quebrado",
6
- "skipped": "ignorado",
7
- "unknown": "desconhecido",
3
+ "status": {
4
+ "passed": "aprovado",
5
+ "failed": "falhou",
6
+ "broken": "quebrado",
7
+ "skipped": "ignorado",
8
+ "unknown": "desconhecido"
9
+ },
10
+ "createdAt": "{{createdAt, timestamp_long_no_seconds}}",
8
11
  "total": "total",
9
12
  "in": "em",
10
- "new": "novos testes",
11
- "flaky": "testes instáveis",
12
- "retry": "testes repetidos"
13
+ "metadata": {
14
+ "new_zero": "Nenhum novo teste",
15
+ "new_one": "{{count}} novo teste",
16
+ "new_other": "{{count}} novos testes",
17
+ "flaky_zero": "Nenhum teste instável",
18
+ "flaky_one": "{{count}} teste instável",
19
+ "flaky_other": "{{count}} testes instáveis",
20
+ "retry_zero": "Nenhum teste repetido",
21
+ "retry_one": "{{count}} teste repetido",
22
+ "retry_other": "{{count}} testes repetidos"
23
+ }
24
+ },
25
+ "ui": {
26
+ "at": "às"
13
27
  },
14
28
  "empty": {
15
29
  "no-reports": "Nenhum relatório encontrado"
@@ -1,15 +1,29 @@
1
1
  {
2
2
  "summary": {
3
- "passed": "успешный",
4
- "failed": "неуспешный",
5
- "broken": "сломанный",
6
- "skipped": "пропущенный",
7
- "unknown": "неизвестный",
3
+ "status": {
4
+ "passed": "успешный",
5
+ "failed": "неуспешный",
6
+ "broken": "сломанный",
7
+ "skipped": "пропущенный",
8
+ "unknown": "неизвестный"
9
+ },
10
+ "createdAt": "{{createdAt, timestamp_long_no_seconds}}",
8
11
  "total": "все",
9
12
  "in": "за",
10
- "new": "новые тесты",
11
- "flaky": "нестабильные тесты",
12
- "retry": "повторные тесты"
13
+ "metadata": {
14
+ "new_zero": "Нет новых тестов",
15
+ "new_one": "{{count}} новый тест",
16
+ "new_other": "{{count}} новых тестов",
17
+ "flaky_zero": "Нет нестабильных тестов",
18
+ "flaky_one": "{{count}} нестабильный тест",
19
+ "flaky_other": "{{count}} нестабильных тестов",
20
+ "retry_zero": "Нет повторных тестов",
21
+ "retry_one": "{{count}} повторный тест",
22
+ "retry_other": "{{count}} повторных тестов"
23
+ }
24
+ },
25
+ "ui": {
26
+ "at": "в"
13
27
  },
14
28
  "empty": {
15
29
  "no-reports": "Отчеты не найдены"
@@ -1,15 +1,29 @@
1
1
  {
2
2
  "summary": {
3
- "passed": "godkänd",
4
- "failed": "misslyckad",
5
- "broken": "trasig",
6
- "skipped": "hoppad över",
7
- "unknown": "okänd",
3
+ "status": {
4
+ "passed": "godkänd",
5
+ "failed": "misslyckad",
6
+ "broken": "trasig",
7
+ "skipped": "hoppad över",
8
+ "unknown": "okänd"
9
+ },
10
+ "createdAt": "{{createdAt, timestamp_long_no_seconds}}",
8
11
  "total": "totalt",
9
12
  "in": "i",
10
- "new": "nya tester",
11
- "flaky": "instabila tester",
12
- "retry": "upprepade tester"
13
+ "metadata": {
14
+ "new_zero": "Inga nya tester",
15
+ "new_one": "{{count}} nytt test",
16
+ "new_other": "{{count}} nya tester",
17
+ "flaky_zero": "Inga instabila tester",
18
+ "flaky_one": "{{count}} instabilt test",
19
+ "flaky_other": "{{count}} instabila tester",
20
+ "retry_zero": "Inga upprepade tester",
21
+ "retry_one": "{{count}} upprepat test",
22
+ "retry_other": "{{count}} upprepade tester"
23
+ }
24
+ },
25
+ "ui": {
26
+ "at": "kl"
13
27
  },
14
28
  "empty": {
15
29
  "no-reports": "Inga rapporter"
@@ -1,15 +1,29 @@
1
1
  {
2
2
  "summary": {
3
- "passed": "başarılı",
4
- "failed": "başarısız",
5
- "broken": "bozuk",
6
- "skipped": "atlandı",
7
- "unknown": "bilinmeyen",
3
+ "status": {
4
+ "passed": "başarılı",
5
+ "failed": "başarısız",
6
+ "broken": "bozuk",
7
+ "skipped": "atlandı",
8
+ "unknown": "bilinmeyen"
9
+ },
10
+ "createdAt": "{{createdAt, timestamp_long_no_seconds}}",
8
11
  "total": "toplam",
9
12
  "in": "içinde",
10
- "new": "yeni testler",
11
- "flaky": "kararsız testler",
12
- "retry": "tekrar testleri"
13
+ "metadata": {
14
+ "new_zero": "Yeni test yok",
15
+ "new_one": "{{count}} yeni test",
16
+ "new_other": "{{count}} yeni test",
17
+ "flaky_zero": "Kararsız test yok",
18
+ "flaky_one": "{{count}} kararsız test",
19
+ "flaky_other": "{{count}} kararsız test",
20
+ "retry_zero": "Tekrar testi yok",
21
+ "retry_one": "{{count}} tekrar testi",
22
+ "retry_other": "{{count}} tekrar testi"
23
+ }
24
+ },
25
+ "ui": {
26
+ "at": "saat"
13
27
  },
14
28
  "empty": {
15
29
  "no-reports": "Rapor bulunamadı"
@@ -1,15 +1,29 @@
1
1
  {
2
2
  "summary": {
3
- "passed": "通过",
4
- "failed": "失败",
5
- "broken": "损坏",
6
- "skipped": "跳过",
7
- "unknown": "未知",
3
+ "status": {
4
+ "passed": "通过",
5
+ "failed": "失败",
6
+ "broken": "损坏",
7
+ "skipped": "跳过",
8
+ "unknown": "未知"
9
+ },
10
+ "createdAt": "{{createdAt, timestamp_long_no_seconds}}",
8
11
  "total": "总计",
9
12
  "in": "在",
10
- "new": "新测试",
11
- "flaky": "不稳定测试",
12
- "retry": "重试测试"
13
+ "metadata": {
14
+ "new_zero": "无新测试",
15
+ "new_one": "{{count}} 个新测试",
16
+ "new_other": "{{count}} 个新测试",
17
+ "flaky_zero": "无不稳定测试",
18
+ "flaky_one": "{{count}} 个不稳定测试",
19
+ "flaky_other": "{{count}} 个不稳定测试",
20
+ "retry_zero": "无重试测试",
21
+ "retry_one": "{{count}} 个重试测试",
22
+ "retry_other": "{{count}} 个重试测试"
23
+ }
24
+ },
25
+ "ui": {
26
+ "at": "于"
13
27
  },
14
28
  "empty": {
15
29
  "no-reports": "未找到报告"
package/src/index.html CHANGED
@@ -33,6 +33,7 @@
33
33
  unknown: 2,
34
34
  total: 139
35
35
  },
36
+ createdAt: Date.now(),
36
37
  duration: 1240812,
37
38
  status: "failed",
38
39
  newTests: [
@@ -85,6 +86,7 @@
85
86
  passed: 67,
86
87
  total: 67
87
88
  },
89
+ createdAt: Date.now(),
88
90
  duration: 31290,
89
91
  status: "passed",
90
92
  newTests: [
@@ -106,6 +108,7 @@
106
108
  broken: 48,
107
109
  total: 60
108
110
  },
111
+ createdAt: Date.now(),
109
112
  duration: 512341,
110
113
  status: "broken",
111
114
  newTests: [],
package/src/index.tsx CHANGED
@@ -1,73 +1,54 @@
1
- import { LANG_LOCALE } from "@allurereport/web-commons";
2
1
  import { ReportSummaryCard } from "@allurereport/web-components";
3
2
  import "@allurereport/web-components/index.css";
4
- import { computed } from "@preact/signals";
5
3
  import { render } from "preact";
6
- import { useEffect, useState } from "preact/hooks";
7
4
  import "@/assets/scss/index.scss";
8
5
  import { EmptyPlaceholder } from "@/components/EmptyPlaceholder";
9
6
  import { Footer } from "@/components/Footer";
10
7
  import { Header } from "@/components/Header";
11
- import { currentLocale, getLocale, getTheme, useI18n, waitForI18next } from "@/stores";
8
+ import { getLocale, useI18n, waitForI18next } from "@/stores";
12
9
  import * as styles from "./styles.scss";
13
10
 
14
- export const currentLocaleIso = computed(() => LANG_LOCALE[currentLocale.value]?.iso ?? LANG_LOCALE.en.iso);
11
+ const getSummaries = () => {
12
+ return window.reportSummaries as Record<string, any>[] | undefined;
13
+ };
15
14
 
16
15
  const App = () => {
17
- const [loaded, setLoaded] = useState(false);
18
- const summaries = window.reportSummaries;
16
+ const summaries = getSummaries();
19
17
  const { t: tEmpty } = useI18n("empty");
20
18
  const { t: tSummary } = useI18n("summary");
21
19
 
22
- useEffect(() => {
23
- getLocale();
24
- getTheme();
25
- waitForI18next.then(() => {
26
- setLoaded(true);
27
- });
28
- }, []);
29
-
30
- if (!loaded) {
31
- return null;
20
+ if (!summaries) {
21
+ return (
22
+ <div className={styles.container}>
23
+ <Header />
24
+ <main>
25
+ <EmptyPlaceholder label={tEmpty("no-reports")} />
26
+ </main>
27
+ <Footer className={styles.footer} />
28
+ </div>
29
+ );
32
30
  }
33
31
 
34
32
  return (
35
33
  <div className={styles.container}>
36
34
  <Header />
37
35
  <main>
38
- {!summaries.length && <EmptyPlaceholder label={tEmpty("no-reports")} />}
39
- {!!summaries.length && (
40
- <ul className={styles["summary-showcase"]}>
41
- {summaries.map((summary: any) => {
42
- return (
43
- <li key={summary.output}>
44
- <ReportSummaryCard
45
- localeIso={currentLocaleIso.value}
46
- locales={{
47
- failed: tSummary("failed"),
48
- broken: tSummary("broken"),
49
- passed: tSummary("passed"),
50
- skipped: tSummary("skipped"),
51
- unknown: tSummary("unknown"),
52
- in: tSummary("in"),
53
- new: tSummary("new"),
54
- retry: tSummary("retry"),
55
- flaky: tSummary("flaky"),
56
- total: tSummary("total"),
57
- }}
58
- {...summary}
59
- />
60
- </li>
61
- );
62
- })}
63
- </ul>
64
- )}
36
+ <div className={styles["summary-showcase"]}>
37
+ {summaries.map((summary: any) => (
38
+ <ReportSummaryCard key={summary.output} i18n={tSummary} summary={summary} />
39
+ ))}
40
+ </div>
65
41
  </main>
66
42
  <Footer className={styles.footer} />
67
43
  </div>
68
44
  );
69
45
  };
70
46
 
71
- const rootElement = document.getElementById("app");
47
+ const init = async () => {
48
+ await getLocale();
49
+ await waitForI18next;
50
+
51
+ render(<App />, document.getElementById("app")!);
52
+ };
72
53
 
73
- render(<App />, rootElement);
54
+ init();
@@ -1,2 +1 @@
1
- export * from "./theme";
2
1
  export * from "./locale";
@@ -1,12 +1,13 @@
1
+ import { getLocaleDateTimeOverride } from "@allurereport/web-commons";
1
2
  import { computed, signal } from "@preact/signals";
2
3
  import i18next, { type TOptions } from "i18next";
3
4
  import { DEFAULT_LOCALE, LANG_LOCALE, type LangLocale } from "@/i18n/constants";
4
5
 
5
- const namespaces = ["empty", "summary"];
6
+ const namespaces = ["empty", "summary", "ui"];
6
7
 
7
8
  export const currentLocale = signal<LangLocale>("en" as LangLocale);
8
9
  export const currentLocaleIso = computed(() => LANG_LOCALE[currentLocale.value]?.iso ?? LANG_LOCALE.en.iso);
9
- export const currentLocaleIsRTL = computed(() => ["ar", "he", "fa"].includes(currentLocale.value));
10
+ export const currentLocaleIsRTL = computed(() => ["ar", "he", "fa"].includes(currentLocale.value as string));
10
11
 
11
12
  export const getLocale = async () => {
12
13
  const locale = localStorage.getItem("currentLocale") || DEFAULT_LOCALE;
@@ -22,7 +23,8 @@ export const waitForI18next = i18next
22
23
  namespace: string,
23
24
  callback: (errorValue: unknown, translations: null) => void,
24
25
  ) => {
25
- await import(`@/i18n/locales/${language}.json`)
26
+ const loadLocale = language === "en-iso" ? "en" : language;
27
+ await import(`@/i18n/locales/${loadLocale}.json`)
26
28
  .then((resources: Record<string, null>) => {
27
29
  callback(null, resources[namespace]);
28
30
  })
@@ -36,6 +38,26 @@ export const waitForI18next = i18next
36
38
  fallbackLng: "en",
37
39
  ns: namespaces,
38
40
  interpolation: { escapeValue: false },
41
+ })
42
+ .then(() => {
43
+ i18next.services.formatter!.add("timestamp_long_no_seconds", (value: number, lng) => {
44
+ const override = getLocaleDateTimeOverride(lng as string, "dateTime");
45
+ const resolvedLocale = override?.locale ?? lng;
46
+ const dateFormatter = new Intl.DateTimeFormat(resolvedLocale, {
47
+ month: "numeric",
48
+ day: "numeric",
49
+ year: "numeric",
50
+ });
51
+ const timeFormatter = new Intl.DateTimeFormat(resolvedLocale, {
52
+ hour: "numeric",
53
+ minute: "numeric",
54
+ hour12: false,
55
+ });
56
+ const datePart = dateFormatter.format(value);
57
+ const timePart = timeFormatter.format(value);
58
+ const separator = i18next.t("ui:at", { lng });
59
+ return `${datePart} ${separator} ${timePart}`;
60
+ });
39
61
  });
40
62
 
41
63
  export const useI18n = (namespace?: string) => {
package/src/styles.scss CHANGED
@@ -19,21 +19,6 @@
19
19
  margin-bottom: 40px;
20
20
  }
21
21
 
22
- .summary-card {
23
- display: block;
24
- padding: 16px;
25
- height: 100%;
26
- text-decoration: none;
27
- box-shadow: var(--shadow-small);
28
- background: var(--bg-base-primary);
29
- border-radius: 12px;
30
-
31
- &:hover {
32
- box-shadow: none;
33
- transition: box-shadow 0.2s;
34
- }
35
- }
36
-
37
22
  .summary-card-title {
38
23
  display: flex;
39
24
  align-items: flex-start;
package/tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "strictNullChecks": true,
3
4
  "baseUrl": "./",
4
5
  "paths": {
5
6
  "@/*": ["src/*"]
package/types.d.ts CHANGED
@@ -18,7 +18,7 @@ export type AwesomeReportOptions = {
18
18
  logo?: string;
19
19
  theme?: "light" | "dark";
20
20
  groupBy?: string[];
21
- reportLanguage?: "en" | "ru";
21
+ reportLanguage?: string;
22
22
  createdAt: number;
23
23
  reportUuid: string;
24
24
  layout?: Layout;