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.4KB

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