@@ -41,22 +41,27 @@ test('Test resolution changes with match viewport off.', {
4141 await page . goto ( `/?StreamerId=${ streamerId } &MatchViewportRes=false` ) ;
4242
4343 await helpers . startAndWaitForVideo ( page ) ;
44- await page . click ( "#streamingVideo" ) ;
4544
4645 const events = await getEventsFor ( streamerPage , async ( ) => {
46+ // We do a click here so we have some player input to send the streamer
47+ await page . click ( "#streamingVideo" ) ;
4748 await page . setViewportSize ( { width : 100 , height : 100 } ) ;
4849 await helpers . delay ( 1000 ) ;
4950 await page . setViewportSize ( { width : 800 , height : 600 } ) ;
5051 await helpers . delay ( 1000 ) ;
5152 } ) ;
5253
53- const firstPlayerId = Object . keys ( events ) [ 0 ] ;
54- const singlePlayerEvents = events [ firstPlayerId ] ;
55- const expectedActions : DataChannelEvent [ ] = [
56- { type : PSEventTypes . Command , command : '{\"Resolution.Width\":100,\"Resolution.Height\":100}' } ,
57- { type : PSEventTypes . Command , command : '{\"Resolution.Width\":800,\"Resolution.Height\":600}' } ,
58- ] ;
59- expect ( singlePlayerEvents ) . not . toContainActions ( expectedActions ) ;
54+ const firstPlayerId = Object . keys ( events ) . length > 0 ? Object . keys ( events ) [ 0 ] : null ;
55+ if ( firstPlayerId != null ) {
56+ const singlePlayerEvents = events [ firstPlayerId ] ;
57+ if ( singlePlayerEvents . length > 0 ) {
58+ const expectedActions : DataChannelEvent [ ] = [
59+ { type : PSEventTypes . Command , command : '{\"Resolution.Width\":100,\"Resolution.Height\":100}' } ,
60+ { type : PSEventTypes . Command , command : '{\"Resolution.Width\":800,\"Resolution.Height\":600}' } ,
61+ ] ;
62+ expect ( singlePlayerEvents ) . not . toContainActions ( expectedActions ) ;
63+ }
64+ }
6065} ) ;
6166
6267
0 commit comments