Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a0c3f01
[ska] relocate security svl ui and api tests
dmlemeshko Aug 11, 2025
785808a
[CI] Auto-commit changed files from 'ts-node .buildkite/pipeline-reso…
kibanamachine Aug 11, 2025
1b94185
Merge branch 'main' into ska/relocate-security-svl-ui-and-api-tests
dmlemeshko Aug 11, 2025
4b60c54
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 11, 2025
0e1d080
update codeowners
dmlemeshko Aug 11, 2025
3355e3b
relocate ftr service and fix imports
dmlemeshko Aug 11, 2025
46435f2
Merge branch 'main' into ska/relocate-security-svl-ui-and-api-tests
dmlemeshko Aug 11, 2025
ac4c0fc
rename PO variable
dmlemeshko Aug 11, 2025
72bcc5b
Merge branch 'ska/relocate-security-svl-ui-and-api-tests' of github.c…
dmlemeshko Aug 11, 2025
ae15bbd
relocate security_solution_api.gen service
dmlemeshko Aug 11, 2025
09286e4
Merge branch 'main' into ska/relocate-security-svl-ui-and-api-tests
dmlemeshko Aug 11, 2025
a9e96ee
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 11, 2025
0e88051
Update index.ts
dmlemeshko Aug 11, 2025
1198969
Merge branch 'main' into ska/relocate-security-svl-ui-and-api-tests
dmlemeshko Aug 11, 2025
a3334ac
load securitySolutionApi service in svl config
dmlemeshko Aug 11, 2025
d11690f
Merge branch 'main' into ska/relocate-security-svl-ui-and-api-tests
dmlemeshko Aug 11, 2025
fd5cae6
Update security svl configs CODEOWNERS
dmlemeshko Aug 12, 2025
41373e7
Merge branch 'main' into ska/relocate-security-svl-ui-and-api-tests
dmlemeshko Aug 12, 2025
1870cb1
Merge branch 'main' into ska/relocate-security-svl-ui-and-api-tests
dmlemeshko Aug 12, 2025
83b9010
Merge branch 'main' into ska/relocate-security-svl-ui-and-api-tests
dmlemeshko Aug 13, 2025
d1c5649
Merge remote-tracking branch 'upstream/main' into ska/relocate-securi…
dmlemeshko Aug 13, 2025
1b2566a
[CI] Auto-commit changed files from 'node scripts/styled_components_m…
kibanamachine Aug 13, 2025
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
22 changes: 11 additions & 11 deletions .buildkite/ftr_security_serverless_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ disabled:
- x-pack/solutions/security/test/security_solution_playwright/serverless_config.ts

# MKI only configs files
- x-pack/test_serverless/functional/test_suites/security/config.mki_only.ts
- x-pack/solutions/security/test/serverless/functional/configs/config.mki_only.ts

# Detection Rules Management base configs
- x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/configs/serverless/rules_management.essentials.config.ts
- x-pack/test/security_solution_api_integration/test_suites/detections_response/rules_management/configs/serverless/rules_management.complete.config.ts

defaultQueue: 'n2-4-spot'
enabled:
- x-pack/test_serverless/api_integration/test_suites/security/config.ts
- x-pack/test_serverless/api_integration/test_suites/security/config.feature_flags.ts
- x-pack/solutions/security/test/serverless/api_integration/configs/config.ts
- x-pack/solutions/security/test/serverless/api_integration/configs/config.feature_flags.ts
- x-pack/platform/test/serverless/api_integration/configs/security/config.group1.ts
- x-pack/test_serverless/api_integration/test_suites/security/fleet/config.ts
- x-pack/test_serverless/functional/test_suites/security/config.screenshots.ts
- x-pack/test_serverless/functional/test_suites/security/config.ts
- x-pack/solutions/security/test/serverless/api_integration/test_suites/fleet/config.ts
- x-pack/solutions/security/test/serverless/functional/configs/config.screenshots.ts
- x-pack/solutions/security/test/serverless/functional/configs/config.ts
- x-pack/platform/test/serverless/functional/configs/security/config.examples.ts
- x-pack/test_serverless/functional/test_suites/security/config.feature_flags.ts
- x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.basic.ts
- x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.essentials.ts
- x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.agentless.ts
- x-pack/solutions/security/test/serverless/functional/configs/config.feature_flags.ts
- x-pack/solutions/security/test/serverless/functional/configs/config.cloud_security_posture.basic.ts
- x-pack/solutions/security/test/serverless/functional/configs/config.cloud_security_posture.essentials.ts
- x-pack/solutions/security/test/serverless/functional/configs/config.cloud_security_posture.agentless.ts
- x-pack/platform/test/serverless/functional/configs/security/config.saved_objects_management.ts
- x-pack/test_serverless/functional/test_suites/security/config.context_awareness.ts
- x-pack/solutions/security/test/serverless/functional/configs/config.context_awareness.ts
- x-pack/platform/test/serverless/functional/configs/security/config.examples.context_awareness.ts
- x-pack/platform/test/serverless/functional/configs/security/config.config_compat_mode.ts
- x-pack/platform/test/serverless/functional/configs/security/config.group1.ts
Expand Down
65 changes: 28 additions & 37 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions x-pack/platform/plugins/shared/fleet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ The process for running serverless API integration tests is similar to above. Se
Security:

```sh
FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:server --config x-pack/test_serverless/api_integration/test_suites/security/fleet/config.ts
FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:runner --config x-pack/test_serverless/api_integration/test_suites/security/fleet/config.ts
FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:server --config x-pack/solutions/security/test/serverless/api_integration/test_suites/fleet/config.ts
FLEET_PACKAGE_REGISTRY_PORT=12345 yarn test:ftr:runner --config x-pack/solutions/security/test/serverless/api_integration/test_suites/fleet/config.ts
```

Observability:
Expand Down
80 changes: 80 additions & 0 deletions x-pack/platform/test/serverless/shared/lib/cases/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* 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.
*/

import { SECURITY_SOLUTION_OWNER } from '@kbn/cases-plugin/common';
import { AppDeepLinkId } from '@kbn/core-chrome-browser';
import { FtrProviderContext } from '../../../functional/ftr_provider_context';

export const createOneCaseBeforeDeleteAllAfter = (
getPageObject: FtrProviderContext['getPageObject'],
getService: FtrProviderContext['getService'],
owner: string
) => {
const svlCases = getService('svlCases');

before(async () => {
await createAndNavigateToCase(getPageObject, getService, owner);
});

after(async () => {
await svlCases.api.deleteAllCaseItems();
});
};

export const createOneCaseBeforeEachDeleteAllAfterEach = (
getPageObject: FtrProviderContext['getPageObject'],
getService: FtrProviderContext['getService'],
owner: string
) => {
const svlCases = getService('svlCases');

beforeEach(async () => {
await createAndNavigateToCase(getPageObject, getService, owner);
});

afterEach(async () => {
await svlCases.api.deleteAllCaseItems();
});
};

export const createAndNavigateToCase = async (
getPageObject: FtrProviderContext['getPageObject'],
getService: FtrProviderContext['getService'],
owner: string
) => {
const cases = getService('cases');

const header = getPageObject('header');

await navigateToCasesApp(getPageObject, getService, owner);

const theCase = await cases.api.createCase({ owner });
await cases.casesTable.waitForCasesToBeListed();
await cases.casesTable.goToFirstListedCase();
await header.waitUntilLoadingHasFinished();

return theCase;
};

export const navigateToCasesApp = async (
getPageObject: FtrProviderContext['getPageObject'],
getService: FtrProviderContext['getService'],
owner: string
) => {
const common = getPageObject('common');
const svlCommonNavigation = getPageObject('svlCommonNavigation');

await common.navigateToApp('landingPage');

if (owner === SECURITY_SOLUTION_OWNER) {
await svlCommonNavigation.sidenav.clickLink({
deepLinkId: 'securitySolutionUI:cases' as AppDeepLinkId,
});
} else {
await svlCommonNavigation.sidenav.clickLink({ deepLinkId: 'observability-overview:cases' });
}
};
8 changes: 8 additions & 0 deletions x-pack/platform/test/serverless/shared/lib/cases/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* 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.
*/

export * from './helpers';
1 change: 1 addition & 0 deletions x-pack/platform/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
"@kbn/console-plugin",
"@kbn/serverless-common-settings",
"@kbn/core-saved-objects-import-export-server-internal",
"@kbn/core-chrome-browser",
"@kbn/product-intercept-plugin",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ For general guidelines, read [Kibana Testing Guide](https://www.elastic.co/guide
1. [Serverless End-to-End Tests](../../../../test_serverless/functional/test_suites/security/config.ts)
1. [Cypress End-to-End Tests](../../../../test/security_solution_cypress/cypress/e2e/cloud_security_posture)


### Tools

Run **TypeScript**:
Expand All @@ -38,6 +37,7 @@ yarn lint:es x-pack/solutions/security/plugins/cloud_security_posture
```

Run **i18n check**:

```bash
node scripts/i18n_check.js
```
Expand All @@ -47,11 +47,11 @@ node scripts/i18n_check.js
> i18n should run on project scope as it checks translations files outside of our plugin.
>
> Fixes can be applied using the --fix flag
>
> 1. We shouldn't manually add/update/delete the localization files, nor change the translated strings.
> 2. The script will remove unused labels.
> 3. Regarding adding labels - this happens regularly and automated for the whole Kibana repository outside of our flows.


Run [**Unit Tests**](https://www.elastic.co/guide/en/kibana/current/development-tests.html#_unit_testing):

```bash
Expand All @@ -67,20 +67,22 @@ Run [**API Integration Tests**](https://docs.elastic.dev/kibana-dev-docs/tutoria
```bash
yarn test:ftr --config x-pack/solutions/security/test/cloud_security_posture_api/config.ts
yarn test:ftr --config x-pack/test/api_integration/apis/cloud_security_posture/config.ts
yarn test:ftr --config x-pack/test_serverless/api_integration/test_suites/security/config.ts --include-tag=cloud_security_posture
yarn test:ftr --config x-pack/solutions/security/test/serverless/api_integration/configs/config.ts --include-tag=cloud_security_posture
```

Run [**End-to-End Tests**](https://www.elastic.co/guide/en/kibana/current/development-tests.html#_running_functional_tests):

```bash
yarn test:ftr --config x-pack/solutions/security/test/cloud_security_posture_functional/config.ts
yarn test:ftr --config x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.ts
yarn test:ftr --config x-pack/solutions/security/test/serverless/functional/configs/config.cloud_security_posture.ts
```

Run [**End-to-End Cypress Tests**](https://github.com/elastic/kibana/tree/main/x-pack/test/security_solution_cypress/cypress):

> **Note**
>
> Run this from security_solution_cypress folder

```bash
yarn cypress:open:serverless
yarn cypress:open:ess
Expand All @@ -95,54 +97,64 @@ Functional test runner (FTR) can be used separately with `ftr:runner` and `ftr:s
For example,

run ESS (stateful) api integration tests:

```bash
yarn test:ftr:server --config x-pack/test/api_integration/config.ts
yarn test:ftr:runner --config x-pack/test/api_integration/apis/cloud_security_posture/config.ts
```

run ESS (stateful) telemetry integration tests:

```bash
yarn test:ftr:server --config x-pack/solutions/security/test/cloud_security_posture_api/config.ts
yarn test:ftr:runner --config x-pack/solutions/security/test/cloud_security_posture_api/config.ts
```

run ESS (stateful) e2e tests:

```bash
yarn test:ftr:server --config x-pack/solutions/security/test/cloud_security_posture_functional/config.ts
yarn test:ftr:runner --config x-pack/solutions/security/test/cloud_security_posture_functional/config.ts
```

run serverless api integration tests:

```bash
yarn test:ftr:server --config x-pack/test_serverless/api_integration/test_suites/security/config.ts
yarn test:ftr:runner --config x-pack/test_serverless/api_integration/test_suites/security/config.ts --include-tag=cloud_security_posture
yarn test:ftr:server --config x-pack/solutions/security/test/serverless/api_integration/configs/config.ts
yarn test:ftr:runner --config x-pack/solutions/security/test/serverless/api_integration/configs/config.ts --include-tag=cloud_security_posture
```

run serverless e2e tests:

```bash
yarn test:ftr:server --config x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.ts
yarn test:ftr:runner ---config x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.ts
yarn test:ftr:server --config x-pack/solutions/security/test/serverless/functional/configs/config.cloud_security_posture.ts
yarn test:ftr:runner ---config x-pack/solutions/security/test/serverless/functional/configs/config.cloud_security_posture.ts
```

#### Run **Cypress tests (e2e) for development**

When developing feature outside our plugin folder, instead of using FTRs for e2e test, we may use Cypress. Before running cypress, make sure you have installed it first. Like FTRs, we can run cypress in different environment, for example:

run ess e2e tests:

```bash
yarn cypress:open:ess
```

run ess Cloud Security Posture e2e tests:

```bash
yarn cypress:cloud_security_posture:run:ess
```

run serverless e2e tests:

```bash
yarn cypress:open:serverless
```

run serverless Cloud Security Posture e2e tests:

```bash
yarn cypress:cloud_security_posture:run:serverless
```
Expand All @@ -154,6 +166,7 @@ Unlike FTR where we have to set server and runner separately, Cypress handles ev
If you encounter an error related to running machine learning code, you should add the following string `'xpack.ml.enabled=false'` under the `esTestCluster` property in the `x-pack/test/functional/config.base.js` file.

Example:

```javascript
module.exports = {
esTestCluster: {
Expand All @@ -165,3 +178,4 @@ module.exports = {
},
// ...other configurations...
};
```
Loading