2020-03-03 17:51:35 +01:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
|
|
* 2.0.
|
2020-03-03 17:51:35 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
import { resolve } from 'path';
|
|
|
|
import Url from 'url';
|
|
|
|
|
|
|
|
import { withProcRunner } from '@kbn/dev-utils';
|
|
|
|
|
|
|
|
import { FtrProviderContext } from './ftr_provider_context';
|
|
|
|
|
2020-09-07 13:26:41 +02:00
|
|
|
export async function SecuritySolutionCypressCliTestRunner({ getService }: FtrProviderContext) {
|
2020-03-03 17:51:35 +01:00
|
|
|
const log = getService('log');
|
|
|
|
const config = getService('config');
|
|
|
|
const esArchiver = getService('esArchiver');
|
|
|
|
|
2021-06-08 23:37:42 +02:00
|
|
|
await esArchiver.load('x-pack/test/security_solution_cypress/es_archives/auditbeat');
|
2020-03-03 17:51:35 +01:00
|
|
|
|
2020-05-22 09:08:58 +02:00
|
|
|
await withProcRunner(log, async (procs) => {
|
2020-03-03 17:51:35 +01:00
|
|
|
await procs.run('cypress', {
|
|
|
|
cmd: 'yarn',
|
|
|
|
args: ['cypress:run'],
|
2020-06-04 11:35:13 +02:00
|
|
|
cwd: resolve(__dirname, '../../plugins/security_solution'),
|
2020-03-03 17:51:35 +01:00
|
|
|
env: {
|
|
|
|
FORCE_COLOR: '1',
|
2020-08-05 17:32:19 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
2020-03-03 17:51:35 +01:00
|
|
|
CYPRESS_baseUrl: Url.format(config.get('servers.kibana')),
|
2020-11-19 22:02:03 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
CYPRESS_protocol: config.get('servers.kibana.protocol'),
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
CYPRESS_hostname: config.get('servers.kibana.hostname'),
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
CYPRESS_configport: config.get('servers.kibana.port'),
|
2020-03-10 21:03:48 +01:00
|
|
|
CYPRESS_ELASTICSEARCH_URL: Url.format(config.get('servers.elasticsearch')),
|
2020-03-03 17:51:35 +01:00
|
|
|
CYPRESS_ELASTICSEARCH_USERNAME: config.get('servers.elasticsearch.username'),
|
2021-02-22 17:48:43 +01:00
|
|
|
CYPRESS_ELASTICSEARCH_PASSWORD: config.get('servers.elasticsearch.password'),
|
|
|
|
CYPRESS_KIBANA_URL: Url.format({
|
|
|
|
protocol: config.get('servers.kibana.protocol'),
|
|
|
|
hostname: config.get('servers.kibana.hostname'),
|
|
|
|
port: config.get('servers.kibana.port'),
|
|
|
|
}),
|
|
|
|
...process.env,
|
|
|
|
},
|
|
|
|
wait: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function SecuritySolutionCypressCliFirefoxTestRunner({
|
|
|
|
getService,
|
|
|
|
}: FtrProviderContext) {
|
|
|
|
const log = getService('log');
|
|
|
|
const config = getService('config');
|
|
|
|
const esArchiver = getService('esArchiver');
|
|
|
|
|
2021-06-08 23:37:42 +02:00
|
|
|
await esArchiver.load('x-pack/test/security_solution_cypress/es_archives/auditbeat');
|
2021-02-22 17:48:43 +01:00
|
|
|
|
|
|
|
await withProcRunner(log, async (procs) => {
|
|
|
|
await procs.run('cypress', {
|
|
|
|
cmd: 'yarn',
|
|
|
|
args: ['cypress:run:firefox'],
|
|
|
|
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')),
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
CYPRESS_protocol: config.get('servers.kibana.protocol'),
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
CYPRESS_hostname: config.get('servers.kibana.hostname'),
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
CYPRESS_configport: config.get('servers.kibana.port'),
|
|
|
|
CYPRESS_ELASTICSEARCH_URL: Url.format(config.get('servers.elasticsearch')),
|
|
|
|
CYPRESS_ELASTICSEARCH_USERNAME: config.get('servers.elasticsearch.username'),
|
2020-03-03 17:51:35 +01:00
|
|
|
CYPRESS_ELASTICSEARCH_PASSWORD: config.get('servers.elasticsearch.password'),
|
2020-11-19 22:02:03 +01:00
|
|
|
CYPRESS_KIBANA_URL: Url.format({
|
|
|
|
protocol: config.get('servers.kibana.protocol'),
|
|
|
|
hostname: config.get('servers.kibana.hostname'),
|
|
|
|
port: config.get('servers.kibana.port'),
|
|
|
|
}),
|
2020-03-03 17:51:35 +01:00
|
|
|
...process.env,
|
|
|
|
},
|
|
|
|
wait: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2020-09-07 13:26:41 +02:00
|
|
|
|
|
|
|
export async function SecuritySolutionCypressVisualTestRunner({ getService }: FtrProviderContext) {
|
|
|
|
const log = getService('log');
|
|
|
|
const config = getService('config');
|
|
|
|
const esArchiver = getService('esArchiver');
|
|
|
|
|
2021-06-08 23:37:42 +02:00
|
|
|
await esArchiver.load('x-pack/test/security_solution_cypress/es_archives/empty_kibana');
|
|
|
|
await esArchiver.load('x-pack/test/security_solution_cypress/es_archives/auditbeat');
|
2020-09-07 13:26:41 +02:00
|
|
|
|
|
|
|
await withProcRunner(log, async (procs) => {
|
|
|
|
await procs.run('cypress', {
|
|
|
|
cmd: 'yarn',
|
|
|
|
args: ['cypress:open'],
|
|
|
|
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')),
|
2020-11-19 22:02:03 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
CYPRESS_protocol: config.get('servers.kibana.protocol'),
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
CYPRESS_hostname: config.get('servers.kibana.hostname'),
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
CYPRESS_configport: config.get('servers.kibana.port'),
|
2020-09-07 13:26:41 +02:00
|
|
|
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'),
|
2020-11-19 22:02:03 +01:00
|
|
|
CYPRESS_KIBANA_URL: Url.format({
|
|
|
|
protocol: config.get('servers.kibana.protocol'),
|
|
|
|
hostname: config.get('servers.kibana.hostname'),
|
|
|
|
port: config.get('servers.kibana.port'),
|
|
|
|
}),
|
2020-09-07 13:26:41 +02:00
|
|
|
...process.env,
|
|
|
|
},
|
|
|
|
wait: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|