@@ -43,6 +43,10 @@ const renderOptions = (page: string) => {
4343}
4444
4545describe ( '<Drilldown/>' , ( ) => {
46+ beforeEach ( ( ) => {
47+ cy . get ( 'body' ) . realMouseMove ( 0 , 0 , { position : 'bottomRight' } )
48+ } )
49+
4650 it ( 'should disabled prop prevent option actions' , ( ) => {
4751 cy . mount (
4852 < Drilldown rootPageId = "page0" disabled >
@@ -57,10 +61,6 @@ describe('<Drilldown/>', () => {
5761 </ Drilldown >
5862 )
5963 cy . contains ( 'Option-0' ) . realClick ( )
60-
61- // `disabled` prevents the option action, so clicking Option-0 must NOT
62- // navigate to its subPage — Option-1 (on page1) should never appear and
63- // we stay on page0.
6464 cy . contains ( 'Option-0' ) . should ( 'be.visible' )
6565 cy . contains ( 'Option-1' ) . should ( 'not.exist' )
6666 } )
@@ -96,8 +96,7 @@ describe('<Drilldown/>', () => {
9696 </ Drilldown . Page >
9797 </ Drilldown >
9898 )
99- cy . get ( 'body' ) . realClick ( )
100- cy . get ( 'body' ) . realPress ( 'Tab' )
99+ cy . get ( 'div[role="menu"]' ) . focus ( )
101100
102101 cy . realPress ( 'ArrowDown' )
103102 cy . focused ( ) . should ( 'have.id' , 'option01' )
@@ -109,12 +108,7 @@ describe('<Drilldown/>', () => {
109108 cy . focused ( ) . should ( 'have.id' , 'option01' )
110109 } )
111110
112- // TODO(INSTUI): flaky under cypress-real-events keyboard navigation with
113- // retries:0. cy `.focus()` on the menu isn't honored by CDP key dispatch and
114- // `realClick`+`Tab` is non-deterministic. Needs the component's real focus
115- // model mapped (post-Tab focus target, how ArrowDown enters options) to make
116- // it reliably deterministic. Skipped pending that work.
117- it . skip ( 'should prevent focus rotation in the drilldown with "false"' , ( ) => {
111+ it ( 'should prevent focus rotation in the drilldown with "false"' , ( ) => {
118112 cy . mount (
119113 < Drilldown rootPageId = "page0" rotateFocus = { false } >
120114 < Drilldown . Page id = "page0" >
@@ -123,8 +117,7 @@ describe('<Drilldown/>', () => {
123117 </ Drilldown . Page >
124118 </ Drilldown >
125119 )
126- cy . get ( 'body' ) . realClick ( )
127- cy . get ( 'body' ) . realPress ( 'Tab' )
120+ cy . get ( 'div[role="menu"]' ) . focus ( )
128121
129122 cy . realPress ( 'ArrowDown' )
130123 cy . focused ( ) . should ( 'have.id' , 'option01' )
@@ -461,10 +454,7 @@ describe('<Drilldown/>', () => {
461454 cy . contains ( 'Option01' ) . should ( 'be.visible' )
462455 } )
463456
464- // TODO(INSTUI): flaky under cypress-real-events keyboard navigation with
465- // retries:0 (see the skipped focus-rotation test above). Skipped pending a
466- // deterministic real-events focus approach.
467- it . skip ( 'should be able to navigate between options with up/down arrows' , ( ) => {
457+ it ( 'should be able to navigate between options with up/down arrows' , ( ) => {
468458 cy . mount (
469459 < Drilldown rootPageId = "page0" >
470460 < Drilldown . Page id = "page0" >
@@ -491,10 +481,7 @@ describe('<Drilldown/>', () => {
491481 cy . get ( '#opt_1' ) . should ( 'have.focus' )
492482 } )
493483
494- // TODO(INSTUI): flaky under cypress-real-events keyboard navigation with
495- // retries:0 (see the skipped focus-rotation test above). Skipped pending a
496- // deterministic real-events focus approach.
497- it . skip ( 'should be able to navigate forward between pages with right arrow' , ( ) => {
484+ it ( 'should be able to navigate forward between pages with right arrow' , ( ) => {
498485 cy . mount (
499486 < Drilldown rootPageId = "page0" >
500487 < Drilldown . Page id = "page0" renderTitle = { 'Page 0' } >
@@ -532,7 +519,7 @@ describe('<Drilldown/>', () => {
532519 // next arrowDown should skip the header Title and focus on 'To Page 2' option
533520 cy . realPress ( 'ArrowDown' )
534521 cy . contains ( '[id^="DrilldownHeader-Title_"]' , 'Page 1' ) . should ( 'be.visible' )
535- cy . contains ( '[role="button"]' , 'To Page 2' ) . should ( 'have.focus' )
522+ cy . get ( '#opt5' ) . should ( 'have.focus' ) . and ( 'have.text' , 'To Page 2 ')
536523
537524 // go to Page 2
538525 cy . realPress ( 'ArrowRight' )
0 commit comments