import { $ , $$ , browser } from 'protractor' ; export namespace SearchBuilderPage { export class Page { async getPage ( ) { await browser . get ( '#/search-builder' ) ; } query = $ ( 'pre' ) ; buttons = $$ ( '.search-builder-group-add-field' ) ; textButton = this . buttons . get ( 0 ) ; anyButton = this . buttons . get ( 1 ) ; allButton = this . buttons . get ( 2 ) ; noneButton = this . buttons . get ( 3 ) ; setQueryBtn = $ ( '#set-query' ) ; setInvalidQueryBtn = $ ( '#set-invalid-query' ) ; validity = $ ( '#validity' ) ; async getQueryObject ( ) { return JSON . parse ( await this . query . getText ( ) ) ; } async addTextField ( ) { return this . textButton . click ( ) ; } async addDateField ( ) { return this . anyButton . click ( ) ; } async addDateRangeField ( ) { return this . allButton . click ( ) ; } async addSelectField ( ) { return this . noneButton . click ( ) ; } async setQuery ( ) { return this . setQueryBtn . click ( ) ; } async setInvalidQuery ( ) { return this . setInvalidQueryBtn . click ( ) ; } async getValid ( ) { let valid = await this . validity . getText ( ) ; return valid === 'valid' ; } } }