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.

ParticipantsPane.ts 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. import { Participant } from '../helpers/Participant';
  2. import AVModerationMenu from './AVModerationMenu';
  3. import BasePageObject from './BasePageObject';
  4. /**
  5. * Classname of the closed/hidden participants pane
  6. */
  7. const PARTICIPANTS_PANE = 'participants_pane';
  8. const INVITE = 'Invite someone';
  9. /**
  10. * Represents the participants pane from the UI.
  11. */
  12. export default class ParticipantsPane extends BasePageObject {
  13. /**
  14. * Gets the audio video moderation menu.
  15. */
  16. getAVModerationMenu() {
  17. return new AVModerationMenu(this.participant);
  18. }
  19. /**
  20. * Checks if the pane is open.
  21. */
  22. async isOpen() {
  23. return this.participant.driver.$(`.${PARTICIPANTS_PANE}`).isExisting();
  24. }
  25. /**
  26. * Clicks the "participants" toolbar button to open the participants pane.
  27. */
  28. async open() {
  29. await this.participant.getToolbar().clickParticipantsPaneButton();
  30. const pane = this.participant.driver.$(`.${PARTICIPANTS_PANE}`);
  31. await pane.waitForExist();
  32. await pane.waitForStable();
  33. await pane.waitForDisplayed();
  34. }
  35. /**
  36. * Clicks the "participants" toolbar button to close the participants pane.
  37. */
  38. async close() {
  39. await this.participant.getToolbar().clickCloseParticipantsPaneButton();
  40. await this.participant.driver.$(`.${PARTICIPANTS_PANE}`).waitForDisplayed({ reverse: true });
  41. }
  42. /**
  43. * Asserts that {@code participant} shows or doesn't show the video mute icon for the conference participant
  44. * identified by {@code testee}.
  45. *
  46. * @param {Participant} testee - The {@code Participant} for whom we're checking the status of audio muted icon.
  47. * @param {boolean} reverse - If {@code true}, the method will assert the absence of the "mute" icon;
  48. * otherwise, it will assert its presence.
  49. * @returns {Promise<void>}
  50. */
  51. async assertVideoMuteIconIsDisplayed(testee: Participant, reverse = false): Promise<void> {
  52. const isOpen = await this.isOpen();
  53. if (!isOpen) {
  54. await this.open();
  55. }
  56. const id = `participant-item-${await testee.getEndpointId()}`;
  57. const mutedIconXPath
  58. = `//div[@id='${id}']//div[contains(@class, 'indicators')]//*[local-name()='svg' and @id='videoMuted']`;
  59. await this.participant.driver.$(mutedIconXPath).waitForDisplayed({
  60. reverse,
  61. timeout: 2000,
  62. timeoutMsg: `Video mute icon is${reverse ? '' : ' not'} displayed for ${testee.name}`
  63. });
  64. if (!isOpen) {
  65. await this.close();
  66. }
  67. }
  68. /**
  69. * Clicks the context menu button in the participants pane.
  70. */
  71. async clickContextMenuButton() {
  72. if (!await this.isOpen()) {
  73. await this.open();
  74. }
  75. const menu = this.participant.driver.$('#participants-pane-context-menu');
  76. await menu.waitForDisplayed();
  77. await menu.click();
  78. }
  79. /**
  80. * Trys to click allow video button.
  81. * @param participantToUnmute
  82. */
  83. async allowVideo(participantToUnmute: Participant) {
  84. if (!await this.isOpen()) {
  85. await this.open();
  86. }
  87. const participantId = await participantToUnmute.getEndpointId();
  88. const participantItem = this.participant.driver.$(`#participant-item-${participantId}`);
  89. await participantItem.waitForExist();
  90. await participantItem.moveTo();
  91. const unmuteButton = this.participant.driver
  92. .$(`button[data-testid="unmute-video-${participantId}"]`);
  93. await unmuteButton.waitForExist();
  94. await unmuteButton.click();
  95. }
  96. /**
  97. * Trys to click ask to unmute button.
  98. * @param participantToUnmute
  99. * @param fromContextMenu
  100. */
  101. async askToUnmute(participantToUnmute: Participant, fromContextMenu: boolean) {
  102. if (!await this.isOpen()) {
  103. await this.open();
  104. }
  105. await this.participant.getNotifications().dismissAnyJoinNotification();
  106. const participantId = await participantToUnmute.getEndpointId();
  107. await this.selectParticipant(participantToUnmute);
  108. if (fromContextMenu) {
  109. await this.openParticipantContextMenu(participantToUnmute);
  110. }
  111. const unmuteButton = this.participant.driver
  112. .$(`[data-testid="unmute-audio-${participantId}"]`);
  113. await unmuteButton.waitForExist();
  114. await unmuteButton.click();
  115. }
  116. /**
  117. * Open context menu for given participant.
  118. */
  119. async selectParticipant(participant: Participant) {
  120. const participantId = await participant.getEndpointId();
  121. const participantItem = this.participant.driver.$(`#participant-item-${participantId}`);
  122. await participantItem.waitForExist();
  123. await participantItem.waitForStable();
  124. await participantItem.waitForDisplayed();
  125. await participantItem.moveTo();
  126. }
  127. /**
  128. * Open context menu for given participant.
  129. */
  130. async openParticipantContextMenu(participant: Participant) {
  131. const participantId = await participant.getEndpointId();
  132. const meetingParticipantMoreOptions = this.participant.driver
  133. .$(`[data-testid="participant-more-options-${participantId}"]`);
  134. await meetingParticipantMoreOptions.waitForExist();
  135. await meetingParticipantMoreOptions.waitForDisplayed();
  136. await meetingParticipantMoreOptions.waitForStable();
  137. await meetingParticipantMoreOptions.moveTo();
  138. await meetingParticipantMoreOptions.click();
  139. }
  140. /**
  141. * Clicks the invite button.
  142. */
  143. async clickInvite() {
  144. if (!await this.isOpen()) {
  145. await this.open();
  146. }
  147. const inviteButton = this.participant.driver.$(`aria/${INVITE}`);
  148. await inviteButton.waitForDisplayed();
  149. await inviteButton.click();
  150. }
  151. }