test: add data-testid attributes to admin sub-components and modals

This commit is contained in:
2026-04-19 09:28:27 +03:00
parent cbfe6a22be
commit 1846bb3cb3
6 changed files with 26 additions and 12 deletions

View File

@@ -32,7 +32,7 @@ export default function AiManager({
onUpdatePrompt
}: AiManagerProps) {
return (
<section className="bg-surface/50 border border-slate-800/50 rounded-[2.5rem] p-5 md:p-8 shadow-2xl space-y-6 transition-all group/ai">
<section data-testid="ai-config" className="bg-surface/50 border border-slate-800/50 rounded-[2.5rem] p-5 md:p-8 shadow-2xl space-y-6 transition-all group/ai">
<div className="flex items-center justify-between mb-2">
<div className="flex items-center gap-4">
<div className="w-10 h-10 rounded-xl bg-primary/10 flex items-center justify-center text-primary border border-primary/20">
@@ -46,6 +46,7 @@ export default function AiManager({
{aiConfig?.providers?.map((p: any) => (
<button
key={p.id}
data-testid="provider-option"
onClick={() => handleUpdateAiProvider(p.id)}
className={cn(
"p-4 rounded-2xl border transition-all text-left flex items-center justify-between group",
@@ -91,6 +92,7 @@ export default function AiManager({
<button
onClick={onSaveAiKeys}
disabled={isSavingKeys}
data-testid="save-settings-button"
className="px-6 py-2.5 bg-primary hover:bg-primary text-white rounded-xl text-sm font-black transition-all active:scale-95 shadow-xl shadow-primary/10 tracking-tight border border-primary/30 flex items-center gap-2"
>
{isSavingKeys ? <RotateCcw size={14} className="animate-spin" /> : <Lock size={14} />}
@@ -103,6 +105,7 @@ export default function AiManager({
<label className="text-sm font-bold text-secondary tracking-tight ml-1">Gemini Api Key</label>
<div className="flex gap-2">
<input
data-testid="ai-api-key-input"
type="password"
value={aiKeys.gemini}
onChange={(e) => setAiKeys({...aiKeys, gemini: e.target.value})}
@@ -128,6 +131,7 @@ export default function AiManager({
<label className="text-sm font-bold text-secondary tracking-tight ml-1">Claude Api Key</label>
<div className="flex gap-2">
<input
data-testid="ai-api-key-input"
type="password"
value={aiKeys.claude}
onChange={(e) => setAiKeys({...aiKeys, claude: e.target.value})}