test: add data-testid attributes to IdentityCheckOverlay and AdminOverlay

This commit is contained in:
2026-04-19 09:26:05 +03:00
parent b1ba912b68
commit c2edc4a704
2 changed files with 18 additions and 10 deletions

View File

@@ -60,7 +60,7 @@ const IdentityCheckOverlay = memo(({ show, users, onAuthenticated }: IdentityChe
};
return (
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4 bg-background/90 animate-in fade-in duration-500">
<div data-testid="identity-check-overlay" className="fixed inset-0 z-[100] flex items-center justify-center p-4 bg-background/90 animate-in fade-in duration-500">
<div className="bg-surface border border-slate-800 rounded-[2.5rem] p-8 sm:p-10 max-w-sm w-full shadow-2xl space-y-8 animate-in zoom-in-95 duration-300 relative overflow-hidden">
<div className="text-center space-y-3">
@@ -71,12 +71,13 @@ const IdentityCheckOverlay = memo(({ show, users, onAuthenticated }: IdentityChe
<p className="text-muted text-xs font-black">Select operator profile to initialize</p>
</div>
<div className="grid gap-3.5">
<div data-testid="user-list" className="grid gap-3.5">
{!selectedUserForLogin && !isEnterprise ? (
<>
{users.map(user => (
<button
key={user.id}
data-testid="user-list-item"
onClick={() => handleSelectUser(user)}
className="bg-slate-800/40 hover:bg-slate-800 border border-slate-800/50 hover:border-primary/40 p-5 rounded-[1.5rem] text-left transition-all group flex items-center justify-between shadow-sm active:scale-[0.98]"
>
@@ -108,7 +109,8 @@ const IdentityCheckOverlay = memo(({ show, users, onAuthenticated }: IdentityChe
<div className="space-y-5 animate-in slide-in-from-bottom-5 duration-300">
<div className="flex justify-between items-center px-1">
<p className="text-xs font-black text-secondary italic">LDAP Authentication</p>
<button
<button
data-testid="local-login-tab"
onClick={() => setIsEnterprise(false)}
className="text-xs font-black text-primary hover:underline tracking-tighter"
>
@@ -119,8 +121,9 @@ const IdentityCheckOverlay = memo(({ show, users, onAuthenticated }: IdentityChe
<div className="space-y-2">
<div className="relative group">
<User className="absolute left-5 top-1/2 -translate-y-1/2 text-secondary group-focus-within:text-primary transition-colors" size={18} />
<input
<input
ref={enterpriseUserRef}
data-testid="username-input"
type="text"
autoFocus
className="w-full bg-background/50 border border-slate-800/80 focus:border-primary/50 focus:bg-background rounded-[1.25rem] py-4.5 pl-14 pr-5 text-sm text-slate-100 focus:outline-none transition-all placeholder:text-slate-700 font-mono"
@@ -132,8 +135,9 @@ const IdentityCheckOverlay = memo(({ show, users, onAuthenticated }: IdentityChe
<div className="space-y-2">
<div className="relative group">
<Lock className="absolute left-5 top-1/2 -translate-y-1/2 text-secondary group-focus-within:text-primary transition-colors" size={18} />
<input
<input
ref={enterprisePassRef}
data-testid="password-input"
type="password"
onKeyDown={(e) => e.key === 'Enter' && handleLogin()}
className="w-full bg-background/50 border border-slate-800/80 focus:border-primary/50 focus:bg-background rounded-[1.25rem] py-4.5 pl-14 pr-5 text-sm text-slate-100 focus:outline-none transition-all placeholder:text-slate-700 font-mono"
@@ -142,7 +146,8 @@ const IdentityCheckOverlay = memo(({ show, users, onAuthenticated }: IdentityChe
</div>
</div>
<button
<button
data-testid="login-submit"
onClick={handleLogin}
className="w-full bg-primary text-white font-black py-5 rounded-[1.5rem] shadow-2xl shadow-primary/20 hover:shadow-primary/30 active:scale-95 transition-all text-xs border border-primary/20"
>
@@ -151,7 +156,7 @@ const IdentityCheckOverlay = memo(({ show, users, onAuthenticated }: IdentityChe
</div>
) : (
<div className="space-y-5 animate-in slide-in-from-bottom-5 duration-300">
<div className="bg-background/50 p-5 rounded-[1.5rem] border border-slate-800 flex items-center justify-between group">
<div data-testid="user-display" className="bg-background/50 p-5 rounded-[1.5rem] border border-slate-800 flex items-center justify-between group">
<div className="flex items-center gap-4">
<div className="w-10 h-10 rounded-2xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-lg">
<Shield size={20} />
@@ -173,8 +178,9 @@ const IdentityCheckOverlay = memo(({ show, users, onAuthenticated }: IdentityChe
<div className="space-y-2">
<div className="relative group">
<Lock className="absolute left-5 top-1/2 -translate-y-1/2 text-secondary group-focus-within:text-primary transition-colors" size={18} />
<input
<input
ref={localPassRef}
data-testid="local-password-input"
type="password"
autoFocus
onKeyDown={(e) => e.key === 'Enter' && handleLogin()}
@@ -184,7 +190,8 @@ const IdentityCheckOverlay = memo(({ show, users, onAuthenticated }: IdentityChe
</div>
</div>
<button
<button
data-testid="local-login-submit"
onClick={handleLogin}
className="w-full bg-primary text-white font-black py-5 rounded-[1.5rem] shadow-2xl shadow-primary/20 hover:shadow-primary/30 active:scale-95 transition-all text-xs border border-primary/20"
>