@@ -1018,6 +1018,49 @@ it.live(
10181018 ) . pipe ( Effect . provide ( layer ) ) ,
10191019) ;
10201020
1021+ it . effect ( "a navigation that fails while a load reads its title keeps its failure" , ( ) =>
1022+ Effect . scoped (
1023+ Effect . gen ( function * ( ) {
1024+ const { tabId } = yield * ready ;
1025+ const manager = yield * Manager . PreviewManager ;
1026+ const events = yield * manager . subscribeEvents ;
1027+ const page = contexts [ 0 ] ! . page ;
1028+ const heldTitle = Promise . withResolvers < string > ( ) ;
1029+ page . title . mockImplementationOnce ( ( ) => heldTitle . promise ) ;
1030+ yield * Effect . promise ( ( ) => page . goto ( "https://example.com/first" ) ) ;
1031+ const failing = {
1032+ url : ( ) => "https://example.com/missing" ,
1033+ method : ( ) => "GET" ,
1034+ isNavigationRequest : ( ) => true ,
1035+ frame : ( ) => page ,
1036+ failure : ( ) => ( { errorText : "net::ERR_NAME_NOT_RESOLVED" } ) ,
1037+ } ;
1038+ page . emit ( "request" , failing ) ;
1039+ page . emit ( "requestfailed" , failing ) ;
1040+ heldTitle . resolve ( "Held" ) ;
1041+ // A load at the same await depth reports after the held one, so its Success marks the end.
1042+ page . emit ( "load" ) ;
1043+
1044+ const statuses : Array < string > = [ ] ;
1045+ while ( ! statuses . at ( - 1 ) ?. startsWith ( "Success" ) ) {
1046+ const event = yield * PubSub . take ( events ) ;
1047+ if ( event . type === "failed" && event . tabId === tabId ) {
1048+ statuses . push ( `LoadFailed ${ event . url } ` ) ;
1049+ } else if ( event . type === "navigated" && event . tabId === tabId ) {
1050+ const status = event . snapshot . navStatus ;
1051+ if ( status . _tag === "Success" ) statuses . push ( `Success ${ status . title } ` ) ;
1052+ else if ( status . _tag === "Loading" ) statuses . push ( `Loading ${ status . url } ` ) ;
1053+ }
1054+ }
1055+ expect ( statuses ) . toEqual ( [
1056+ "Loading https://example.com/missing" ,
1057+ "LoadFailed https://example.com/missing" ,
1058+ "Success test page" ,
1059+ ] ) ;
1060+ } ) ,
1061+ ) . pipe ( Effect . provide ( layer ) ) ,
1062+ ) ;
1063+
10211064it . effect . each ( [
10221065 {
10231066 name : "hover burst before a click" ,
0 commit comments