import { defineDockerServersConfig , FtrConfigProviderContext } from '@kbn/test' ; import cypress from 'cypress' ; import path from 'path' ; import { cypressStart } from './cypress_start' ; import { packageRegistryPort } from './ftr_config' ; import { FtrProviderContext } from './ftr_provider_context' ; export const dockerImage = 'docker.elastic.co/package-registry/distribution@sha256:de952debe048d903fc73e8a4472bb48bb95028d440cba852f21b863d47020c61' ; async function ftrConfigRun ( { readConfigFile } ) { const kibanaConfig = await readConfigFile ( require . resolve ( './ftr_config.ts' ) ) ; const dockerArgs = [ '-v' , `${ path . join ( path . dirname ( __filename ) , './apis/fixtures/package_registry_config.yml' ) }:/package-registry/config.yml` , ] ; return { ... kibanaConfig . getAll ( ) , testRunner , dockerServers : defineDockerServersConfig ( { registry : { enabled : true , image : dockerImage , portInContainer : 8080 , port : packageRegistryPort , args : dockerArgs , waitForLogLine : 'package manifests loaded' , } , } ) , } ; } async function testRunner ( { getService } ) { const result = await cypressStart ( getService , cypress . run ) ; if ( result && ( result . status === 'failed' || result . totalFailed > 0 ) ) { throw new Error ( `APM Cypress tests failed` ) ; } } export default ftrConfigRun ;