Home Manual Reference Source

src/page_objects/web/login/login.page.js

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

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

  // PAGE ELEMENTS

  /* eslint-disable require-jsdoc */
  emailField() {
    return this.element("input#id_email");
  }

  passwordField() {
    return this.element("input#id_password");
  }

  nextButton() {
    return this.element("button#button_continue");
  }

  loadingCircle() {
    return this.element(
      "div[class^=components-LoadingAnimation-LoadingAnimation__circle]"
    );
  }

  errorMessage() {
    return this.element("div#id_error");
  }
  /* eslint-enable require-jsdoc */

  // PAGE FUNCTIONS

  /** 
   * Navigates browser to the Base URL, which redirects to the login service. 
   */
  async visit() {
    await this.browser.url(
      "https://login.lifesizecloudbeta.com/ls/login/?source=nucleus.webclient&next=https://webapp.lifesizecloudbeta.com/auth"
    );
    await this.browser.pause(5000);
  }

  /** 
   * Fill in fields on login page, and submit. 
   * @param {String} email Email of user
   * @param {String} password Password of user
  */
  async login(email, password) {
    await this.emailField().setValue(email);
    await this.nextButton().click();
    await this.passwordField().setValue(password);
    await this.pause(2000);
    await this.nextButton().click();
    await this.pause(1000);
  }
}

export default LoginPage;