"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _Page = _interopRequireDefault(require("./Page"));

var _UserMenu = _interopRequireDefault(require("./UserMenu"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class ProtectedPage extends _Page.default {
  constructor() {
    super();
    this.selector = '.cspace-ui-Banner--common';
    this.navBarSelector = '.cspace-ui-NavBar--common';
    this.userMenu = new _UserMenu.default();
  }

  getUserScreenName() {
    return this.userMenu.getUserScreenName();
  }

  getLogoutLink() {
    return this.userMenu.getLogoutLink();
  }

  isLoggedInAs(username) {
    return this.userMenu.isLoggedInAs(username);
  }

  isUserMenuVisible() {
    return this.userMenu.isVisible();
  }

  isVisible() {
    return super.isVisible() && this.isUserMenuVisible();
  }

  clickCreateNewLink() {
    browser.$(this.navBarSelector).$('a=Create New').click();
  }

  logout() {
    this.userMenu.logout();
    return this;
  }

}

exports.default = ProtectedPage;