You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

startMuted.spec.ts 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. import {
  2. ensureOneParticipant,
  3. ensureTwoParticipants,
  4. joinSecondParticipant,
  5. joinThirdParticipant,
  6. unmuteVideoAndCheck
  7. } from '../../helpers/participants';
  8. describe('StartMuted', () => {
  9. it('checkboxes test', async () => {
  10. const options = { configOverwrite: { p2p: { enabled: true } } };
  11. await ensureOneParticipant(ctx, options);
  12. const { p1 } = ctx;
  13. await p1.getToolbar().clickSettingsButton();
  14. const settingsDialog = p1.getSettingsDialog();
  15. await settingsDialog.waitForDisplay();
  16. await settingsDialog.setStartAudioMuted(true);
  17. await settingsDialog.setStartVideoMuted(true);
  18. await settingsDialog.submit();
  19. await joinSecondParticipant(ctx, {
  20. ...options,
  21. skipInMeetingChecks: true
  22. });
  23. const { p2 } = ctx;
  24. await p2.waitForIceConnected();
  25. await p2.waitForSendReceiveData({ checkSend: false });
  26. await p2.getFilmstrip().assertAudioMuteIconIsDisplayed(p2);
  27. await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2);
  28. await p1.waitForAudioMuted(p2, true);
  29. await p2.getFilmstrip().assertAudioMuteIconIsDisplayed(p1, true);
  30. await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1, true);
  31. // Enable video on p2 and check if p2 appears unmuted on p1.
  32. await Promise.all([
  33. p2.getToolbar().clickAudioUnmuteButton(), p2.getToolbar().clickVideoUnmuteButton()
  34. ]);
  35. await p2.getFilmstrip().assertAudioMuteIconIsDisplayed(p2, true);
  36. await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
  37. await p1.waitForAudioMuted(p2, false);
  38. // Add a third participant and check p3 is able to receive audio and video from p2.
  39. await joinThirdParticipant(ctx, {
  40. ...options,
  41. skipInMeetingChecks: true
  42. });
  43. const { p3 } = ctx;
  44. await p3.waitForIceConnected();
  45. await p3.waitForSendReceiveData({ checkSend: false });
  46. await p3.getFilmstrip().assertAudioMuteIconIsDisplayed(p2, true);
  47. await p3.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
  48. });
  49. it('config options test', async () => {
  50. await hangupAllParticipants();
  51. const options = {
  52. configOverwrite: {
  53. testing: {
  54. testMode: true,
  55. debugAudioLevels: true
  56. },
  57. startAudioMuted: 2,
  58. startVideoMuted: 2
  59. }
  60. };
  61. await ensureOneParticipant(ctx, options);
  62. await joinSecondParticipant(ctx, { skipInMeetingChecks: true });
  63. const { p2 } = ctx;
  64. await p2.waitForIceConnected();
  65. await p2.waitForSendReceiveData({ checkSend: false });
  66. await joinThirdParticipant(ctx, { skipInMeetingChecks: true });
  67. const { p3 } = ctx;
  68. await p3.waitForIceConnected();
  69. await p3.waitForSendReceiveData({ checkSend: false });
  70. const { p1 } = ctx;
  71. const p2ID = await p2.getEndpointId();
  72. p1.log(`Start configOptionsTest, second participant: ${p2ID}`);
  73. // Participant 3 should be muted, 1 and 2 unmuted.
  74. await p3.getFilmstrip().assertAudioMuteIconIsDisplayed(p3);
  75. await p3.getParticipantsPane().assertVideoMuteIconIsDisplayed(p3);
  76. await Promise.all([
  77. p1.waitForAudioMuted(p3, true),
  78. p2.waitForAudioMuted(p3, true)
  79. ]);
  80. await p3.getFilmstrip().assertAudioMuteIconIsDisplayed(p1, true);
  81. await p3.getFilmstrip().assertAudioMuteIconIsDisplayed(p2, true);
  82. await p3.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1, true);
  83. await p3.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
  84. // Unmute and see if the audio works
  85. await p3.getToolbar().clickAudioUnmuteButton();
  86. p1.log('configOptionsTest, unmuted third participant');
  87. await p1.waitForAudioMuted(p3, false /* unmuted */);
  88. });
  89. it('startWithVideoMuted=true can unmute', async () => {
  90. // Maybe disable if there is FF or Safari participant.
  91. await hangupAllParticipants();
  92. // Explicitly enable P2P due to a regression with unmute not updating
  93. // large video while in P2P.
  94. const options = {
  95. configOverwrite: {
  96. p2p: {
  97. enabled: true
  98. },
  99. startWithVideoMuted: true
  100. }
  101. };
  102. await ensureTwoParticipants(ctx, options);
  103. const { p1, p2 } = ctx;
  104. await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2);
  105. await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);
  106. await Promise.all([
  107. p1.getLargeVideo().waitForSwitchTo(await p2.getEndpointId()),
  108. p2.getLargeVideo().waitForSwitchTo(await p1.getEndpointId())
  109. ]);
  110. await unmuteVideoAndCheck(p2, p1);
  111. await p1.getLargeVideo().assertPlaying();
  112. });
  113. it('startWithAudioMuted=true can unmute', async () => {
  114. await hangupAllParticipants();
  115. const options = {
  116. configOverwrite: {
  117. startWithAudioMuted: true
  118. }
  119. };
  120. await ensureTwoParticipants(ctx, options);
  121. const { p1, p2 } = ctx;
  122. await Promise.all([ p1.waitForAudioMuted(p2, true), p2.waitForAudioMuted(p1, true) ]);
  123. await p1.getToolbar().clickAudioUnmuteButton();
  124. await Promise.all([ p1.waitForAudioMuted(p2, true), p2.waitForAudioMuted(p1, false) ]);
  125. });
  126. it('startWithAudioVideoMuted=true can unmute', async () => {
  127. await hangupAllParticipants();
  128. const options = {
  129. configOverwrite: {
  130. startWithAudioMuted: true,
  131. startWithVideoMuted: true,
  132. p2p: {
  133. enabled: true
  134. }
  135. }
  136. };
  137. await Promise.all([
  138. ensureOneParticipant(ctx, options),
  139. joinSecondParticipant(ctx, {
  140. configOverwrite: {
  141. p2p: {
  142. enabled: true
  143. }
  144. },
  145. skipInMeetingChecks: true
  146. })
  147. ]);
  148. const { p1, p2 } = ctx;
  149. await p2.waitForIceConnected();
  150. await p2.waitForSendReceiveData({ checkReceive: false });
  151. await p2.waitForAudioMuted(p1, true);
  152. await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);
  153. // Unmute p1's both audio and video and check on p2.
  154. await p1.getToolbar().clickAudioUnmuteButton();
  155. await p2.waitForAudioMuted(p1, false);
  156. await unmuteVideoAndCheck(p1, p2);
  157. await p2.getLargeVideo().assertPlaying();
  158. });
  159. it('test p2p JVB switch and switch back', async () => {
  160. const { p1, p2 } = ctx;
  161. // Mute p2's video just before p3 joins.
  162. await p2.getToolbar().clickVideoMuteButton();
  163. await joinThirdParticipant(ctx, {
  164. configOverwrite: {
  165. p2p: {
  166. enabled: true
  167. }
  168. }
  169. });
  170. const { p3 } = ctx;
  171. // Unmute p2 and check if its video is being received by p1 and p3.
  172. await p2.getToolbar().clickVideoUnmuteButton();
  173. await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
  174. await p3.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
  175. // Mute p2's video just before p3 leaves.
  176. await p2.getToolbar().clickVideoMuteButton();
  177. await p3.hangup();
  178. await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2);
  179. await p2.getToolbar().clickVideoUnmuteButton();
  180. // Check if p2's video is playing on p1.
  181. await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
  182. await p1.getLargeVideo().assertPlaying();
  183. });
  184. });
  185. /**
  186. * Hangs up all participants (p1, p2 and p3)
  187. * @returns {Promise<void>}
  188. */
  189. function hangupAllParticipants() {
  190. return Promise.all([ ctx.p1?.hangup(), ctx.p2?.hangup(), ctx.p3?.hangup() ]);
  191. }