Skip to content
Snippets Groups Projects
sidenav.po.ts 843 B
Newer Older
import { by, element } from "protractor";
import * as path from "path";

export class SideNav {
  getLoadSessionButton() {
    return element(by.css("#side-nav-load-session"));
  }

  getFileInput() {
    // tslint:disable-next-line:quotemark
    return element(by.css('dialog-load-session input[type="file"]'));
  }

  getFileLoadButton() {
    // tslint:disable-next-line:quotemark
    return element(by.css('dialog-load-session button[type="submit"]'));
  }

  async clickLoadSessionButton() {
    const ncb = this.getLoadSessionButton();
    await ncb.click();
  }

  async loadSessionFile(file: string, click: boolean = true) {
    const absolutePath = path.resolve(__dirname, file);
    const input = this.getFileInput();
    await input.sendKeys(absolutePath);
    if (click) {
      await this.getFileLoadButton().click();
    }