@@ -72,6 +72,15 @@ const documentResponses: {
7272 status : number
7373 headers : Record < string , string >
7474} [ ] = [ ]
75+ let deniedDocument : {
76+ url : string
77+ status : number
78+ bytes : number
79+ suspenseTemplates : string [ ]
80+ suspenseMarkers : string [ ]
81+ suspenseInstructions : string [ ]
82+ robots : string [ ]
83+ } | null = null
7584let browserErrorCount = 0
7685let browserErrorEventCount = 0
7786let currentCheck = 'Setup'
@@ -732,7 +741,27 @@ try {
732741 await expect ( page . getByRole ( 'navigation' , { name : 'Search views' } ) ) . toHaveCount ( 0 )
733742 } )
734743 await check ( 'Assistant history rejects a chat from another organization' , async ( ) => {
735- await page . goto ( `${ baseUrl . origin } ${ root } /search/chat/${ deniedChatId } ` )
744+ const documentResponse = await page . goto ( `${ baseUrl . origin } ${ root } /search/chat/${ deniedChatId } ` )
745+ assert ( documentResponse , 'The denied chat navigation must return a document' )
746+ const html = await documentResponse . text ( )
747+ deniedDocument = {
748+ url : documentResponse . url ( ) ,
749+ status : documentResponse . status ( ) ,
750+ bytes : new TextEncoder ( ) . encode ( html ) . byteLength ,
751+ suspenseTemplates : ( html . match ( / < t e m p l a t e \b [ ^ > ] * > / g) ?? [ ] )
752+ . slice ( 0 , DIAGNOSTIC_LIMITS . templates )
753+ . map ( ( tag ) => truncate ( tag , DIAGNOSTIC_LIMITS . text ) ) ,
754+ suspenseMarkers : ( html . match ( / < ! - - \/ ? \$ [ ^ > ] * - - > / g) ?? [ ] )
755+ . slice ( 0 , DIAGNOSTIC_LIMITS . samples )
756+ . map ( ( marker ) => truncate ( marker , DIAGNOSTIC_LIMITS . text ) ) ,
757+ suspenseInstructions : ( html . match ( / \$ (?: R X | R C ) \( [ ^ < ] * ?\) / g) ?? [ ] )
758+ . slice ( 0 , DIAGNOSTIC_LIMITS . templates )
759+ . map ( ( instruction ) => truncate ( instruction , DIAGNOSTIC_LIMITS . text ) ) ,
760+ robots : ( html . match ( / < m e t a \b [ ^ > ] * > / g) ?? [ ] )
761+ . filter ( ( tag ) => / n a m e = [ " ' ] r o b o t s [ " ' ] / . test ( tag ) )
762+ . slice ( 0 , DIAGNOSTIC_LIMITS . templates )
763+ . map ( ( tag ) => truncate ( tag , DIAGNOSTIC_LIMITS . text ) ) ,
764+ }
736765 await expect ( page . getByRole ( 'heading' , { name : 'Page not found' } ) ) . toBeVisible ( )
737766 const response = await page . request . get (
738767 `${ baseUrl . origin } /api/mothership/chats/${ deniedChatId } `
@@ -819,6 +848,7 @@ try {
819848 browserErrorEventCount,
820849 browserErrorEvents,
821850 documentResponses,
851+ deniedDocument,
822852 artifactDirectory,
823853 } ,
824854 null ,
0 commit comments