diff --git a/x-pack/test/security_solution_cypress/runner.ts b/x-pack/test/security_solution_cypress/runner.ts index a197d4579b13287..9224ec8bb50b72e 100644 --- a/x-pack/test/security_solution_cypress/runner.ts +++ b/x-pack/test/security_solution_cypress/runner.ts @@ -12,17 +12,33 @@ import { withProcRunner } from '@kbn/dev-utils'; import { FtrProviderContext } from './ftr_provider_context'; export async function SecuritySolutionCypressCliTestRunner({ getService }: FtrProviderContext) { - await SecuritySolutionCypressTestRunner('run', { getService }); -} + const log = getService('log'); + const config = getService('config'); + const esArchiver = getService('esArchiver'); -export async function SecuritySolutionCypressVisualTestRunner({ getService }: FtrProviderContext) { - await SecuritySolutionCypressTestRunner('open', { getService }); + await esArchiver.load('empty_kibana'); + await esArchiver.load('auditbeat'); + + await withProcRunner(log, async (procs) => { + await procs.run('cypress', { + cmd: 'yarn', + args: [`cypress:${argument}`], + cwd: resolve(__dirname, '../../plugins/security_solution'), + env: { + FORCE_COLOR: '1', + // eslint-disable-next-line @typescript-eslint/naming-convention + CYPRESS_baseUrl: Url.format(config.get('servers.kibana')), + CYPRESS_ELASTICSEARCH_URL: Url.format(config.get('servers.elasticsearch')), + CYPRESS_ELASTICSEARCH_USERNAME: config.get('servers.elasticsearch.username'), + CYPRESS_ELASTICSEARCH_PASSWORD: config.get('servers.elasticsearch.password'), + ...process.env, + }, + wait: true, + }); + }); } -export async function SecuritySolutionCypressTestRunner( - argument: string, - { getService }: FtrProviderContext -) { +export async function SecuritySolutionCypressVisualTestRunner({ getService }: FtrProviderContext) { const log = getService('log'); const config = getService('config'); const esArchiver = getService('esArchiver');