@@ -24,7 +24,6 @@ test.use({ storageState: { cookies: [], origins: [] } });
2424
2525test ( 'can auth with admin key' , { tag : '@auth' } , async ( { page } ) => {
2626 const settingsModal = page . getByRole ( 'dialog' , { name : 'Settings' } ) ;
27- // PasswordInput renders as a textbox with type="password"
2827 const adminKeyInput = page . getByLabel ( 'Admin Key' ) ;
2928 const failedMsg = page . getByText ( 'failed to check token' ) ;
3029
@@ -65,3 +64,40 @@ test('can auth with admin key', { tag: '@auth' }, async ({ page }) => {
6564 await expect ( failedMsg ) . toBeHidden ( ) ;
6665 } ) ;
6766} ) ;
67+
68+ test ( 'password input can toggle visibility' , { tag : '@auth' } , async ( { page } ) => {
69+ const settingsModal = page . getByRole ( 'dialog' , { name : 'Settings' } ) ;
70+ const adminKeyInput = page . getByLabel ( 'Admin Key' ) ;
71+ const testPassword = 'test-admin-key-12345' ;
72+
73+ await expect ( settingsModal ) . toBeVisible ( ) ;
74+
75+ await test . step ( 'verify password input is initially masked' , async ( ) => {
76+ await adminKeyInput . fill ( testPassword ) ;
77+
78+ await expect ( adminKeyInput ) . toHaveAttribute ( 'type' , 'password' ) ;
79+ } ) ;
80+
81+ await test . step ( 'reveal password by clicking visibility toggle' , async ( ) => {
82+ // Mantine PasswordInput has a button with class mantine-PasswordInput-visibilityToggle
83+ const toggleButton = settingsModal . locator (
84+ '.mantine-PasswordInput-visibilityToggle'
85+ ) ;
86+
87+ await toggleButton . click ( ) ;
88+
89+ await expect ( adminKeyInput ) . toHaveAttribute ( 'type' , 'text' ) ;
90+ await expect ( adminKeyInput ) . toHaveValue ( testPassword ) ;
91+ } ) ;
92+
93+ await test . step ( 'hide password by clicking visibility toggle again' , async ( ) => {
94+ const toggleButton = settingsModal . locator (
95+ '.mantine-PasswordInput-visibilityToggle'
96+ ) ;
97+
98+ await toggleButton . click ( ) ;
99+
100+ await expect ( adminKeyInput ) . toHaveAttribute ( 'type' , 'password' ) ;
101+ await expect ( adminKeyInput ) . toHaveValue ( testPassword ) ;
102+ } ) ;
103+ } ) ;
0 commit comments