@@ -85,24 +85,31 @@ test('native key chords release held input even when dispatch fails', async () =
8585 }
8686} ) ;
8787
88- test ( 'native scrolling clips an oversized scroller to the window client viewport' , async ( ) => {
89- let scrolled = false ;
90- globalThis . browser = {
91- capabilities : { 'furn:features' : { wheel : true } } ,
92- getWindowRect : async ( ) => ( { x : 200 , y : 100 , width : 1000 , height : 700 } ) ,
93- getElementRect : async ( id ) =>
94- id === 'scroller' ? { x : 10 , y : 80 , width : 150 , height : 670 } : { x : 20 , y : scrolled ? 450 : 720 , width : 120 , height : 24 } ,
95- getWindowHandle : async ( ) => 'window' ,
96- switchToWindow : async ( handle ) => assert . equal ( handle , 'window' ) ,
97- async performActions ( ) {
98- scrolled = true ;
99- } ,
100- async waitUntil ( predicate ) {
101- assert . equal ( await predicate ( ) , true ) ;
102- } ,
103- } ;
104- await scrollNativeDesktopElement ( { elementId : 'button' , isDisplayed : async ( ) => true } , { elementId : 'scroller' } ) ;
105- assert . equal ( scrolled , true ) ;
88+ test ( 'native scrolling clips oversized scrollers and keeps click centers away from clip edges' , async ( ) => {
89+ for ( const [ scrollerHeight , targetY ] of [
90+ [ 670 , 720 ] ,
91+ [ 585 , 652 ] ,
92+ ] ) {
93+ let scrolled = false ;
94+ globalThis . browser = {
95+ capabilities : { 'furn:features' : { wheel : true } } ,
96+ getWindowRect : async ( ) => ( { x : 200 , y : 100 , width : 1000 , height : 700 } ) ,
97+ getElementRect : async ( id ) =>
98+ id === 'scroller'
99+ ? { x : 10 , y : 80 , width : 150 , height : scrollerHeight }
100+ : { x : 20 , y : scrolled ? 450 : targetY , width : 120 , height : 24 } ,
101+ getWindowHandle : async ( ) => 'window' ,
102+ switchToWindow : async ( handle ) => assert . equal ( handle , 'window' ) ,
103+ async performActions ( ) {
104+ scrolled = true ;
105+ } ,
106+ async waitUntil ( predicate ) {
107+ assert . equal ( await predicate ( ) , true ) ;
108+ } ,
109+ } ;
110+ await scrollNativeDesktopElement ( { elementId : 'button' , isDisplayed : async ( ) => true } , { elementId : 'scroller' } ) ;
111+ assert . equal ( scrolled , true ) ;
112+ }
106113} ) ;
107114
108115test ( 'negative disabled-control clicks use physical input and release it on failure' , async ( ) => {
@@ -132,3 +139,51 @@ test('negative disabled-control clicks use physical input and release it on fail
132139 assert . equal ( released , true ) ;
133140 }
134141} ) ;
142+
143+ test ( 'hosted macOS navigation uses keyboard only when physical clicks are explicitly disabled' , async ( ) => {
144+ for ( const physicalClick of [ false , true , undefined ] ) {
145+ const page = new BasePage ( ) ;
146+ page . platform = 'macos' ;
147+ const inputs = [ ] ;
148+ const button = {
149+ elementId : 'page' ,
150+ isDisplayed : async ( ) => true ,
151+ isEnabled : async ( ) => true ,
152+ click : async ( ) => inputs . push ( 'click' ) ,
153+ } ;
154+ Object . defineProperties ( page , {
155+ _pageButton : { value : button } ,
156+ _testPageButtonScrollViewer : { value : { elementId : 'scroller' } } ,
157+ } ) ;
158+ page . waitForPageToLoad = async ( ) => true ;
159+ globalThis . browser = {
160+ capabilities : { browserName : 'furn-native-desktop' , 'furn:features' : { physicalClick, keyboard : true } } ,
161+ getWindowRect : async ( ) => ( { x : 8 , y : 32 , width : 1000 , height : 680 } ) ,
162+ getElementRect : async ( ) => ( { x : 10 , y : 80 , width : 140 , height : 30 } ) ,
163+ async elementSendKeys ( id , text ) {
164+ assert . equal ( id , 'page' ) ;
165+ assert . equal ( text , '' ) ;
166+ inputs . push ( 'focus' ) ;
167+ } ,
168+ async performActions ( [ source ] ) {
169+ assert . deepEqual ( source . actions , [
170+ { type : 'keyDown' , value : Keys . SPACE } ,
171+ { type : 'keyUp' , value : Keys . SPACE } ,
172+ ] ) ;
173+ inputs . push ( 'space' ) ;
174+ } ,
175+ async releaseActions ( ) {
176+ inputs . push ( 'release' ) ;
177+ } ,
178+ } ;
179+ assert . equal ( await page . navigateToPageAndLoadTests ( ) , true ) ;
180+ assert . deepEqual ( inputs , physicalClick === false ? [ 'focus' , 'space' , 'release' ] : [ 'click' ] ) ;
181+ if ( physicalClick === false ) {
182+ browser . capabilities [ 'furn:features' ] . keyboard = false ;
183+ await assert . rejects ( page . navigateToPageAndLoadTests ( ) , / d o e s n o t s u p p o r t k e y b o a r d n a v i g a t i o n / ) ;
184+ button . isEnabled = async ( ) => false ;
185+ assert . equal ( await page . navigateToPageAndLoadTests ( ) , true ) ;
186+ assert . deepEqual ( inputs , [ 'focus' , 'space' , 'release' ] ) ;
187+ }
188+ }
189+ } ) ;
0 commit comments