Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Osquery][Ops] Move Osquery/cypress configurations close to cypress #167428

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import path from 'path';
import { safeLoad as loadYaml } from 'js-yaml';
import { readFileSync } from 'fs';

import type { YamlRoleDefinitions } from '../../test_serverless/shared/lib';
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
import { setupUserDataLoader } from '../../test_serverless/functional/test_suites/security/cypress/support/setup_data_loader_tasks';
import type { YamlRoleDefinitions } from '../../../test_serverless/shared/lib';
import { setupUserDataLoader } from '../../../test_serverless/functional/test_suites/security/cypress/support/setup_data_loader_tasks';
const ROLES_YAML_FILE_PATH = path.join(
`${__dirname}/cypress/support`,
'project_controller_osquery_roles.yml'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/

import { defineCypressConfig } from '@kbn/cypress-config';
// eslint-disable-next-line @kbn/imports/no_boundary_crossing
import { setupUserDataLoader } from '../../test_serverless/functional/test_suites/security/cypress/support/setup_data_loader_tasks';
import { setupUserDataLoader } from '../../../test_serverless/functional/test_suites/security/cypress/support/setup_data_loader_tasks';

// eslint-disable-next-line import/no-default-export
export default defineCypressConfig({
Expand Down
15 changes: 9 additions & 6 deletions x-pack/plugins/osquery/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@
// ***********************************************************

// force ESM in this module
import type { SecuritySolutionDescribeBlockFtrConfig } from '@kbn/security-solution-plugin/scripts/run_cypress/utils';

export {};

import 'cypress-react-selector';
// This module has some interesting ways of importing, check out the options in:
// https://github.com/cypress-io/cypress/blob/0871b03c5b21711cd23056454da8f23dcaca4950/npm/grep/README.md#support-file
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Ikuni17 marked this conversation as resolved.
Show resolved Hide resolved
import registerCypressGrep from '@cypress/grep';
registerCypressGrep();

import { login } from '../../../../test_serverless/functional/test_suites/security/cypress/tasks/login';
import type { SecuritySolutionDescribeBlockFtrConfig } from '@kbn/security-solution-plugin/scripts/run_cypress/utils';
import type { ServerlessRoleName } from './roles';

registerCypressGrep();
import 'cypress-react-selector';
import { login } from '../../../../test_serverless/functional/test_suites/security/cypress/tasks/login';

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
Expand Down Expand Up @@ -72,7 +75,7 @@ Cypress.Commands.add(
() => cy.get('body').click(0, 0) // 0,0 here are the x and y coordinates
);

Cypress.Commands.add('login', login);
Cypress.Commands.add('login', () => login());

// Alternatively you can use CommonJS syntax:
// require('./commands')
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/osquery/cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"extends": "../../../../tsconfig.base.json",
"include": [
"**/*",
"../cypress.config.ts",
"../serverless_cypress.config.ts",
"./cypress.config.ts",
"./serverless_cypress.config.ts",
"../../../test_serverless/shared/lib"
],
"exclude": [
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/osquery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"scripts": {
"cypress:burn": "yarn cypress:run --env burn=2 --headed",
"cypress:changed-specs-only": "yarn cypress:run --changed-specs-only --env burn=2",
"cypress": "NODE_OPTIONS=--openssl-legacy-provider node ../security_solution/scripts/start_cypress_parallel --config-file ../osquery/cypress.config.ts --ftr-config-file ../../../x-pack/test/osquery_cypress/cli_config",
"cypress": "NODE_OPTIONS=--openssl-legacy-provider node ../security_solution/scripts/start_cypress_parallel --config-file cypress/cypress.config.ts --ftr-config-file ../../../x-pack/test/osquery_cypress/cli_config",
"cypress:open": "yarn cypress open",
"cypress:run": "yarn cypress run",
"cypress:serverless": "NODE_OPTIONS=--openssl-legacy-provider node ../security_solution/scripts/start_cypress_parallel --config-file ../osquery/serverless_cypress.config.ts --ftr-config-file ../../../x-pack/test/osquery_cypress/serverless_cli_config",
"cypress:serverless": "NODE_OPTIONS=--openssl-legacy-provider node ../security_solution/scripts/start_cypress_parallel --config-file cypress/serverless_cypress.config.ts --ftr-config-file ../../../x-pack/test/osquery_cypress/serverless_cli_config",
"cypress:serverless:open": "yarn cypress:serverless open",
"cypress:serverless:run": "yarn cypress:serverless run",
"nyc": "../../../node_modules/.bin/nyc report --reporter=text-summary",
Expand Down
10 changes: 3 additions & 7 deletions x-pack/plugins/osquery/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"outDir": "target/types"
},
"exclude": [
"cypress.config.ts",
"serverless_cypress.config.ts",
"target/**/*",
"target/**/*"
],
"include": [
// add all the folders contains files to be compiled
Expand All @@ -15,8 +13,6 @@
"scripts/**/*",
"scripts/**/**.json",
"server/**/*",
"cypress.config.ts",
"serverless_cypress.config.ts",
"../../../typings/**/*",
// ECS and Osquery schema files
"public/common/schemas/*/**.json",
Expand Down Expand Up @@ -77,6 +73,6 @@
"@kbn/core-saved-objects-server",
"@kbn/monaco",
"@kbn/io-ts-utils",
"@kbn/shared-ux-page-kibana-template",
"@kbn/shared-ux-page-kibana-template"
]
}