import { browser } from 'protractor' ; import { AlfrescoApi } from '@alfresco/js-api' ; import { Logger } from '@alfresco/adf-testing' ; export abstract class RepoApi { alfrescoJsApi = new AlfrescoApi ( ) ; protected constructor ( public username = browser . params . ADMIN_USERNAME , private password = browser . params . ADMIN_PASSWORD ) { this . alfrescoJsApi . setConfig ( browser . params . config ) ; } apiAuth ( ) { return this . alfrescoJsApi . login ( this . username , this . password ) ; } protected handleError ( message , response ) { Logger . error ( `\n--- ${ message } error :` ) ; Logger . error ( '\t>>> username: ' , this . username ) ; Logger . error ( '\t>>> JSON: ' , JSON . stringify ( browser . params . config ) ) ; if ( response . status && response . response ) { try { Logger . error ( '\t>>> Status: ' , response . status ) ; Logger . error ( '\t>>> Text: ' , response . response . text ) ; Logger . error ( '\t>>> Method: ' , response . response . error . method ) ; Logger . error ( '\t>>> Path: ' , response . response . error . path ) ; } catch { Logger . error ( '\t>>> ' , response ) ; } } else Logger . error ( '\t>>> ' , response ) ; } }