/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

export class AppPage {
  navigateTo() {
    return cy.visit('/');
  }

  getHeadline() {
    return cy.get('bci-demo h3');
  }

  getReadOnlyslideToggle() {
    return cy.get('.mdc-switch');
  }

  getEditModeButton() {
    return cy.get('[data-test="webcore.pinboard.edit-mode.button"]', { timeout: 10000 });
  }

  getAddWidgetButton() {
    return cy.get('[data-test="webcore.pinboard.edit-mode.add-widget.button"]', { timeout: 10000 });
  }

  getEditModeSaveButton() {
    return cy.get('[data-test="webcore.pinboard.edit-mode.save.button"]', { timeout: 10000 });
  }

  addNewWidget(widgetName) {
    return cy.contains('.widget-header', widgetName).find('.mat-mdc-checkbox');
  }

  getAddWidgetSaveButton() {
    return cy.get('[data-test="webcore.pinboard.dialog.add-widget.button"]');
  }

  getEditWidgetIcon() {
    return cy.get('[data-test="webcore.pinboard.widget.edit-menu.button"]');
  }

  getConfigureWidgetMenu() {
    return cy.get('[data-test="webcore.pinboard.widget.menu.configure-widget.button"]');
  }

  getShowWidgetTitleCheckbox() {
    return cy.get('[data-test="webcore.pinboard.edit-widget.form.show-widget-name.checkbox"]');
  }

  getEditWidgetSaveButton() {
    return cy.get('[data-test="webcore.pinboard.edit-widget.form.save.button"]');
  }

  getWidgetTitle() {
    return cy.get('[data-test="webcore.pinboard.widget.title.span"]');
  }

  getLoadingIndicator() {
    return cy.get('bci-activity-indicator', { timeout: 10000 });
  }
}
