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

import { AppPage } from '../support/app.po';

describe('workspace-project App', () => {
  const page = new AppPage();

  it('should display Dashboard', () => {
    page.navigateTo();
    page.getLoadingIndicator().should('not.be.visible');
    page.getHeadline().should('contain.text', 'Dashboard');
  });

  it('should check if the widget title is not displayed upon clicking on show widget title checkbox', () => {
    page.getReadOnlyslideToggle().click();
    page.getEditModeButton().should('be.visible');
    page.getEditModeButton().click();
    page.getAddWidgetButton().should('be.visible');
    page.getAddWidgetButton().click();
    page.addNewWidget('My Own Widget 1').click();
    page.getAddWidgetSaveButton().click();
    page.getEditWidgetIcon().click();
    page.getConfigureWidgetMenu().click();
    page.getShowWidgetTitleCheckbox().click();
    page.getEditWidgetSaveButton().click();
    page.getWidgetTitle().should('not.exist');
  });

  it('should check if the widget title is displayed', () => {
    page.getEditWidgetIcon().click();
    page.getConfigureWidgetMenu().click();
    page.getShowWidgetTitleCheckbox().click();
    page.getEditWidgetSaveButton().click();
    page.getWidgetTitle().should('exist');
  });
});
