Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

LargeVideo.ts 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import BasePageObject from './BasePageObject';
  2. /**
  3. * The large video.
  4. */
  5. export default class LargeVideo extends BasePageObject {
  6. /**
  7. * Returns the elapsed time at which video has been playing.
  8. *
  9. * @return {number} - The current play time of the video element.
  10. */
  11. async getPlaytime() {
  12. return this.participant.driver.$('#largeVideo').getProperty('currentTime');
  13. }
  14. /**
  15. * Waits 5s for the large video to switch to passed endpoint id.
  16. *
  17. * @param {string} endpointId - The endpoint.
  18. * @returns {Promise<void>}
  19. */
  20. waitForSwitchTo(endpointId: string): Promise<void> {
  21. return this.participant.driver.waitUntil(async () => endpointId === await this.getResource(), {
  22. timeout: 5_000,
  23. timeoutMsg: `expected large video to switch to ${endpointId} for 5s`
  24. });
  25. }
  26. /**
  27. * Gets avatar SRC attribute for the one displayed on large video.
  28. */
  29. async getAvatar() {
  30. const avatar = this.participant.driver.$('//img[@id="dominantSpeakerAvatar"]');
  31. return await avatar.isExisting() ? await avatar.getAttribute('src') : null;
  32. }
  33. /**
  34. * Returns resource part of the JID of the user who is currently displayed in the large video area.
  35. */
  36. getResource() {
  37. return this.participant.driver.execute(() => APP.UI.getLargeVideoID());
  38. }
  39. /**
  40. * Returns the source of the large video currently shown.
  41. */
  42. getId() {
  43. return this.participant.driver.execute('return document.getElementById("largeVideo").srcObject.id');
  44. }
  45. /**
  46. * Checks if the large video is playing or not.
  47. *
  48. * @returns {Promise<void>}
  49. */
  50. assertPlaying() {
  51. let lastTime: number;
  52. return this.participant.driver.waitUntil(async () => {
  53. const currentTime = parseFloat(await this.getPlaytime());
  54. if (typeof lastTime === 'undefined') {
  55. lastTime = currentTime;
  56. }
  57. if (currentTime > lastTime) {
  58. return true;
  59. }
  60. lastTime = currentTime;
  61. return false;
  62. }, {
  63. timeout: 5_500,
  64. interval: 500,
  65. timeoutMsg:
  66. `Expected large video for participant ${this.participant.name} to play but it didn't for more than 5s`
  67. });
  68. }
  69. }