Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
da74227
wip
tomsonpl Aug 14, 2023
e96b274
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Aug 14, 2023
ee821ed
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 14, 2023
c5348d0
test
tomsonpl Aug 14, 2023
a3f7c8f
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 14, 2023
10a72e1
Merge branch 'main' into cypress-login
tomsonpl Aug 14, 2023
bbc4605
test
tomsonpl Aug 14, 2023
429ca68
Merge branch 'main' into cypress-login
tomsonpl Aug 16, 2023
14d26f8
fix
tomsonpl Aug 16, 2023
6e9c3d8
fix
tomsonpl Aug 16, 2023
3bd9fd2
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 16, 2023
e1dc322
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Aug 16, 2023
054b9b0
test- add buildkite
tomsonpl Aug 16, 2023
e67fb56
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 16, 2023
cbdb767
Merge branch 'main' into cypress-login
tomsonpl Aug 16, 2023
453850e
fix
tomsonpl Aug 16, 2023
47a18c6
fix
tomsonpl Aug 16, 2023
41d6384
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 16, 2023
a0db043
fix
tomsonpl Aug 16, 2023
177bc0e
fix
tomsonpl Aug 16, 2023
d330bef
fix
tomsonpl Aug 16, 2023
7191f8d
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 16, 2023
e2da32c
fix
tomsonpl Aug 16, 2023
be09e33
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 16, 2023
585ce18
fix
tomsonpl Aug 16, 2023
c3770df
Merge branch 'main' into cypress-login
tomsonpl Aug 16, 2023
af5a765
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Aug 16, 2023
91544c6
fix
tomsonpl Aug 16, 2023
7880a5f
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 16, 2023
1e808a1
fix
tomsonpl Aug 16, 2023
ea3fd67
Merge branch 'main' into cypress-login
tomsonpl Aug 16, 2023
ac0907a
Merge branch 'main' into cypress-login
tomsonpl Aug 17, 2023
0af7a70
adjust tests
tomsonpl Aug 17, 2023
add5958
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 17, 2023
21bbb56
adjust tests
tomsonpl Aug 17, 2023
811e55e
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Aug 17, 2023
af108bc
adjust tests
tomsonpl Aug 17, 2023
dd0d5ba
fix
tomsonpl Aug 17, 2023
f8f08ef
fix
tomsonpl Aug 17, 2023
4e15ae5
fix
tomsonpl Aug 17, 2023
cad0189
fix
tomsonpl Aug 17, 2023
6f1d48c
fix
tomsonpl Aug 17, 2023
abd2dec
Merge branch 'main' into cypress-login
tomsonpl Aug 17, 2023
3ee6ff4
remove redundant config
tomsonpl Aug 17, 2023
416cbf9
test - split tests
tomsonpl Aug 17, 2023
ae711f0
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 17, 2023
38ef6fa
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Aug 17, 2023
cb01742
Merge branch 'main' into cypress-login
tomsonpl Aug 20, 2023
e1d326f
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 20, 2023
91d92d8
Merge branch 'main' into cypress-login
kibanamachine Aug 20, 2023
6e696c4
fix test, remove some isserverless
tomsonpl Aug 21, 2023
6359fd6
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 21, 2023
0375475
Merge branch 'main' into cypress-login
kibanamachine Aug 21, 2023
5c4c410
remove check for serverless from most places
tomsonpl Aug 21, 2023
386e1a1
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 21, 2023
fe8b13e
remove skip
tomsonpl Aug 21, 2023
98c8a65
add viewer role
tomsonpl Aug 21, 2023
214ef7e
remove yml file
tomsonpl Aug 21, 2023
d35aff0
fix integration login
tomsonpl Aug 21, 2023
e0f4fe2
fix integration login
tomsonpl Aug 21, 2023
42266f3
add applicaitons to soc_manager
tomsonpl Aug 21, 2023
bbf95cc
remove indices
tomsonpl Aug 21, 2023
5e38470
remove breadcrumb check
tomsonpl Aug 21, 2023
4ca976b
add additional rolenames
tomsonpl Aug 21, 2023
5e8ddc5
viewer
tomsonpl Aug 21, 2023
8e5cea6
remove isserverless
tomsonpl Aug 21, 2023
39067df
pass empty config
tomsonpl Aug 21, 2023
4c3c38b
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Aug 21, 2023
30ec676
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 21, 2023
68cfcc0
fix
tomsonpl Aug 21, 2023
783f79e
fix
tomsonpl Aug 21, 2023
e310070
Merge branch 'main' into cypress-login
tomsonpl Aug 21, 2023
29d0d4e
fix
tomsonpl Aug 21, 2023
4097329
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 21, 2023
0c71da5
fix tests
tomsonpl Aug 21, 2023
32a9d12
add savedObjectsManagement
tomsonpl Aug 22, 2023
58dfc14
multiliine height test fix
tomsonpl Aug 22, 2023
541a229
change string into enum
tomsonpl Aug 22, 2023
48f51d2
fix roles
tomsonpl Aug 22, 2023
2671d97
move roles
tomsonpl Aug 22, 2023
c39e693
fix export
tomsonpl Aug 22, 2023
13d5c91
rename roles to types
tomsonpl Aug 22, 2023
3107e3f
fix packs issue
tomsonpl Aug 22, 2023
fd8bd66
alert rule issue
tomsonpl Aug 22, 2023
f5588ed
get ruleName differently
tomsonpl Aug 22, 2023
8233637
change way to select rule
tomsonpl Aug 22, 2023
717ba85
remove wait
tomsonpl Aug 22, 2023
30d1203
fix flyout
tomsonpl Aug 22, 2023
d39e031
change ci job
tomsonpl Aug 23, 2023
9fadd64
Revert "change ci job"
tomsonpl Aug 23, 2023
75d81c1
Merge branch 'main' into cypress-login
tomsonpl Aug 23, 2023
b157854
fix
tomsonpl Aug 23, 2023
c8cf993
Merge remote-tracking branch 'origin/cypress-login' into cypress-login
tomsonpl Aug 23, 2023
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
1 change: 1 addition & 0 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ disabled:
- x-pack/plugins/observability_onboarding/e2e/ftr_config_runner.ts
- x-pack/plugins/observability_onboarding/e2e/ftr_config.ts
- x-pack/test/osquery_cypress/cli_config.ts
- x-pack/test/osquery_cypress/serverless_cli_config.ts
- x-pack/test/osquery_cypress/config.ts
- x-pack/test/osquery_cypress/visual_config.ts
- x-pack/test/security_solution_cypress/cli_config.ts
Expand Down
14 changes: 14 additions & 0 deletions .buildkite/pipelines/pull_request/osquery_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,17 @@ steps:
soft_fail: true
artifact_paths:
- "target/kibana-osquery/**/*"

- command: .buildkite/scripts/steps/functional/security_serverless_osquery.sh
label: 'Serverless Osquery Cypress Tests'
agents:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 50
parallelism: 6
retry:
automatic:
- exit_status: '*'
limit: 1
artifact_paths:
- "target/kibana-osquery/**/*"
1 change: 1 addition & 0 deletions .buildkite/scripts/pipelines/pull_request/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { execSync } from 'child_process';
import fs from 'fs';
import prConfigs from '../../../pull_requests.json';
import { areChangesSkippable, doAnyChangesMatch } from '#pipeline-utils';

const prConfig = prConfigs.jobs.find((job) => job.pipelineSlug === 'kibana-pull-request');

if (!prConfig) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -euo pipefail

source .buildkite/scripts/common/util.sh
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can replace this with

Suggested change
source .buildkite/scripts/common/util.sh
source .buildkite/scripts/steps/functional/common.sh

and remove lines 8 and 9. Sorry about the earlier suggestion, I got the abstraction layers mixed up.

source .buildkite/scripts/steps/functional/common_cypress.sh

.buildkite/scripts/bootstrap.sh
node scripts/build_kibana_platform_plugins.js

export JOB=kibana-osquery-cypress-serverless

echo "--- Security Osquery Serverless Cypress"

yarn --cwd x-pack/plugins/osquery cypress:serverless:run
21 changes: 21 additions & 0 deletions x-pack/plugins/osquery/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@

import { defineCypressConfig } from '@kbn/cypress-config';

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';
const ROLES_YAML_FILE_PATH = path.join(
`${__dirname}/cypress/support`,
'project_controller_osquery_roles.yml'
);
const roleDefinitions = loadYaml(readFileSync(ROLES_YAML_FILE_PATH, 'utf8')) as YamlRoleDefinitions;

export default defineCypressConfig({
defaultCommandTimeout: 60000,
execTimeout: 120000,
Expand All @@ -29,6 +42,9 @@ export default defineCypressConfig({
'cypress-react-selector': {
root: '#osquery-app',
},
grepFilterSpecs: true,
grepTags: '@ess',
grepOmitFiltered: true,
},

e2e: {
Expand All @@ -37,5 +53,10 @@ export default defineCypressConfig({
experimentalRunAllSpecs: true,
experimentalMemoryManagement: true,
numTestsKeptInMemory: 3,
setupNodeEvents(on, config) {
setupUserDataLoader(on, config, { roleDefinitions, additionalRoleName: 'viewer' });

return config;
},
},
});
11 changes: 5 additions & 6 deletions x-pack/plugins/osquery/cypress/e2e/all/add_integration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { tag } from '../../tags';
import {
cleanupPack,
cleanupAgentPolicy,
Expand All @@ -28,11 +29,9 @@ import {
interceptAgentPolicyId,
policyContainsIntegration,
} from '../../tasks/integrations';

import { login } from '../../tasks/login';
import { findAndClickButton, findFormFieldByRowsLabelAndType } from '../../tasks/live_query';

describe('ALL - Add Integration', () => {
describe('ALL - Add Integration', { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS] }, () => {
let savedQueryId: string;

before(() => {
Expand All @@ -42,7 +41,7 @@ describe('ALL - Add Integration', () => {
});

beforeEach(() => {
login();
cy.login('elastic');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to login as elastic on ESS?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to soc_manager in general + added a 'viewer' role. But to answer your question: we didn't have to change to elastic in ESS, it was done just for unification.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok this specific login is still elastic, as it was login() before. because we need more access to fleet here. the other tests are changed back into soc_manager.

});

after(() => {
Expand All @@ -63,7 +62,7 @@ describe('ALL - Add Integration', () => {
cy.get(`[url="${NAV_SEARCH_INPUT_OSQUERY_RESULTS.MANAGER}"]`).should('exist').click();
});

describe('Add and upgrade integration', () => {
describe('Add and upgrade integration', { tags: [tag.ESS] }, () => {
const oldVersion = '0.7.4';
const [integrationName, policyName] = generateRandomStringName(2);
let policyId: string;
Expand All @@ -78,7 +77,7 @@ describe('ALL - Add Integration', () => {
cleanupAgentPolicy(policyId);
});

it('should add the old integration and be able to upgrade it', () => {
it('should add the old integration and be able to upgrade it', { tags: tag.ESS }, () => {
cy.visit(createOldOsqueryPath(oldVersion));
addCustomIntegration(integrationName, policyName);
policyContainsIntegration(integrationName, policyName);
Expand Down
24 changes: 14 additions & 10 deletions x-pack/plugins/osquery/cypress/e2e/all/alerts_cases.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { LIVE_QUERY_EDITOR } from '../../screens/live_query';
import {
cleanupCase,
cleanupPack,
Expand All @@ -14,17 +15,18 @@ import {
loadRule,
packFixture,
} from '../../tasks/api_fixtures';
import { ROLE, login } from '../../tasks/login';
import {
addToCase,
checkActionItemsInResults,
clickRuleName,
loadRuleAlerts,
submitQuery,
viewRecentCaseAndCheckResults,
} from '../../tasks/live_query';
import { generateRandomStringName, interceptCaseId } from '../../tasks/integrations';

describe('Alert Event Details - Cases', () => {
import { tag } from '../../tags';
import { ServerlessRoleName } from '../../support/roles';
describe('Alert Event Details - Cases', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
let ruleId: string;
let ruleName: string;
let packId: string;
Expand All @@ -44,9 +46,9 @@ describe('Alert Event Details - Cases', () => {
});

beforeEach(() => {
login(ROLE.soc_manager);
cy.login(ServerlessRoleName.SOC_MANAGER);
cy.visit('/app/security/rules');
cy.contains(ruleName).click();
clickRuleName(ruleName);
});

after(() => {
Expand All @@ -72,10 +74,10 @@ describe('Alert Event Details - Cases', () => {
cy.getBySel('expand-event').first().click({ force: true });
cy.getBySel('take-action-dropdown-btn').click();
cy.getBySel('osquery-action-item').click();
cy.contains('Run a set of queries in a pack').wait(500).click();
cy.getBySel('select-live-pack').within(() => {
cy.getBySel('comboBoxInput').type(`${packName}{downArrow}{enter}`);
});
cy.contains(/^\d+ agen(t|ts) selected/);
cy.contains('Run a set of queries in a pack').click();
cy.get(LIVE_QUERY_EDITOR).should('not.exist');
cy.getBySel('select-live-pack').click().type(`${packName}{downArrow}{enter}`);
submitQuery();
cy.get('[aria-label="Add to Case"]').first().click();
cy.getBySel('cases-table-add-case-filter-bar').click();
Expand All @@ -91,7 +93,8 @@ describe('Alert Event Details - Cases', () => {
});
});

describe('Case', () => {
// verify why calling new action doesnt add to response actions list
describe.skip('Case', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could use tags instead of skipping it fully?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this tests fails on both envs, I'll have to take a look into why that functionality broke on new flyout.

let caseId: string;

before(() => {
Expand Down Expand Up @@ -134,6 +137,7 @@ describe('Alert Event Details - Cases', () => {
cases: true,
timeline: true,
});

addToCase(caseId);
viewRecentCaseAndCheckResults();
});
Expand Down
16 changes: 9 additions & 7 deletions x-pack/plugins/osquery/cypress/e2e/all/alerts_liked_apps.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@

import { cleanupRule, loadRule } from '../../tasks/api_fixtures';
import { RESPONSE_ACTIONS_ITEM_0, RESPONSE_ACTIONS_ITEM_1 } from '../../tasks/response_actions';
import { ROLE, login } from '../../tasks/login';
import {
checkActionItemsInResults,
clickRuleName,
inputQuery,
loadRuleAlerts,
submitQuery,
} from '../../tasks/live_query';
import { closeModalIfVisible, closeToastIfVisible } from '../../tasks/integrations';
import { RESULTS_TABLE, RESULTS_TABLE_BUTTON } from '../../screens/live_query';
import { tag } from '../../tags';
import { ServerlessRoleName } from '../../support/roles';

const UUID_REGEX = '[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}';

describe('Alert Event Details', { browser: 'electron' }, () => {
describe('Alert Event Details', { browser: 'electron', tags: [tag.ESS, tag.SERVERLESS] }, () => {
let ruleId: string;
let ruleName: string;

Expand All @@ -36,9 +38,9 @@ describe('Alert Event Details', { browser: 'electron' }, () => {
});

beforeEach(() => {
login(ROLE.soc_manager);
cy.login(ServerlessRoleName.SOC_MANAGER);
cy.visit('/app/security/rules');
cy.contains(ruleName).click();
clickRuleName(ruleName);
});

it('should be able to add investigation guides to response actions', () => {
Expand Down Expand Up @@ -98,7 +100,7 @@ describe('Alert Event Details', { browser: 'electron' }, () => {
closeModalIfVisible();
});

it('can visit discover from response action results', () => {
it('can visit discover from response action results', { tags: [tag.ESS] }, () => {
const discoverRegex = new RegExp(`action_id: ${UUID_REGEX}`);
cy.getBySel('expand-event').first().click();
cy.getBySel('securitySolutionDocumentDetailsFlyoutResponseSectionHeader').click();
Expand All @@ -124,7 +126,7 @@ describe('Alert Event Details', { browser: 'electron' }, () => {
});
});

it('can visit lens from response action results', () => {
it('can visit lens from response action results', { tags: [tag.ESS] }, () => {
const lensRegex = new RegExp(`Action ${UUID_REGEX} results`);
cy.getBySel('expand-event').first().click();
cy.getBySel('securitySolutionDocumentDetailsFlyoutResponseSectionHeader').click();
Expand Down Expand Up @@ -158,7 +160,7 @@ describe('Alert Event Details', { browser: 'electron' }, () => {
cy.getBySel('breadcrumbs').contains(lensRegex);
});

it('can add to timeline from response action results', () => {
it('can add to timeline from response action results', { tags: [tag.ESS] }, () => {
const timelineRegex = new RegExp(`Added ${UUID_REGEX} to timeline`);
const filterRegex = new RegExp(`action_id: "${UUID_REGEX}"`);
cy.getBySel('expand-event').first().click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
* 2.0.
*/

import { tag } from '../../tags';
import { cleanupRule, loadRule } from '../../tasks/api_fixtures';
import { ROLE, login } from '../../tasks/login';
import {
clickRuleName,
inputQuery,
loadRuleAlerts,
submitQuery,
takeOsqueryActionWithParams,
} from '../../tasks/live_query';
import { ServerlessRoleName } from '../../support/roles';

describe('Alert Event Details - dynamic params', () => {
describe('Alert Event Details - dynamic params', { tags: [tag.ESS, tag.SERVERLESS] }, () => {
let ruleId: string;
let ruleName: string;

Expand All @@ -31,9 +33,9 @@ describe('Alert Event Details - dynamic params', () => {
});

beforeEach(() => {
login(ROLE.soc_manager);
cy.login(ServerlessRoleName.SOC_MANAGER);
cy.visit('/app/security/rules');
cy.contains(ruleName).click();
clickRuleName(ruleName);
});

it('should substitute parameters in investigation guide', () => {
Expand Down
Loading