@@ -282,21 +282,41 @@ describe("Spotlight", () => {
282282 cy . openSpotlightDialog ( ) . within ( ( ) => {
283283 cy . spotlightFilter ( Filter . People ) ;
284284 cy . spotlightSearch ( ) . clear ( ) . type ( "b" ) ;
285- cy . spotlightResults ( ) . should ( "have.length" , 2 ) ;
286- cy . spotlightResults ( ) . eq ( 0 ) . should ( "have.attr" , "aria-selected" , "true" ) ;
287- cy . spotlightResults ( ) . eq ( 1 ) . should ( "have.attr" , "aria-selected" , "false" ) ;
288- cy . spotlightSearch ( ) . type ( "{downArrow}" ) ;
289- cy . spotlightResults ( ) . eq ( 0 ) . should ( "have.attr" , "aria-selected" , "false" ) ;
290- cy . spotlightResults ( ) . eq ( 1 ) . should ( "have.attr" , "aria-selected" , "true" ) ;
291- cy . spotlightSearch ( ) . type ( "{downArrow}" ) ;
292- cy . spotlightResults ( ) . eq ( 0 ) . should ( "have.attr" , "aria-selected" , "false" ) ;
293- cy . spotlightResults ( ) . eq ( 1 ) . should ( "have.attr" , "aria-selected" , "false" ) ;
294- cy . spotlightSearch ( ) . type ( "{upArrow}" ) ;
295- cy . spotlightResults ( ) . eq ( 0 ) . should ( "have.attr" , "aria-selected" , "false" ) ;
296- cy . spotlightResults ( ) . eq ( 1 ) . should ( "have.attr" , "aria-selected" , "true" ) ;
297- cy . spotlightSearch ( ) . type ( "{upArrow}" ) ;
298- cy . spotlightResults ( ) . eq ( 0 ) . should ( "have.attr" , "aria-selected" , "true" ) ;
299- cy . spotlightResults ( ) . eq ( 1 ) . should ( "have.attr" , "aria-selected" , "false" ) ;
285+ // our debouncing logic only starts the search after a short timeout,
286+ // so we wait a few milliseconds.
287+ cy . wait ( 300 ) ;
288+ cy . get ( ".mx_Spinner" ) . should ( "not.exist" ) . then ( ( ) => {
289+ cy . spotlightResults ( ) . should ( "have.length" , 2 ) . then ( ( ) => {
290+ cy . spotlightResults ( ) . eq ( 0 )
291+ . should ( "have.attr" , "aria-selected" , "true" ) ;
292+ cy . spotlightResults ( ) . eq ( 1 )
293+ . should ( "have.attr" , "aria-selected" , "false" ) ;
294+ } ) ;
295+ cy . spotlightSearch ( ) . type ( "{downArrow}" ) . then ( ( ) => {
296+ cy . spotlightResults ( ) . eq ( 0 )
297+ . should ( "have.attr" , "aria-selected" , "false" ) ;
298+ cy . spotlightResults ( ) . eq ( 1 )
299+ . should ( "have.attr" , "aria-selected" , "true" ) ;
300+ } ) ;
301+ cy . spotlightSearch ( ) . type ( "{downArrow}" ) . then ( ( ) => {
302+ cy . spotlightResults ( ) . eq ( 0 )
303+ . should ( "have.attr" , "aria-selected" , "false" ) ;
304+ cy . spotlightResults ( ) . eq ( 1 )
305+ . should ( "have.attr" , "aria-selected" , "false" ) ;
306+ } ) ;
307+ cy . spotlightSearch ( ) . type ( "{upArrow}" ) . then ( ( ) => {
308+ cy . spotlightResults ( ) . eq ( 0 )
309+ . should ( "have.attr" , "aria-selected" , "false" ) ;
310+ cy . spotlightResults ( ) . eq ( 1 )
311+ . should ( "have.attr" , "aria-selected" , "true" ) ;
312+ } ) ;
313+ cy . spotlightSearch ( ) . type ( "{upArrow}" ) . then ( ( ) => {
314+ cy . spotlightResults ( ) . eq ( 0 )
315+ . should ( "have.attr" , "aria-selected" , "true" ) ;
316+ cy . spotlightResults ( ) . eq ( 1 )
317+ . should ( "have.attr" , "aria-selected" , "false" ) ;
318+ } ) ;
319+ } ) ;
300320 } ) ;
301321 } ) ;
302322} ) ;
0 commit comments