import { $$ , browser , by , element , ElementFinder } from 'protractor' ; export class NotificationPage { showNotificationButton = element ( by . id ( 'show-notification' ) ) ; showNotificationWithSpacingButton = element ( by . id ( 'show-notification-spacing' ) ) ; dismissAllButton = element ( by . id ( 'dismiss-all' ) ) ; directionBelowButton = element ( by . id ( 'direction-below' ) ) ; positionTopLeftButton = element ( by . id ( 'position-top-left' ) ) ; positionBottomLeftButton = element ( by . id ( 'position-bottom-left' ) ) ; positionBottomRightButton = element ( by . id ( 'position-bottom-right' ) ) ; async getPage ( ) { await browser . get ( '#/notification' ) ; } async getNotificationCount ( ) { return $$ ( '.notification' ) . count ( ) ; } getNotification ( index ) { const notifications = $$ ( '.notification' ) ; return notifications . get ( index ) ; } async getNotificationTitle ( index ) { const notification = this . getNotification ( index ) ; return ( await notification . $ ( '.notification-title' ) . getText ( ) ) . toUpperCase ( ) ; } async clickNotificationDismiss ( index ) { const notification = this . getNotification ( index ) ; const dismissButton = notification . $ ( '.dismiss ux-icon' ) ; return await dismissButton . click ( ) ; } async getNotificationTopPosition ( index ) { const notification = this . getNotification ( index ) ; const location = await notification . getLocation ( ) ; return location . y ; } async getNotificationBottomPosition ( index ) { const notification = this . getNotification ( index ) ; const location = await notification . getLocation ( ) ; const size = await notification . getSize ( ) ; return location . y + size . height ; } }