@@ -872,25 +872,28 @@ describeBrowserLayout.concurrent("chat responsive browser layout", () => {
872872 </body></html>` ,
873873 ) ;
874874
875- const styles = await page . evaluate ( ( ) => {
876- const dropdown = document . querySelector < HTMLElement > ( ".chat-pane__gateway-menu" ) ! ;
877- const menu = dropdown . shadowRoot ! . querySelector < HTMLElement > ( '[part="menu"]' ) ! ;
878- const item = dropdown . querySelector < HTMLElement > ( ".chat-pane__gateway-menu-item" ) ! ;
879- const menuStyle = getComputedStyle ( menu ) ;
880- const itemStyle = getComputedStyle ( item ) ;
881- return {
882- menu : {
883- borderRadius : menuStyle . borderRadius ,
884- padding : menuStyle . padding ,
885- } ,
886- item : {
887- borderRadius : itemStyle . borderRadius ,
888- fontSize : itemStyle . fontSize ,
889- minHeight : itemStyle . minHeight ,
890- padding : itemStyle . padding ,
891- } ,
892- } ;
893- } ) ;
875+ const readGatewayMenuStyles = ( ) =>
876+ page . evaluate ( ( ) => {
877+ const dropdown = document . querySelector < HTMLElement > ( ".chat-pane__gateway-menu" ) ! ;
878+ const menu = dropdown . shadowRoot ! . querySelector < HTMLElement > ( '[part="menu"]' ) ! ;
879+ const item = dropdown . querySelector < HTMLElement > ( ".chat-pane__gateway-menu-item" ) ! ;
880+ const menuStyle = getComputedStyle ( menu ) ;
881+ const itemStyle = getComputedStyle ( item ) ;
882+ return {
883+ menu : {
884+ borderRadius : menuStyle . borderRadius ,
885+ padding : menuStyle . padding ,
886+ } ,
887+ item : {
888+ borderRadius : itemStyle . borderRadius ,
889+ fontSize : itemStyle . fontSize ,
890+ minHeight : itemStyle . minHeight ,
891+ padding : itemStyle . padding ,
892+ } ,
893+ } ;
894+ } ) ;
895+
896+ const styles = await readGatewayMenuStyles ( ) ;
894897
895898 expect ( styles ) . toEqual ( {
896899 menu : { borderRadius : "10px" , padding : "4px" } ,
@@ -901,6 +904,22 @@ describeBrowserLayout.concurrent("chat responsive browser layout", () => {
901904 padding : "0px 8px" ,
902905 } ,
903906 } ) ;
907+
908+ const session = await page . context ( ) . newCDPSession ( page ) ;
909+ try {
910+ await session . send ( "Emulation.setTouchEmulationEnabled" , {
911+ enabled : true ,
912+ maxTouchPoints : 1 ,
913+ } ) ;
914+ await session . send ( "Emulation.setEmulatedMedia" , {
915+ media : "screen" ,
916+ features : [ { name : "pointer" , value : "coarse" } ] ,
917+ } ) ;
918+ expect ( await page . evaluate ( ( ) => matchMedia ( "(pointer: coarse)" ) . matches ) ) . toBe ( true ) ;
919+ expect ( ( await readGatewayMenuStyles ( ) ) . item . minHeight ) . toBe ( "44px" ) ;
920+ } finally {
921+ await session . detach ( ) ;
922+ }
904923 } finally {
905924 await closeBrowserPage ( page ) ;
906925 }
0 commit comments