import Path from 'path' ; const ES_ARCHIVE_DIR = '../../test/security_solution_cypress/es_archives' ; const CONFIG_PATH = '../../test/functional/config.js' ; const ES_URL = Cypress . env ( 'ELASTICSEARCH_URL' ) ; const KIBANA_URL = Cypress . config ( ) . baseUrl ; const CCS_ES_URL = Cypress . env ( 'CCS_ELASTICSEARCH_URL' ) ; const CCS_KIBANA_URL = Cypress . env ( 'CCS_KIBANA_URL' ) ; const NODE_TLS_REJECT_UNAUTHORIZED = '1' ; export const esArchiverLoad = ( folder ) => { const path = Path . join ( ES_ARCHIVE_DIR , folder ) ; cy . exec ( `node ../../../scripts/es_archiver load "${ path }" --config "${ CONFIG_PATH }" --es-url "${ ES_URL }" --kibana-url "${ KIBANA_URL }"` , { env : { NODE_TLS_REJECT_UNAUTHORIZED } } ) ; } ; export const esArchiverUnload = ( folder ) => { const path = Path . join ( ES_ARCHIVE_DIR , folder ) ; cy . exec ( `node ../../../scripts/es_archiver unload "${ path }" --config "${ CONFIG_PATH }" --es-url "${ ES_URL }" --kibana-url "${ KIBANA_URL }"` , { env : { NODE_TLS_REJECT_UNAUTHORIZED } } ) ; } ; export const esArchiverResetKibana = ( ) => { cy . exec ( `node ../../../scripts/es_archiver empty-kibana-index --config "${ CONFIG_PATH }" --es-url "${ ES_URL }" --kibana-url "${ KIBANA_URL }"` , { env : { NODE_TLS_REJECT_UNAUTHORIZED } , failOnNonZeroExit : false } ) ; } ; export const esArchiverCCSLoad = ( folder ) => { const path = Path . join ( ES_ARCHIVE_DIR , folder ) ; cy . exec ( `node ../../../scripts/es_archiver load "${ path }" --config "${ CONFIG_PATH }" --es-url "${ CCS_ES_URL }" --kibana-url "${ CCS_KIBANA_URL }"` , { env : { NODE_TLS_REJECT_UNAUTHORIZED } } ) ; } ; export const esArchiverCCSUnload = ( folder ) => { const path = Path . join ( ES_ARCHIVE_DIR , folder ) ; cy . exec ( `node ../../../scripts/es_archiver unload "${ path }" --config "${ CONFIG_PATH }" --es-url "${ CCS_ES_URL }" --kibana-url "${ CCS_KIBANA_URL }"` , { env : { NODE_TLS_REJECT_UNAUTHORIZED } } ) ; } ;