/* Login screen — hardcoded creds (configurable from Tweaks if needed) */ function LoginScreen({ onLogin, expectedUser, expectedPass }) { const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const [submitting, setSubmitting] = useState(false); const [error, setError] = useState(null); const userRef = useRef(null); useEffect(() => { userRef.current?.focus(); }, []); const submit = (e) => { e?.preventDefault(); if (submitting) return; setError(null); if (!username.trim() || !password) { setError("Username and password are required."); return; } setSubmitting(true); // Simulated auth round-trip setTimeout(() => { if (username === expectedUser && password === expectedPass) { onLogin(username); } else { setError(`Invalid credentials. Hint: both fields should be "${expectedUser}".`); setSubmitting(false); } }, 600); }; return (
Q QA Candidate Testing

Welcome

Sign in to start the automation assignment.

setUsername(e.target.value)} placeholder={expectedUser} />
setPassword(e.target.value)} placeholder="••••••" />
{error && (
{error}
)}
); } window.LoginScreen = LoginScreen;