import { Util } from "../util" ; import { element , by } from "protractor" ; export class ViewerPage { closeButton = element ( by . css ( 'button[data-automation-id="adf-toolbar-back"]' ) ) ; checkFileContent ( pageNumber , text ) { let allPages = element . all ( by . css ( 'div[class="canvasWrapper"] > canvas' ) ) . first ( ) ; let pageLoaded = element . all ( by . css ( 'div[data-page-number="' + pageNumber + '"][data-loaded="true"]' ) ) . first ( ) ; let textLayerLoaded = element . all ( by . css ( 'div[data-page-number="' + pageNumber + '"] div[class="textLayer"] > span' ) ) . first ( ) ; let specificText = element . all ( by . cssContainingText ( 'div[data-page-number="' + pageNumber + '"] div[class="textLayer"] > span' , text ) ) . first ( ) ; Util . waitUntilElementIsVisible ( allPages ) ; Util . waitUntilElementIsVisible ( pageLoaded ) ; Util . waitUntilElementIsVisible ( textLayerLoaded ) ; Util . waitUntilElementIsVisible ( specificText ) ; } checkCloseButtonIsDisplayed ( ) { Util . waitUntilElementIsVisible ( this . closeButton ) ; } clickCloseButton ( ) { Util . waitUntilElementIsVisible ( this . closeButton ) ; return this . closeButton . click ( ) ; } }