feat: bulk test case creation (#346)
This commit is contained in:
committed by
GitHub
parent
8585976d38
commit
92d6340ddc
@@ -217,7 +217,7 @@
|
||||
"delete": "Delete",
|
||||
"close": "Close",
|
||||
"are_you_sure": "Are you sure you want to delete test cases?",
|
||||
"new_test_case": "New Test Case",
|
||||
"new_test_case": "New",
|
||||
"export": "Export",
|
||||
"status": "Status",
|
||||
"no_cases_found": "No test cases found",
|
||||
@@ -248,7 +248,8 @@
|
||||
"click_to_upload": "Click to upload",
|
||||
"or_drag_and_drop": " or drag and drop",
|
||||
"max_file_size": "Max. file size",
|
||||
"cases_imported": "Test cases imported"
|
||||
"cases_imported": "Test cases imported",
|
||||
"create_more": "Create more"
|
||||
},
|
||||
"Case": {
|
||||
"back_to_cases": "Back to test cases",
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
"delete": "削除",
|
||||
"close": "閉じる",
|
||||
"are_you_sure": "テストケースを削除してもよろしいですか?",
|
||||
"new_test_case": "新規テストケース",
|
||||
"new_test_case": "新規",
|
||||
"export": "エクスポート",
|
||||
"status": "ステータス",
|
||||
"no_cases_found": "テストケースがありません",
|
||||
@@ -248,7 +248,8 @@
|
||||
"click_to_upload": "クリックしてアップロード",
|
||||
"or_drag_and_drop": "またはドラッグアンドドロップ",
|
||||
"max_file_size": "最大ファイルサイズ",
|
||||
"cases_imported": "テストケースがインポートされました"
|
||||
"cases_imported": "テストケースがインポートされました",
|
||||
"create_more": "さらに作成"
|
||||
},
|
||||
"Case": {
|
||||
"back_to_cases": "テストケース一覧に戻る",
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
"delete": "Excluir",
|
||||
"close": "Fechar",
|
||||
"are_you_sure": "Tem certeza de que deseja excluir os casos de teste?",
|
||||
"new_test_case": "Novo Caso de Teste",
|
||||
"new_test_case": "Novo",
|
||||
"export": "Exportar",
|
||||
"status": "Status",
|
||||
"no_cases_found": "Nenhum caso de teste encontrado",
|
||||
@@ -248,7 +248,8 @@
|
||||
"click_to_upload": "Clique para enviar",
|
||||
"or_drag_and_drop": " ou arraste e solte",
|
||||
"max_file_size": "Tamanho máx. do arquivo",
|
||||
"cases_imported": "Casos de teste importados"
|
||||
"cases_imported": "Casos de teste importados",
|
||||
"create_more": "Criar mais"
|
||||
},
|
||||
"Case": {
|
||||
"back_to_cases": "Voltar para os casos de teste",
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
'use client';
|
||||
import { useState } from 'react';
|
||||
import { Button, Input, Textarea, Modal, ModalContent, ModalHeader, ModalBody, ModalFooter } from '@heroui/react';
|
||||
import {
|
||||
Button,
|
||||
Input,
|
||||
Textarea,
|
||||
Modal,
|
||||
ModalContent,
|
||||
ModalHeader,
|
||||
ModalBody,
|
||||
ModalFooter,
|
||||
Switch,
|
||||
} from '@heroui/react';
|
||||
import { CasesMessages } from '@/types/case';
|
||||
|
||||
type Props = {
|
||||
isOpen: boolean;
|
||||
onCancel: () => void;
|
||||
onSubmit: (title: string, description: string) => void;
|
||||
onSubmit: (title: string, description: string, createMore: boolean) => void;
|
||||
messages: CasesMessages;
|
||||
};
|
||||
|
||||
@@ -23,6 +33,8 @@ export default function CaseDialog({ isOpen, onCancel, onSubmit, messages }: Pro
|
||||
errorMessage: '',
|
||||
});
|
||||
|
||||
const [createMore, setCreateMore] = useState(false);
|
||||
|
||||
const clear = () => {
|
||||
setCaseName({
|
||||
isValid: false,
|
||||
@@ -47,8 +59,23 @@ export default function CaseDialog({ isOpen, onCancel, onSubmit, messages }: Pro
|
||||
return;
|
||||
}
|
||||
|
||||
onSubmit(caseTitle.text, caseDescription.text);
|
||||
onSubmit(caseTitle.text, caseDescription.text, createMore);
|
||||
|
||||
if (!createMore) {
|
||||
clear();
|
||||
} else {
|
||||
// Reset form fields but keep dialog open
|
||||
setCaseName({
|
||||
isValid: false,
|
||||
text: 'Untitled Case',
|
||||
errorMessage: '',
|
||||
});
|
||||
setCaseDescription({
|
||||
isValid: false,
|
||||
text: '',
|
||||
errorMessage: '',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -88,9 +115,9 @@ export default function CaseDialog({ isOpen, onCancel, onSubmit, messages }: Pro
|
||||
/>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button variant="light" onPress={onCancel}>
|
||||
{messages.close}
|
||||
</Button>
|
||||
<Switch size="sm" isSelected={createMore} onValueChange={setCreateMore}>
|
||||
{messages.createMore}
|
||||
</Switch>
|
||||
<Button color="primary" onPress={validate}>
|
||||
{messages.create}
|
||||
</Button>
|
||||
|
||||
@@ -112,10 +112,12 @@ export default function CasesPane({
|
||||
|
||||
const closeDialog = () => setIsCaseDialogOpen(false);
|
||||
|
||||
const onSubmit = async (title: string, description: string) => {
|
||||
const onSubmit = async (title: string, description: string, createMore: boolean) => {
|
||||
const newCase = await createCase(context.token.access_token, folderId, title, description);
|
||||
setCases([...cases, newCase]);
|
||||
if (!createMore) {
|
||||
closeDialog();
|
||||
}
|
||||
};
|
||||
|
||||
const closeDeleteConfirmDialog = () => {
|
||||
|
||||
@@ -57,6 +57,7 @@ export default function Page({ params }: { params: { projectId: string; folderId
|
||||
orDragAndDrop: t('or_drag_and_drop'),
|
||||
maxFileSize: t('max_file_size'),
|
||||
casesImported: t('cases_imported'),
|
||||
createMore: t('create_more'),
|
||||
};
|
||||
|
||||
const priorityTranslation = useTranslations('Priority');
|
||||
|
||||
@@ -105,6 +105,7 @@ type CasesMessages = {
|
||||
orDragAndDrop: string;
|
||||
maxFileSize: string;
|
||||
casesImported: string;
|
||||
createMore: string;
|
||||
};
|
||||
|
||||
type CaseMessages = {
|
||||
|
||||
Reference in New Issue
Block a user