@@ -2023,35 +2023,52 @@ try {
20232023 assert . equal ( manual . length , 1 )
20242024 assert ( manual [ 0 ] . text . includes ( 'ORCHID-482' ) && ! manual [ 0 ] . text . includes ( 'JADE-231' ) )
20252025
2026- await openScenario ( target , `${ org ? 'organization' : 'workspace' } -denied` )
2027- await expect ( input ( ) ) . toBeVisible ( )
2028- await restricted . bringToFront ( )
2029- const draft = 'Keep this draft if access is unavailable'
2030- await input ( ) . fill ( draft )
2031- count = received . length
2032- phase = 'denied-send'
2033- await input ( ) . press ( 'Enter' )
2034- await expect (
2035- shell . getByRole ( 'button' , { name : 'Request site access' , exact : true } )
2036- ) . toBeEnabled ( )
2037- await expect ( input ( ) ) . toHaveValue ( draft )
2038- assert . equal ( received . length , count )
2039- await screenshot ( `reference-${ org ? 'organization' : 'workspace' } -denied` )
2040- const accessNotice = await shell
2041- . getByRole ( 'status' )
2042- . first ( )
2043- . evaluate ( ( status ) => status . firstChild ?. textContent ?. trim ( ) )
2044- assert ( accessNotice )
2045- assert . equal (
2046- await frame ( ) . getByText ( accessNotice , { exact : true } ) . count ( ) ,
2047- 0 ,
2048- 'Access guidance covered the composer twice'
2049- )
2050- await setReference ( false )
2051- phase = 'opt-out-send'
2052- await input ( ) . press ( 'Enter' )
2053- await expect . poll ( ( ) => received . length ) . toBe ( count + 1 )
2054- assert . equal ( submittedPages ( received [ count ] ) . length , 0 )
2026+ for ( const gesture of [ 'keyboard' , 'mouse' ] as const ) {
2027+ await openScenario ( target , `${ org ? 'organization' : 'workspace' } -denied-${ gesture } ` )
2028+ await expect ( input ( ) ) . toBeVisible ( )
2029+ await restricted . bringToFront ( )
2030+ const draft = 'Keep this draft if access is unavailable'
2031+ await input ( ) . fill ( draft )
2032+ count = received . length
2033+ phase = `denied-${ gesture } -send`
2034+ if ( gesture === 'keyboard' ) await input ( ) . press ( 'Enter' )
2035+ else
2036+ await frame ( )
2037+ . getByRole ( 'button' , { name : org ? 'Send' : 'Send message' , exact : true } )
2038+ . click ( )
2039+ await expect (
2040+ shell . getByRole ( 'button' , { name : 'Request site access' , exact : true } )
2041+ ) . toBeEnabled ( )
2042+ await expect ( input ( ) ) . toHaveValue ( draft )
2043+ await expect
2044+ . poll ( ( ) => input ( ) . evaluate ( ( element ) => Boolean ( element . closest ( '[inert]' ) ) ) )
2045+ . toBe ( false )
2046+ assert . equal ( received . length , count )
2047+ assert (
2048+ await frame ( ) . evaluate ( ( ) => document . hasFocus ( ) ) ,
2049+ `The denied ${ gesture } send must keep the chat document focused`
2050+ )
2051+ await expect ( input ( ) ) . toBeFocused ( )
2052+ await shell . keyboard . type ( ' Continue typing after the denied capture.' )
2053+ await expect ( input ( ) ) . toHaveValue ( `${ draft } Continue typing after the denied capture.` )
2054+ assert . equal ( received . length , count )
2055+ await screenshot ( `reference-${ org ? 'organization' : 'workspace' } -denied-${ gesture } ` )
2056+ const accessNotice = await shell
2057+ . getByRole ( 'status' )
2058+ . first ( )
2059+ . evaluate ( ( status ) => status . firstChild ?. textContent ?. trim ( ) )
2060+ assert ( accessNotice )
2061+ assert . equal (
2062+ await frame ( ) . getByText ( accessNotice , { exact : true } ) . count ( ) ,
2063+ 0 ,
2064+ 'Access guidance covered the composer twice'
2065+ )
2066+ await setReference ( false )
2067+ phase = 'opt-out-send'
2068+ await input ( ) . press ( 'Enter' )
2069+ await expect . poll ( ( ) => received . length ) . toBe ( count + 1 )
2070+ assert . equal ( submittedPages ( received [ count ] ) . length , 0 )
2071+ }
20552072 }
20562073 } finally {
20572074 await browserContext . unroute ( endpoint )
0 commit comments