Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

desktopSharing.spec.ts 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. import { SET_AUDIO_ONLY } from '../../../react/features/base/audio-only/actionTypes';
  2. import {
  3. checkForScreensharingTile,
  4. ensureFourParticipants,
  5. ensureOneParticipant,
  6. ensureThreeParticipants,
  7. ensureTwoParticipants
  8. } from '../../helpers/participants';
  9. describe('Desktop sharing', () => {
  10. it('start', async () => {
  11. await ensureTwoParticipants(ctx, {
  12. configOverwrite: {
  13. p2p: {
  14. enabled: true
  15. }
  16. }
  17. });
  18. const { p1, p2 } = ctx;
  19. await p2.getToolbar().clickDesktopSharingButton();
  20. // Check if a remote screen share tile is created on p1.
  21. await checkForScreensharingTile(p2, p1);
  22. // Check if a local screen share tile is created on p2.
  23. await checkForScreensharingTile(p2, p2);
  24. expect(await p2.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  25. });
  26. it('stop', async () => {
  27. const { p1, p2 } = ctx;
  28. await p2.getToolbar().clickStopDesktopSharingButton();
  29. // Check if the local screen share thumbnail disappears on p2.
  30. await checkForScreensharingTile(p2, p2, true);
  31. // Check if the remote screen share thumbnail disappears on p1.
  32. await checkForScreensharingTile(p1, p2, true);
  33. });
  34. /**
  35. * Ensures screen share is still visible when the call switches from p2p to jvb connection.
  36. */
  37. it('p2p to jvb switch', async () => {
  38. await ctx.p2.getToolbar().clickDesktopSharingButton();
  39. await ensureThreeParticipants(ctx);
  40. const { p1, p2, p3 } = ctx;
  41. // Check if a remote screen share tile is created on all participants.
  42. await checkForScreensharingTile(p2, p1);
  43. await checkForScreensharingTile(p2, p2);
  44. await checkForScreensharingTile(p2, p2);
  45. expect(await p3.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  46. });
  47. /**
  48. * Ensure screen share is still visible when the call switches from jvb to p2p and back.
  49. */
  50. it('p2p to jvb switch and back', async () => {
  51. const { p1, p2, p3 } = ctx;
  52. await p3.hangup();
  53. // Check if a remote screen share tile is created on p1 and p2 after switching back to p2p.
  54. await checkForScreensharingTile(p2, p1);
  55. await checkForScreensharingTile(p2, p2);
  56. // The video should be playing.
  57. expect(await p1.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  58. // Start desktop share on p1.
  59. await p1.getToolbar().clickDesktopSharingButton();
  60. // Check if a new tile for p1's screen share is created on both p1 and p2.
  61. await checkForScreensharingTile(p1, p1);
  62. await checkForScreensharingTile(p1, p2);
  63. await ensureThreeParticipants(ctx);
  64. await checkForScreensharingTile(p1, p3);
  65. await checkForScreensharingTile(p2, p3);
  66. // The large video should be playing on p3.
  67. expect(await p3.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  68. });
  69. /**
  70. * Ensure that screen share is still visible in jvb connection when share is toggled while the users are
  71. * in p2p mode, i.e., share is restarted when user is in p2p mode and then the call switches over to jvb mode.
  72. */
  73. it('stop screen sharing and back', async () => {
  74. const { p1, p2, p3 } = ctx;
  75. // Stop share on both p1 and p2.
  76. await p1.getToolbar().clickStopDesktopSharingButton();
  77. await p2.getToolbar().clickStopDesktopSharingButton();
  78. await p3.hangup();
  79. // Start share on both p1 and p2.
  80. await p1.getToolbar().clickDesktopSharingButton();
  81. await p2.getToolbar().clickDesktopSharingButton();
  82. // Check if p1 and p2 can see each other's shares in p2p.
  83. await checkForScreensharingTile(p1, p2);
  84. await checkForScreensharingTile(p2, p1);
  85. // Add p3 back to the conference and check if p1 and p2's shares are visible on p3.
  86. await ensureThreeParticipants(ctx);
  87. await checkForScreensharingTile(p1, p3);
  88. await checkForScreensharingTile(p2, p3);
  89. // The large video should be playing on p3.
  90. expect(await p3.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  91. });
  92. /**
  93. * Ensures screen share is visible when a muted screen share track is added to the conference, i.e.,
  94. * users starts and stops the share before anyone else joins the call.
  95. * The call switches to jvb and then back to p2p.
  96. */
  97. it('screen sharing toggle before others join', async () => {
  98. await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
  99. await ensureOneParticipant(ctx, {
  100. configOverwrite: {
  101. p2p: {
  102. enabled: true
  103. }
  104. }
  105. });
  106. const { p1 } = ctx;
  107. // p1 starts share when alone in the call.
  108. await p1.getToolbar().clickDesktopSharingButton();
  109. await checkForScreensharingTile(p1, p1);
  110. // p1 stops share.
  111. await p1.getToolbar().clickStopDesktopSharingButton();
  112. // Call switches to jvb.
  113. await ensureThreeParticipants(ctx);
  114. const { p2, p3 } = ctx;
  115. // p1 starts share again when call switches to jvb.
  116. await p1.getToolbar().clickDesktopSharingButton();
  117. // Check p2 and p3 are able to see p1's share.
  118. await checkForScreensharingTile(p1, p2);
  119. await checkForScreensharingTile(p1, p3);
  120. expect(await p2.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  121. expect(await p3.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  122. // p3 leaves the call.
  123. await p3.hangup();
  124. // Make sure p2 see's p1's share after the call switches back to p2p.
  125. await checkForScreensharingTile(p1, p2);
  126. expect(await p2.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  127. // p2 starts share when in p2p.
  128. await p2.getToolbar().clickDesktopSharingButton();
  129. // Makes sure p2's share is visible on p1.
  130. await checkForScreensharingTile(p2, p1);
  131. expect(await p1.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  132. });
  133. /**
  134. * A case where a non-dominant speaker is sharing screen for a participant in low bandwidth mode
  135. * where only a screen share can be received. A bug fixed in jvb 0c5dd91b where the video was not received.
  136. */
  137. it('audio only and non dominant screen share', async () => {
  138. await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
  139. await ensureOneParticipant(ctx);
  140. const { p1 } = ctx;
  141. // a workaround to directly set audio only mode without going through the rest of the settings in the UI
  142. await p1.driver.execute(type => {
  143. APP.store.dispatch({
  144. type,
  145. audioOnly: true
  146. });
  147. APP.conference.onToggleAudioOnly();
  148. }, SET_AUDIO_ONLY);
  149. await p1.getToolbar().clickAudioMuteButton();
  150. await ensureThreeParticipants(ctx, { skipInMeetingChecks: true });
  151. const { p2, p3 } = ctx;
  152. await p3.getToolbar().clickAudioMuteButton();
  153. await p3.getToolbar().clickDesktopSharingButton();
  154. await checkForScreensharingTile(p3, p1);
  155. await checkForScreensharingTile(p3, p2);
  156. // the video should be playing
  157. await p1.driver.waitUntil(() => p1.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived()), {
  158. timeout: 5_000,
  159. timeoutMsg: 'expected remote screen share to be on large'
  160. });
  161. });
  162. /**
  163. * A case where first participant is muted (a&v) and enters low bandwidth mode,
  164. * the second one is audio muted only and the one sharing (the third) is dominant speaker.
  165. * A problem fixed in jitsi-meet 3657c19e and d6ab0a72.
  166. */
  167. it('audio only and dominant screen share', async () => {
  168. await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
  169. await ensureOneParticipant(ctx, {
  170. configOverwrite: {
  171. startWithAudioMuted: true,
  172. startWithVideoMuted: true
  173. }
  174. });
  175. const { p1 } = ctx;
  176. // a workaround to directly set audio only mode without going through the rest of the settings in the UI
  177. await p1.driver.execute(type => {
  178. APP.store.dispatch({
  179. type,
  180. audioOnly: true
  181. });
  182. APP.conference.onToggleAudioOnly();
  183. }, SET_AUDIO_ONLY);
  184. await ensureTwoParticipants(ctx, {
  185. skipInMeetingChecks: true,
  186. configOverwrite: {
  187. startWithAudioMuted: true
  188. }
  189. });
  190. await ensureThreeParticipants(ctx, {
  191. skipInMeetingChecks: true
  192. });
  193. const { p2, p3 } = ctx;
  194. await p3.getToolbar().clickDesktopSharingButton();
  195. await checkForScreensharingTile(p3, p1);
  196. await checkForScreensharingTile(p3, p2);
  197. // The desktop sharing participant should be on large
  198. expect(await p1.getLargeVideo().getResource()).toBe(`${await p3.getEndpointId()}-v1`);
  199. // the video should be playing
  200. await p1.driver.waitUntil(() => p1.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived()), {
  201. timeout: 5_000,
  202. timeoutMsg: 'expected remote screen share to be on large'
  203. });
  204. });
  205. /**
  206. * Test screensharing with lastN. We add p4 with lastN=2 and verify that it receives the expected streams.
  207. */
  208. it('with lastN', async () => {
  209. await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
  210. await ensureThreeParticipants(ctx);
  211. const { p1, p2, p3 } = ctx;
  212. await p3.getToolbar().clickDesktopSharingButton();
  213. await p1.getToolbar().clickAudioMuteButton();
  214. await p3.getToolbar().clickAudioMuteButton();
  215. await ensureFourParticipants(ctx, {
  216. configOverwrite: {
  217. channelLastN: 2,
  218. startWithAudioMuted: true
  219. }
  220. });
  221. const { p4 } = ctx;
  222. // We now have p1, p2, p3, p4.
  223. // p3 is screensharing.
  224. // p1, p3, p4 are audio muted, so p2 should eventually become dominant speaker.
  225. // Participants should display p3 on-stage because it is screensharing.
  226. await checkForScreensharingTile(p3, p1);
  227. await checkForScreensharingTile(p3, p2);
  228. await checkForScreensharingTile(p3, p4);
  229. // And the video should be playing
  230. expect(await p4.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived())).toBe(true);
  231. const p1EndpointId = await p1.getEndpointId();
  232. const p2EndpointId = await p2.getEndpointId();
  233. // p4 has lastN=2 and has selected p3. With p2 being dominant speaker p4 should eventually
  234. // see video for [p3, p2] and p1 as ninja.
  235. await p4.waitForNinjaIcon(p1EndpointId);
  236. await p4.waitForRemoteVideo(p2EndpointId);
  237. // Let's switch and check, muting participant 2 and unmuting 1 will leave participant 1 as dominant
  238. await p1.getToolbar().clickAudioUnmuteButton();
  239. await p2.getToolbar().clickAudioMuteButton();
  240. // Participant4 should eventually see video for [p3, p1] and p2 as a ninja.
  241. await p4.waitForNinjaIcon(p2EndpointId);
  242. await p4.waitForRemoteVideo(p1EndpointId);
  243. });
  244. });