diff --git a/frontend/config/selection.ts b/frontend/config/selection.ts index d54055b..095aadd 100644 --- a/frontend/config/selection.ts +++ b/frontend/config/selection.ts @@ -1,3 +1,4 @@ +import { TestTypeType } from '@/types/testType'; import { PriorityType } from '@/types/priority'; const roles = [{ uid: 'administrator' }, { uid: 'user' }]; @@ -18,7 +19,7 @@ const priorities: PriorityType[] = [ { uid: 'low', color: '#94d2bd', chartColor: '#94d2bd' }, ]; -const testTypes = [ +const testTypes: TestTypeType[] = [ { uid: 'other', chartColor: categoricalPalette[0] }, { uid: 'security', chartColor: categoricalPalette[1] }, { uid: 'performance', chartColor: categoricalPalette[2] }, diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 91034cc..0f1e7f1 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -5,6 +5,21 @@ "medium": "Medium", "low": "Low" }, + "Type": { + "other": "Other", + "security": "Security", + "performance": "Performance", + "accessibility": "Accessibility", + "functional": "Functional", + "acceptance": "Acceptance", + "usability": "Usability", + "smoke_sanity": "Smoke&Sanity", + "compatibility": "Compatibility", + "destructive": "Destructive", + "regression": "Regression", + "automated": "Automated", + "manual": "Manual" + }, "Index": { "get_started": "Get Started", "demo": "Demo", @@ -120,20 +135,7 @@ "skipped": "Skipped", "test_classification": "Test Classification", "by_type": "By test type", - "by_priority": "By test priority", - "other": "Other", - "security": "Security", - "performance": "Performance", - "accessibility": "Accessibility", - "functional": "Functional", - "acceptance": "Acceptance", - "usability": "Usability", - "smoke_sanity": "Smoke&Sanity", - "compatibility": "Compatibility", - "destructive": "Destructive", - "regression": "Regression", - "automated": "Automated", - "manual": "Manual" + "by_priority": "By test priority" }, "Folders": { "folder": "Folder", @@ -179,19 +181,6 @@ "test_case_description": "Test case description", "priority": "Priority", "type": "Type", - "other": "Other", - "security": "Security", - "performance": "Performance", - "accessibility": "Accessibility", - "functional": "Functional", - "acceptance": "Acceptance", - "usability": "Usability", - "smoke_sanity": "Smoke&Sanity", - "compatibility": "Compatibility", - "destructive": "Destructive", - "regression": "Regression", - "automated": "Automated", - "manual": "Manual", "template": "Template", "test_detail": "Test detail", "preconditions": "Preconditions", @@ -264,19 +253,6 @@ "no_cases_found": "No cases found", "are_you_sure_leave": "Are you sure you want to leave the page?", "type": "Type", - "other": "Other", - "security": "Security", - "performance": "Performance", - "accessibility": "Accessibility", - "functional": "Functional", - "acceptance": "Acceptance", - "usability": "Usability", - "smoke_sanity": "Smoke&Sanity", - "compatibility": "Compatibility", - "destructive": "Destructive", - "regression": "Regression", - "automated": "Automated", - "manual": "Manual", "preconditions": "Preconditions", "expected_result": "Expected result", "details_of_the_step": "Details of the step", diff --git a/frontend/messages/ja.json b/frontend/messages/ja.json index 3fd7cb3..955194e 100644 --- a/frontend/messages/ja.json +++ b/frontend/messages/ja.json @@ -6,6 +6,21 @@ "medium": "中", "low": "低" }, + "Type": { + "other": "その他", + "security": "セキュリティ", + "performance": "パフォーマンス", + "accessibility": "アクセシビリティ", + "functional": "機能", + "acceptance": "受け入れ", + "usability": "ユーザビリティ", + "smoke_sanity": "スモーク/サニティ", + "compatibility": "互換性", + "destructive": "破壊", + "regression": "回帰", + "automated": "自動", + "manual": "手動" + }, "Index": { "get_started": "テスト管理を始める", "demo": "デモ", @@ -121,20 +136,7 @@ "skipped": "スキップ", "test_classification": "テスト分類", "by_type": "タイプ別", - "by_priority": "優先度別", - "other": "その他", - "security": "セキュリティ", - "performance": "パフォーマンス", - "accessibility": "アクセシビリティ", - "functional": "機能", - "acceptance": "受け入れ", - "usability": "ユーザビリティ", - "smoke_sanity": "スモーク/サニティ", - "compatibility": "互換性", - "destructive": "破壊", - "regression": "回帰", - "automated": "自動", - "manual": "手動" + "by_priority": "優先度別" }, "Folders": { "folder": "フォルダー", @@ -180,19 +182,6 @@ "test_case_description": "テストケース詳細", "priority": "優先度", "type": "タイプ", - "other": "その他", - "security": "セキュリティ", - "performance": "パフォーマンス", - "accessibility": "アクセシビリティ", - "functional": "機能", - "acceptance": "受け入れ", - "usability": "ユーザビリティ", - "smoke_sanity": "スモーク/サニティ", - "compatibility": "互換性", - "destructive": "破壊", - "regression": "回帰", - "automated": "自動", - "manual": "手動", "template": "テンプレート", "test_detail": "テスト詳細", "preconditions": "前提条件", @@ -265,19 +254,6 @@ "no_cases_found": "テストケースが見つかりません", "are_you_sure_leave": "ページを離れてもよろしいですか", "type": "タイプ", - "other": "その他", - "security": "セキュリティ", - "performance": "パフォーマンス", - "accessibility": "アクセシビリティ", - "functional": "機能", - "acceptance": "受け入れ", - "usability": "ユーザビリティ", - "smoke_sanity": "スモーク/サニティ", - "compatibility": "互換性", - "destructive": "破壊", - "regression": "回帰", - "automated": "自動", - "manual": "手動", "test_detail": "テスト詳細", "preconditions": "前提条件", "expected_result": "期待結果", diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseEditor.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseEditor.tsx index cb7f5c7..c956a9e 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseEditor.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/CaseEditor.tsx @@ -13,6 +13,7 @@ import { TokenContext } from '@/utils/TokenProvider'; import { useFormGuard } from '@/utils/formGuard'; import { CaseType, AttachmentType, CaseMessages, StepType } from '@/types/case'; import { PriorityMessages } from '@/types/priority'; +import { TestTypeMessages } from '@/types/testType'; const defaultTestCase = { id: 0, @@ -37,11 +38,20 @@ type Props = { folderId: string; caseId: string; messages: CaseMessages; + testTypeMessages: TestTypeMessages; priorityMessages: PriorityMessages; locale: string; }; -export default function CaseEditor({ projectId, folderId, caseId, messages, priorityMessages, locale }: Props) { +export default function CaseEditor({ + projectId, + folderId, + caseId, + messages, + testTypeMessages, + priorityMessages, + locale, +}: Props) { const context = useContext(TokenContext); const [testCase, setTestCase] = useState(defaultTestCase); const [isTitleInvalid, setIsTitleInvalid] = useState(false); @@ -285,7 +295,7 @@ export default function CaseEditor({ projectId, folderId, caseId, messages, prio > {testTypes.map((type, index) => ( - {messages[type.uid]} + {testTypeMessages[type.uid]} ))} diff --git a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/page.tsx index ceb5ab2..e2ace79 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/folders/[folderId]/cases/[caseId]/page.tsx @@ -1,6 +1,7 @@ import { PriorityMessages } from '@/types/priority'; import CaseEditor from './CaseEditor'; import { useTranslations } from 'next-intl'; +import { TestTypeMessages } from '@/types/testType'; export default function Page({ params, @@ -24,19 +25,6 @@ export default function Page({ testCaseDescription: t('test_case_description'), priority: t('priority'), type: t('type'), - other: t('other'), - security: t('security'), - performance: t('performance'), - accessibility: t('accessibility'), - functional: t('functional'), - acceptance: t('acceptance'), - usability: t('usability'), - smokeSanity: t('smoke_sanity'), - compatibility: t('compatibility'), - destructive: t('destructive'), - regression: t('regression'), - automated: t('automated'), - manual: t('manual'), template: t('template'), testDetail: t('test_detail'), preconditions: t('preconditions'), @@ -58,6 +46,23 @@ export default function Page({ areYouSureLeave: t('are_you_sure_leave'), }; + const tt = useTranslations('Type'); + const testTypeMessages: TestTypeMessages = { + other: tt('other'), + security: tt('security'), + performance: tt('performance'), + accessibility: tt('accessibility'), + functional: tt('functional'), + acceptance: tt('acceptance'), + usability: tt('usability'), + smokeSanity: tt('smoke_sanity'), + compatibility: tt('compatibility'), + destructive: tt('destructive'), + regression: tt('regression'), + automated: tt('automated'), + manual: tt('manual'), + }; + const priorityTranslation = useTranslations('Priority'); const priorityMessages: PriorityMessages = { critical: priorityTranslation('critical'), @@ -72,6 +77,7 @@ export default function Page({ folderId={params.folderId} caseId={params.caseId} messages={messages} + testTypeMessages={testTypeMessages} priorityMessages={priorityMessages} locale={params.locale} /> diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/ProjectHome.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/ProjectHome.tsx index a0c8bbe..1a41551 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/ProjectHome.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/ProjectHome.tsx @@ -8,12 +8,13 @@ import { ProgressSeriesType } from '@/types/run'; import { HomeMessages } from './page'; import { TokenContext } from '@/utils/TokenProvider'; import { aggregateBasicInfo, aggregateTestPriority, aggregateTestType, aggregateProgress } from './aggregate'; -import TestTypesChart from './TestTypesDonutChart'; -import TestPriorityChart from './TestPriorityDonutChart'; -import TestProgressBarChart from './TestProgressColumnChart'; import Config from '@/config/config'; import { useTheme } from 'next-themes'; import { PriorityMessages } from '@/types/priority'; +import { TestTypeMessages } from '@/types/testType'; +import TestTypesChart from './TestTypesDonutChart'; +import TestPriorityChart from './TestPriorityDonutChart'; +import TestProgressBarChart from './TestProgressColumnChart'; const apiServer = Config.apiServer; async function fetchProject(jwt: string, projectId: number) { @@ -42,10 +43,11 @@ async function fetchProject(jwt: string, projectId: number) { type Props = { projectId: string; messages: HomeMessages; + testTypeMessages: TestTypeMessages; priorityMessages: PriorityMessages; }; -export function ProjectHome({ projectId, messages, priorityMessages }: Props) { +export function ProjectHome({ projectId, messages, testTypeMessages, priorityMessages }: Props) { const context = useContext(TokenContext); const { theme, setTheme } = useTheme(); const [project, setProject] = useState({ @@ -132,7 +134,7 @@ export function ProjectHome({ projectId, messages, priorityMessages }: Props) {

{messages.byType}

- +

{messages.byPriority}

diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/TestTypesDonutChart.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/TestTypesDonutChart.tsx index a520162..8a2486b 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/TestTypesDonutChart.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/TestTypesDonutChart.tsx @@ -3,16 +3,16 @@ import { useState, useEffect } from 'react'; import dynamic from 'next/dynamic'; import { testTypes } from '@/config/selection'; import { CaseTypeCountType } from '@/types/case'; -import { HomeMessages } from './page'; +import { TestTypeMessages } from '@/types/testType'; const Chart = dynamic(() => import('react-apexcharts'), { ssr: false }); type Props = { typesCounts: CaseTypeCountType[]; - messages: HomeMessages; + testTypeMessages: TestTypeMessages; theme: string; }; -export default function TestTypesDonutChart({ typesCounts, messages, theme }: Props) { +export default function TestTypesDonutChart({ typesCounts, testTypeMessages, theme }: Props) { const [chartData, setChartData] = useState({ series: [], options: { @@ -29,7 +29,7 @@ export default function TestTypesDonutChart({ typesCounts, messages, theme }: Pr return found ? found.count : 0; }); - const labels = testTypes.map((entry) => messages[entry.uid]); + const labels = testTypes.map((entry) => testTypeMessages[entry.uid]); const colors = testTypes.map((entry) => entry.chartColor); const legend = { labels: { diff --git a/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx b/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx index 385b666..64a78b3 100644 --- a/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx +++ b/frontend/src/app/[locale]/projects/[projectId]/home/page.tsx @@ -1,6 +1,7 @@ import { ProjectHome } from './ProjectHome'; import { useTranslations } from 'next-intl'; import { PriorityMessages } from '@/types/priority'; +import { TestTypeMessages } from '@/types/testType'; export type HomeMessages = { folders: string; @@ -15,20 +16,6 @@ export type HomeMessages = { testClassification: string; byType: string; byPriority: string; - testTypes: string; - other: string; - security: string; - performance: string; - accessibility: string; - functional: string; - acceptance: string; - usability: string; - smokeSanity: string; - compatibility: string; - destructive: string; - regression: string; - automated: string; - manual: string; }; export default function Page({ params }: { params: { projectId: string } }) { @@ -46,19 +33,23 @@ export default function Page({ params }: { params: { projectId: string } }) { testClassification: t('test_classification'), byType: t('by_type'), byPriority: t('by_priority'), - other: t('other'), - security: t('security'), - performance: t('performance'), - accessibility: t('accessibility'), - functional: t('functional'), - acceptance: t('acceptance'), - usability: t('usability'), - smokeSanity: t('smoke_sanity'), - compatibility: t('compatibility'), - destructive: t('destructive'), - regression: t('regression'), - automated: t('automated'), - manual: t('manual'), + }; + + const tt = useTranslations('Type'); + const testTypeMessages: TestTypeMessages = { + other: tt('other'), + security: tt('security'), + performance: tt('performance'), + accessibility: tt('accessibility'), + functional: tt('functional'), + acceptance: tt('acceptance'), + usability: tt('usability'), + smokeSanity: tt('smoke_sanity'), + compatibility: tt('compatibility'), + destructive: tt('destructive'), + regression: tt('regression'), + automated: tt('automated'), + manual: tt('manual'), }; const pt = useTranslations('Priority'); @@ -71,7 +62,12 @@ export default function Page({ params }: { params: { projectId: string } }) { return ( <> - + ); } diff --git a/frontend/types/case.ts b/frontend/types/case.ts index 09da508..325eaee 100644 --- a/frontend/types/case.ts +++ b/frontend/types/case.ts @@ -81,10 +81,6 @@ type CasesMessages = { delete: string; newTestCase: string; status: string; - critical: string; - high: string; - medium: string; - low: string; noCasesFound: string; caseTitle: string; caseDescription: string; @@ -102,19 +98,6 @@ type CaseMessages = { description: string; testCaseDescription: string; type: string; - other: string; - security: string; - performance: string; - accessibility: string; - functional: string; - acceptance: string; - usability: string; - smokeSanity: string; - compatibility: string; - destructive: string; - regression: string; - automated: string; - manual: string; template: string; testDetail: string; preconditions: string; diff --git a/frontend/types/run.ts b/frontend/types/run.ts index 0f060bb..d5eaf8a 100644 --- a/frontend/types/run.ts +++ b/frontend/types/run.ts @@ -80,19 +80,6 @@ type RunMessages = { noCasesFound: string; areYouSureLeave: string; type: string; - other: string; - security: string; - performance: string; - accessibility: string; - functional: string; - acceptance: string; - usability: string; - smokeSanity: string; - compatibility: string; - destructive: string; - regression: string; - automated: string; - manual: string; preconditions: string; expectedResult: string; detailsOfTheStep: string; diff --git a/frontend/types/testType.ts b/frontend/types/testType.ts new file mode 100644 index 0000000..34d735d --- /dev/null +++ b/frontend/types/testType.ts @@ -0,0 +1,37 @@ +type TestTypeUidType = + | 'other' + | 'security' + | 'performance' + | 'accessibility' + | 'functional' + | 'acceptance' + | 'usability' + | 'smokeSanity' + | 'compatibility' + | 'destructive' + | 'regression' + | 'automated' + | 'manual'; + +type TestTypeType = { + uid: TestTypeUidType; + chartColor: string; +}; + +type TestTypeMessages = { + other: string; + security: string; + performance: string; + accessibility: string; + functional: string; + acceptance: string; + usability: string; + smokeSanity: string; + compatibility: string; + destructive: string; + regression: string; + automated: string; + manual: string; +}; + +export type { TestTypeUidType, TestTypeType, TestTypeMessages };