import { by , browser } from 'protractor' ; import { Component } from '../component' ; import { UserInfo } from './user-info' ; import { Menu } from '../menu/menu' ; import { Toolbar } from './../toolbar/toolbar' ; import { SearchInput } from '../search/search-input' ; import { waitElement } from '../../utilities/utils' ; import { BrowserActions } from '@alfresco/adf-testing' ; export class Header extends Component { logoLink = this . byCss ( '.app-menu__title' ) ; moreActions = browser . element ( by . id ( 'app.header.more' ) ) ; sidenavToggle = this . byCss ( `[id='adf-sidebar-toggle-start']` ) ; userInfo = new UserInfo ( ) ; menu = new Menu ( ) ; toolbar = new Toolbar ( ) ; searchInput = new SearchInput ( ) ; constructor ( ancestor ? ) { super ( 'adf-layout-header' , ancestor ) ; } async openMoreMenu ( ) { await BrowserActions . click ( this . moreActions ) ; await this . menu . waitForMenuToOpen ( ) ; } async closeMoreMenu ( ) { await BrowserActions . click ( this . moreActions ) ; await this . menu . waitForMenuToClose ( ) ; } async isSidenavExpanded ( ) { return browser . isElementPresent ( by . css ( `[data-automation-id='expanded']` ) ) ; } async expandSideNav ( ) { const expanded = await this . isSidenavExpanded ( ) ; if ( ! expanded ) { await BrowserActions . click ( this . sidenavToggle ) ; await waitElement ( `[data-automation-id='expanded']` ) ; } } async collapseSideNav ( ) { const expanded = await this . isSidenavExpanded ( ) ; if ( expanded ) { await BrowserActions . click ( this . sidenavToggle ) ; await waitElement ( `[data-automation-id='collapsed']` ) ; } } }