@@ -282,13 +282,28 @@ story("restores the current URL each time the same submitted navigation is block
282282 await address . press ( "Enter" )
283283 await expect ( address ) . toHaveValue ( "https://blocked.example/" )
284284 await root . getByRole ( "button" , { name : "Block navigation" , exact : true } ) . click ( )
285- await expect ( root . getByRole ( "alert" ) ) . toHaveText ( "Request failed " )
285+ await expect ( root . getByRole ( "alert" ) ) . toHaveText ( "Only web pages can open here. " )
286286 await expect ( address ) . toHaveValue ( "https://alpha.example/" )
287287 await expect ( root . getByTestId ( "native-Alpha" ) ) . toHaveAttribute ( "data-visible" , "true" )
288288 } )
289289 }
290290} )
291291
292+ story ( "explains why a typed address cannot open instead of searching for it" , async ( { page } ) => {
293+ const root = page . getByTestId ( "browser-pane-fixture" )
294+ const address = root . getByRole ( "combobox" , { name : "Browser address" , exact : true } )
295+
296+ for ( const [ typed , reason ] of [
297+ [ "ftp://example.com" , "Only web pages can open here." ] ,
298+ [ "https://user:[email protected] " , "Addresses with a user name or password can't open here." ] , 299+ ] ) {
300+ await address . fill ( typed )
301+ await address . press ( "Enter" )
302+ await expect ( root . getByRole ( "alert" ) ) . toHaveText ( reason )
303+ await expect ( address ) . toHaveValue ( "https://alpha.example/" )
304+ }
305+ } )
306+
292307story ( "shows a themed failure state for only the failed tab and allows retry" , async ( { page } ) => {
293308 const root = page . getByTestId ( "browser-pane-fixture" )
294309 await root . getByRole ( "button" , { name : "Failed page" , exact : true } ) . click ( )
@@ -435,6 +450,9 @@ story("suggests visited pages and opens the first one that completes the typed a
435450 const options = page . getByRole ( "option" )
436451 await expect ( options ) . toHaveCount ( 1 )
437452 await expect ( options . first ( ) ) . toHaveAttribute ( "aria-selected" , "true" )
453+ // Arrow keys that pick IME candidates leave the suggestions alone.
454+ await address . dispatchEvent ( "keydown" , { key : "ArrowDown" , isComposing : true } )
455+ await expect ( options . first ( ) ) . toHaveAttribute ( "aria-selected" , "true" )
438456 await address . press ( "Enter" )
439457 await expect ( address ) . toHaveValue ( "http://localhost:5173/settings" )
440458
@@ -451,14 +469,39 @@ story("suggests visited pages and opens the first one that completes the typed a
451469
452470story ( "lists recent pages on a blank tab and opens one" , async ( { page } ) => {
453471 const root = page . getByTestId ( "browser-pane-fixture" )
472+ const address = root . getByRole ( "combobox" , { name : "Browser address" , exact : true } )
454473 await root . getByRole ( "button" , { name : "Seed history" , exact : true } ) . click ( )
455474 await root . getByRole ( "button" , { name : "Blank page" , exact : true } ) . click ( )
456475 await expect ( root . getByText ( "Recent" , { exact : true } ) ) . toBeVisible ( )
476+ // The globe at the field's start belongs to the field: a click there focuses it.
477+ await expect ( address ) . not . toBeFocused ( )
478+ await root . locator ( '[data-component="browser-address"]' ) . click ( { position : { x : 16 , y : 14 } } )
479+ await expect ( address ) . toBeFocused ( )
480+ await address . blur ( )
481+
457482 await root . getByRole ( "button" , { name : / ^ S e t t i n g s - P r e v i e w / } ) . click ( )
458- await expect ( root . getByRole ( "combobox" , { name : "Browser address" , exact : true } ) ) . toHaveValue (
459- "http://localhost:5173/settings" ,
460- )
483+ await expect ( address ) . toHaveValue ( "http://localhost:5173/settings" )
461484 await expect ( root . getByTestId ( "native-Alpha" ) ) . toHaveAttribute ( "data-visible" , "true" )
485+ // The opened page owns the field afterwards: an edit that is never submitted shows its URL again.
486+ await address . click ( )
487+ await address . fill ( "unsubmitted" )
488+ await address . blur ( )
489+ await expect ( address ) . toHaveValue ( "http://localhost:5173/settings" )
490+ } )
491+
492+ story ( "adds the whole page to the session and keeps the draft when the button is pressed again" , async ( { page } ) => {
493+ const root = page . getByTestId ( "browser-pane-fixture" )
494+ const field = root . locator ( '[data-component="browser-address"]' )
495+ const add = root . getByRole ( "button" , { name : "Add page to session" , exact : true } )
496+ await field . hover ( )
497+ await add . click ( )
498+ const editor = root . locator ( '[data-slot="browser-comment-editor"] textarea' )
499+ await editor . fill ( "Check the header layout" )
500+ await field . hover ( )
501+ await add . click ( )
502+ await expect ( editor ) . toHaveValue ( "Check the header layout" )
503+ await editor . press ( "Enter" )
504+ await expect ( root . getByTestId ( "fixture-comments" ) . getByRole ( "listitem" ) ) . toHaveText ( [ / : C h e c k t h e h e a d e r l a y o u t $ / ] )
462505} )
463506
464507story ( "focuses the address field when the page uses the address shortcut" , async ( { page } ) => {
@@ -478,12 +521,22 @@ story("shows the page's cookies in the site information and clears them", async
478521 await expect ( site ) . toContainText ( "0 cookies in use" )
479522} )
480523
481- story ( "zooms the page from the browser options and shows its zoom" , async ( { page } ) => {
524+ story ( "zooms the page from the browser options in view and keeps its zoom in the address field " , async ( { page } ) => {
482525 const root = page . getByTestId ( "browser-pane-fixture" )
483- await root . getByRole ( "button" , { name : "Browser options" , exact : true } ) . click ( )
526+ const options = root . getByRole ( "button" , { name : "Browser options" , exact : true } )
527+ await options . click ( )
484528 await page . getByRole ( "menuitem" , { name : / ^ Z o o m i n / } ) . click ( )
485529 await expect ( root . getByText ( "Zoom: 110" , { exact : true } ) ) . toBeVisible ( )
530+ // The menu covered the page with a still; it closes so the zoomed page shows at once.
531+ await expect ( page . getByRole ( "menu" ) ) . toBeHidden ( )
532+ await expect ( root . getByTestId ( "native-Alpha" ) ) . toHaveAttribute ( "data-visible" , "true" )
533+
534+ const zoom = root . getByRole ( "button" , { name : "110%" , exact : true } )
535+ await expect ( zoom ) . toBeVisible ( )
536+ await options . click ( )
486537 await expect ( page . getByRole ( "menuitem" , { name : / ^ R e s e t z o o m / } ) ) . toContainText ( "110%" )
487- await page . getByRole ( "menuitem" , { name : / ^ R e s e t z o o m / } ) . click ( )
538+ await page . keyboard . press ( "Escape" )
539+ await zoom . click ( )
488540 await expect ( root . getByText ( "Zoom: 100" , { exact : true } ) ) . toBeVisible ( )
541+ await expect ( zoom ) . toBeHidden ( )
489542} )
0 commit comments