import { $ , browser , ElementFinder } from 'protractor' ; export class NavigationPage { topFocus = $ ( '#top-focus' ) ; navigation = $ ( 'ux-navigation' ) ; pageContent = $ ( '#page-content' ) ; enableTreeBtn = $ ( '#enable-tree-btn' ) ; enableAutoCollapse = $ ( '#enable-auto-collapse-btn' ) ; disableExact = $ ( '#disable-exact' ) ; disableOptions = $ ( '#disable-options' ) ; optionsClicked = $ ( '#options-clicked' ) ; async getPage ( ) { await browser . get ( '#/navigation' ) ; } async getTopLevelItems ( ) { return await this . navigation . $$ ( '.ux-side-nav > .nav > li' ) ; } async isItemActive ( item ) { const classes = await item . getAttribute ( 'class' ) ; return classes . split ( ' ' ) . indexOf ( 'active' ) !== - 1 ; } async isItemDisabled ( item ) { const classes = await item . getAttribute ( 'class' ) ; return classes . split ( ' ' ) . indexOf ( 'disabled' ) !== - 1 ; } async isItemSelected ( item ) { const classes = await item . getAttribute ( 'class' ) ; return classes . split ( ' ' ) . indexOf ( 'selected' ) !== - 1 ; } async isItemFocused ( item ) { const classes = await item . $ ( 'a' ) . getAttribute ( 'class' ) ; return classes . split ( ' ' ) . indexOf ( 'ux-focus-indicator-active' ) !== - 1 ; } async getItemChildren ( item ) { return item . $$ ( 'ol > li' ) ; } async getPageContent ( ) { return await this . pageContent . getText ( ) ; } async getOptionsClicked ( ) { return await this . optionsClicked . getText ( ) ; } async selectItem ( item ) { await item . $ ( item . locator ( ) . value + ' > a' ) . click ( ) ; } async isTreeModeActive ( ) { const classes = await this . navigation . $ ( '.ux-side-nav' ) . getAttribute ( 'class' ) ; return classes . split ( ' ' ) . indexOf ( 'tree' ) !== - 1 ; } }