@@ -17,24 +17,27 @@ describe('Dashboard E2E', async () => {
1717 expect ( content ) . toBeTruthy ( )
1818 } )
1919
20- it ( 'Admin: redirects to login when unauthenticated' , async ( ) => {
21- const page = await createPage ( '/' )
22- // Should be redirected to /login
23- expect ( page . url ( ) ) . toContain ( '/login ')
24- const text = await page . textContent ( 'h2 ' )
25- expect ( text ) . toContain ( 'Sign in to your account ' )
20+ it ( 'Admin: redirects to home when unauthenticated' , async ( ) => {
21+ const page = await createPage ( '/dashboard ' )
22+ // Should be redirected to /
23+ await page . waitForURL ( url => url . pathname === '/ ')
24+ const text = await page . textContent ( 'h1 ' )
25+ expect ( text ) . toContain ( 'Nuxt Auto CRUD ' )
2626 } )
2727
2828 it ( 'Admin: can login and view dashboard' , async ( ) => {
29- const page = await createPage ( '/login' )
29+ const page = await createPage ( '/' )
30+
31+ // Open login modal
32+ await page . click ( 'button:has-text("Sign In")' )
3033
3134 // Fill login form
3235 await page . fill ( 'input[type="email"]' , 'admin@example.com' )
3336 await page . fill ( 'input[type="password"]' , '$1Password' )
3437 await page . click ( 'button[type="submit"]' )
3538
3639 // Wait for navigation to dashboard
37- await page . waitForURL ( url => url . pathname === '/' )
40+ await page . waitForURL ( url => url . pathname === '/dashboard ' )
3841
3942 // Check for dashboard specific element
4043 const text = await page . textContent ( 'header' )
0 commit comments