Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { LOG_PREFIX } from '../helpers/browserLogger';
  2. import BasePageObject from './BasePageObject';
  3. /**
  4. * The Iframe API and helpers from iframeAPITest.html
  5. */
  6. export default class IframeAPI extends BasePageObject {
  7. /**
  8. * Returns the json object from the iframeAPI helper.
  9. * @param event
  10. */
  11. getEventResult(event: string): Promise<any> {
  12. return this.participant.driver.execute(
  13. eventName => {
  14. const result = window.jitsiAPI.test[eventName];
  15. if (!result) {
  16. return false;
  17. }
  18. return result;
  19. }, event);
  20. }
  21. /**
  22. * Adds an event listener to the iframeAPI.
  23. * @param eventName The event name.
  24. */
  25. addEventListener(eventName: string) {
  26. return this.participant.driver.execute(
  27. (event, prefix) => {
  28. console.log(`${new Date().toISOString()} ${prefix} Adding listener for event: ${event}`);
  29. window.jitsiAPI.addListener(event, evt => {
  30. console.log(
  31. `${new Date().toISOString()} ${prefix} Received ${event} event: ${JSON.stringify(evt)}`);
  32. window.jitsiAPI.test[event] = evt;
  33. });
  34. }, eventName, LOG_PREFIX);
  35. }
  36. /**
  37. * Returns an array of available rooms and details of it.
  38. */
  39. getRoomsInfo() {
  40. return this.participant.driver.execute(() => window.jitsiAPI.getRoomsInfo());
  41. }
  42. /**
  43. * Returns the number of participants in the conference.
  44. */
  45. getNumberOfParticipants() {
  46. return this.participant.driver.execute(() => window.jitsiAPI.getNumberOfParticipants());
  47. }
  48. /**
  49. * Executes command using iframeAPI.
  50. * @param command The command.
  51. * @param args The arguments.
  52. */
  53. executeCommand(command: string, ...args: any[]) {
  54. return this.participant.driver.execute(
  55. (commandName, commandArgs) =>
  56. window.jitsiAPI.executeCommand(commandName, ...commandArgs)
  57. , command, args);
  58. }
  59. /**
  60. * Returns the current state of the participant's pane.
  61. */
  62. isParticipantsPaneOpen() {
  63. return this.participant.driver.execute(() => window.jitsiAPI.isParticipantsPaneOpen());
  64. }
  65. /**
  66. * Removes the embedded Jitsi Meet conference.
  67. */
  68. dispose() {
  69. return this.participant.driver.execute(() => window.jitsiAPI.dispose());
  70. }
  71. }