import expect from '@kbn/expect' ; import { FtrProviderContext } from '../ftr_provider_context' ; export default function ( { getService } ) { const reportingAPI = getService ( 'reportingAPI' ) ; const retry = getService ( 'retry' ) ; const supertest = getService ( 'supertest' ) ; describe ( 'Network Policy' , ( ) => { before ( async ( ) => { await reportingAPI . initLogs ( ) ; } ) ; after ( async ( ) => { await reportingAPI . teardownLogs ( ) ; } ) ; it ( 'should fail job when page voilates the network policy' , async ( ) => { const downloadPath = await reportingAPI . postJob ( `/api/reporting/generate/printablePdf?jobParams=(layout:(dimensions:(height:720,width:1080),id:preserve_layout),objectType:'canvas%20workpad',relativeUrls:!(%2Fapp%2Fcanvas%23%2Fexport%2Fworkpad%2Fpdf%2Fworkpad-e7464259-0b75-4b8c-81c8-8422b15ff201%2Fpage%2F1),title:'My%20Canvas%20Workpad')` ) ; await retry . tryForTime ( 120000 , async ( ) => { const { body } = await supertest . get ( downloadPath ) . expect ( 500 ) ; expect ( body . message ) . to . match ( /Reporting generation failed: Error:/ ) ; } ) ; } ) ; } ) ; }