diff --git a/x-pack/test/reporting_api_integration/reporting_and_security/screenshot/network_policy.ts b/x-pack/test/reporting_api_integration/reporting_and_security/screenshot/network_policy.ts index f608c8b7f250a..59ce1dfbf4b89 100644 --- a/x-pack/test/reporting_api_integration/reporting_and_security/screenshot/network_policy.ts +++ b/x-pack/test/reporting_api_integration/reporting_and_security/screenshot/network_policy.ts @@ -18,7 +18,7 @@ export default function ({ getService }: FtrProviderContext) { * The tests server config implements a network policy that is designed to disallow the following Canvas worksheet */ // Failing: See https://github.com/elastic/kibana/issues/193433 - describe.skip('Network Policy', () => { + describe.only('Network Policy', () => { before(async () => { await reportingAPI.initLogs(); // includes a canvas worksheet with an offending image URL }); @@ -27,20 +27,24 @@ export default function ({ getService }: FtrProviderContext) { await reportingAPI.teardownLogs(); }); - it('should fail job when page violates the network policy', async () => { + it('should fail job when page violates the network policy', async (done) => { const downloadPath = await reportingAPI.postJob( `/api/reporting/generate/printablePdfV2?jobParams=(layout:(dimensions:(height:720,width:1080),id:preserve_layout),locatorParams:!((id:CANVAS_APP_LOCATOR,params:(id:workpad-e7464259-0b75-4b8c-81c8-8422b15ff201,page:1,view:workpadPDF),version:'8.16.0')),objectType:'canvas workpad',title:'Workpad of Death',version:'8.16.0')` ); - // Retry the download URL until a "failed" response status is returned - let body: any; - await retry.tryForTime(120000, async () => { - body = (await supertest.get(downloadPath).expect(500)).body; - }); + try { + // Retry the download URL until a "failed" response status is returned + let body: any; + await retry.tryForTime(120000, async () => { + body = (await supertest.get(downloadPath).expect(500)).body; + }); - expect(body.message).to.match( - /Reporting generation failed: ReportingError\(code: disallowed_outgoing_url_error\)/ - ); + expect(body.message).to.match( + /Reporting generation failed: ReportingError\(code: disallowed_outgoing_url_error\)/ + ); + } catch (err) { + done(err); + } }); }); }