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.

PreMeetingScreen.ts 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import BasePageObject from './BasePageObject';
  2. const PASSWORD_BUTTON_TEST_ID = 'lobby.enterPasswordButton';
  3. /**
  4. * Page object for the PreMeeting screen, common stuff between pre-join and lobby screens.
  5. */
  6. export default abstract class PreMeetingScreen extends BasePageObject {
  7. /**
  8. * Waits for pre join or lobby screen to load.
  9. */
  10. abstract waitForLoading(): Promise<void>;
  11. /**
  12. * Returns the display name input element.
  13. */
  14. abstract getDisplayNameInput(): WebdriverIO.Element;
  15. /**
  16. * Returns the join button element.
  17. */
  18. abstract getJoinButton(): WebdriverIO.Element;
  19. /**
  20. * Interacts with the view to enter a display name.
  21. */
  22. async enterDisplayName(displayName: string) {
  23. const displayNameInput = this.getDisplayNameInput();
  24. await displayNameInput.click();
  25. // element.clear does not always work, make sure we delete the content
  26. await displayNameInput.clearValue();
  27. await this.participant.driver.keys(displayName);
  28. }
  29. /**
  30. * Checks internally whether lobby room is joined.
  31. *
  32. * @returns {Promise<void>}
  33. */
  34. waitToJoinLobby(): Promise<void> {
  35. return this.participant.driver.waitUntil(
  36. () => this.isLobbyRoomJoined(),
  37. {
  38. timeout: 3_000, // 3 seconds
  39. timeoutMsg: `Timeout waiting to join lobby for ${this.participant.name}`
  40. }
  41. );
  42. }
  43. /**
  44. * Checks internally whether lobby room is joined.
  45. */
  46. isLobbyRoomJoined() {
  47. return this.participant.driver.execute(
  48. () => APP?.conference?._room?.room?.getLobby()?.lobbyRoom?.joined === true);
  49. }
  50. /**
  51. * Returns the password button element.
  52. */
  53. getPasswordButton() {
  54. return this.participant.driver.$(`[data-testid="${PASSWORD_BUTTON_TEST_ID}"]`);
  55. }
  56. /**
  57. * Interacts with the view to enter a password.
  58. */
  59. async enterPassword(password: string) {
  60. const passwordButton = this.getPasswordButton();
  61. await passwordButton.moveTo();
  62. await passwordButton.click();
  63. const passwordInput = this.participant.driver.$('[data-testid="lobby.password"]');
  64. await passwordInput.waitForDisplayed();
  65. await passwordInput.click();
  66. await passwordInput.clearValue();
  67. await this.participant.driver.keys(password);
  68. const joinButton = this.participant.driver.$('[data-testid="lobby.passwordJoinButton"]');
  69. await joinButton.waitForDisplayed();
  70. await joinButton.click();
  71. }
  72. }