@@ -35,6 +35,26 @@ test.describe('Search Pages', () => {
3535 await expect ( page . locator ( 'input[type="search"]' ) ) . toBeFocused ( )
3636 } )
3737
38+ test ( '/ (homepage) → search, keeps focus on search input' , async ( { page, goto } ) => {
39+ await goto ( '/' , { waitUntil : 'domcontentloaded' } )
40+
41+ const homeSearchInput = page . locator ( '#home-search' )
42+ await homeSearchInput . click ( )
43+ await page . keyboard . type ( 'vue' )
44+
45+ // Wait for navigation to /search (debounce is 250ms)
46+ await expect ( page ) . toHaveURL ( / \/ s e a r c h / , { timeout : 10000 } )
47+ await expect ( page . locator ( 'text=/found \\d+/i' ) ) . toBeVisible ( { timeout : 15000 } )
48+
49+ // Home search input should be gone (we're on /search now)
50+ await expect ( homeSearchInput ) . not . toBeVisible ( )
51+
52+ // Header search input should now exist and be focused
53+ const headerSearchInput = page . locator ( '#header-search' )
54+ await expect ( headerSearchInput ) . toBeVisible ( )
55+ await expect ( headerSearchInput ) . toBeFocused ( )
56+ } )
57+
3858 test ( '/settings → search, keeps focus on search input' , async ( { page, goto } ) => {
3959 await goto ( '/settings' , { waitUntil : 'domcontentloaded' } )
4060
@@ -43,7 +63,7 @@ test.describe('Search Pages', () => {
4363
4464 await page . waitForLoadState ( 'domcontentloaded' )
4565
46- await expect ( page . locator ( 'text=/found \\d+/i' ) ) . toBeVisible ( )
66+ await expect ( page . locator ( 'text=/found \\d+/i' ) ) . toBeVisible ( { timeout : 15000 } )
4767
4868 await expect ( searchInput ) . toBeFocused ( )
4969 } )
0 commit comments