Home Manual Reference Source

src/page_objects/web/call/startCall.modal.js

import BasePage from "../../base.page.js";

/**
 * StartCallModal
 * @extends BasePage
 */
class StartCallModal extends BasePage {
  /**
   * @param {args} args Args from controller
   */
  constructor(args) {
    super(args);
  }

  // PAGE ELEMENTS
  /* eslint-disable require-jsdoc */
  numberField() {
    return this.element("input[name=startCallSearch]");
  }

  videoButton() {
    return this.element("button[data-lsqa=start-video]");
  }

  audioButton() {
    return this.element("button[data-lsqa=start-audio]");
  }

  callErrorMessage() {
    return this.element("h1=Unable to start call");
  }

  callStatusMessage() {
    return this.element(
      "[class^='components-StartingCallModal-StartingCallModal__callStatus']"
    );
  }
  /* eslint-enable require-jsdoc */

  // PAGE FUNCTIONS

  /**
   * Waits for video button to be enabled, then clicks it
   */
  async startVideoCall() {
    await this.videoButton().waitForEnabled();
    await this.videoButton().click();
  }

  /**
   * Enters in extension, then uses keys to select the contact
   * @param {String} extension Extension to enter
   */
  async enterExtension(extension) {
    await this.numberField().setValue(extension);
    await this.keys("Down arrow");
    await this.keys("Enter");
  }
}

export default StartCallModal;