test: add data-testid attributes to login page for E2E tests
This commit is contained in:
@@ -79,7 +79,7 @@ export default function LoginPage() {
|
||||
if (!mounted) return null;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex items-center justify-center p-4">
|
||||
<div data-testid="identity-check-overlay" className="min-h-screen bg-background flex items-center justify-center p-4">
|
||||
<Toaster position="top-center" />
|
||||
|
||||
<div className="bg-surface border border-slate-800 rounded-3xl p-8 max-w-sm w-full shadow-2xl space-y-8 animate-in fade-in zoom-in duration-500">
|
||||
@@ -91,7 +91,7 @@ export default function LoginPage() {
|
||||
<p className="text-muted text-sm">Select operator profile or use direct login</p>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-3">
|
||||
<div data-testid="user-list" className="grid gap-3">
|
||||
{!selectedUserForLogin && !isEnterprise ? (
|
||||
<>
|
||||
{users.length > 0 ? (
|
||||
@@ -99,6 +99,7 @@ export default function LoginPage() {
|
||||
{users.map(user => (
|
||||
<button
|
||||
key={user.id}
|
||||
data-testid="user-list-item"
|
||||
onClick={() => handleSelectUser(user)}
|
||||
className="bg-slate-800/50 hover:bg-slate-800 border border-slate-800 hover:border-primary/40 p-4 rounded-2xl text-left transition-all group flex items-center justify-between"
|
||||
>
|
||||
@@ -123,6 +124,7 @@ export default function LoginPage() {
|
||||
|
||||
<div className="pt-2 grid grid-cols-2 gap-3">
|
||||
<button
|
||||
data-testid="local-login-tab"
|
||||
onClick={() => setIsEnterprise(true)}
|
||||
className="flex items-center justify-center gap-2 py-4 rounded-2xl border border-dashed border-slate-700 text-muted hover:text-white hover:border-slate-500 transition-all font-bold text-xs"
|
||||
>
|
||||
@@ -157,8 +159,9 @@ export default function LoginPage() {
|
||||
<label className="text-xs font-black text-muted px-1">Username</label>
|
||||
<div className="relative">
|
||||
<User className="absolute left-4 top-1/2 -translate-y-1/2 text-muted" size={16} />
|
||||
<input
|
||||
<input
|
||||
ref={enterpriseUserRef}
|
||||
data-testid="username-input"
|
||||
type="text"
|
||||
autoFocus
|
||||
className="w-full bg-slate-800/50 border border-slate-800 focus:border-primary rounded-2xl py-4 pl-12 pr-4 text-white focus:outline-none transition-all placeholder:text-slate-700 font-mono"
|
||||
@@ -171,8 +174,9 @@ export default function LoginPage() {
|
||||
<label className="text-xs font-black text-muted px-1">Password</label>
|
||||
<div className="relative">
|
||||
<Lock className="absolute left-4 top-1/2 -translate-y-1/2 text-muted" size={16} />
|
||||
<input
|
||||
<input
|
||||
ref={enterprisePassRef}
|
||||
data-testid="password-input"
|
||||
type="password"
|
||||
onKeyDown={(e) => e.key === 'Enter' && handleLogin()}
|
||||
className="w-full bg-slate-800/50 border border-slate-800 focus:border-primary rounded-2xl py-4 pl-12 pr-4 text-white/50 focus:text-white focus:outline-none transition-all placeholder:text-slate-700 font-mono"
|
||||
@@ -181,7 +185,8 @@ export default function LoginPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button
|
||||
data-testid="login-submit"
|
||||
onClick={handleLogin}
|
||||
className="w-full bg-primary text-white font-black py-4 rounded-2xl shadow-xl shadow-primary/20 active:scale-95 transition-all"
|
||||
>
|
||||
@@ -223,8 +228,9 @@ export default function LoginPage() {
|
||||
<label className="text-xs font-black text-muted px-1">Password</label>
|
||||
<div className="relative">
|
||||
<Lock className="absolute left-4 top-1/2 -translate-y-1/2 text-muted" size={16} />
|
||||
<input
|
||||
<input
|
||||
ref={localPassRef}
|
||||
data-testid="local-password-input"
|
||||
type="password"
|
||||
autoFocus
|
||||
onKeyDown={(e) => e.key === 'Enter' && handleLogin()}
|
||||
@@ -234,7 +240,8 @@ export default function LoginPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
<button
|
||||
data-testid="local-login-submit"
|
||||
onClick={handleLogin}
|
||||
className="w-full bg-primary text-white font-black py-4 rounded-2xl shadow-xl shadow-primary/20 active:scale-95 transition-all"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user