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

[SecuritySolution] Enable chartEmbeddablesEnabled feature flag #150531

Merged
merged 39 commits into from Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b8a05f9
enable chartEmbeddablesEnabled
angorayc Feb 8, 2023
91fbd27
enable chartEmbeddablesEnabled
angorayc Feb 8, 2023
3b867dc
fix unit tests
angorayc Feb 14, 2023
c4bd205
fix cypress tests
angorayc Feb 20, 2023
30fe3a5
Merge branch 'enable-chart' of github.com:angorayc/kibana into enable…
angorayc Feb 22, 2023
3cc734d
Merge branch 'main' of github.com:elastic/kibana into enable-chart
angorayc Feb 22, 2023
78676a8
updat cypress
angorayc Feb 22, 2023
0d7a475
fix cypress
angorayc Feb 22, 2023
ea22135
update queries
angorayc Feb 22, 2023
0ef666a
Merge branch 'main' of github.com:elastic/kibana into enable-chart
angorayc Feb 22, 2023
293acd6
styling
angorayc Feb 23, 2023
d0b6c46
refetch page after clicking on a dot in an area chart
angorayc Feb 23, 2023
471bd2c
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Feb 23, 2023
c45c7e9
revert unused export
angorayc Feb 23, 2023
8626b1f
Merge branch 'enable-chart' of github.com:angorayc/kibana into enable…
angorayc Feb 23, 2023
cf27e3b
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Feb 23, 2023
378bc39
styling
angorayc Feb 23, 2023
90d8753
Merge branch 'enable-chart' of github.com:angorayc/kibana into enable…
angorayc Feb 23, 2023
15810ce
fix tests
angorayc Feb 24, 2023
1b7a866
fix Lens supported group by fields
angorayc Feb 24, 2023
b57a000
revert donuts and rules preview
angorayc Feb 27, 2023
4cf7836
Merge branch 'main' of github.com:elastic/kibana into enable-chart
angorayc Feb 27, 2023
7588314
fix cypress
angorayc Feb 27, 2023
81e63fc
Merge branch 'main' into enable-chart
angorayc Feb 27, 2023
381ecc0
Merge branch 'main' of github.com:elastic/kibana into enable-chart
angorayc Feb 28, 2023
61c3958
Merge branch 'main' into enable-chart
angorayc Feb 28, 2023
fba7a0b
update tests according to the code review
angorayc Mar 1, 2023
491cfed
Merge branch 'enable-chart' of github.com:angorayc/kibana into enable…
angorayc Mar 1, 2023
ff36fd1
Do custom filter action only for area charts
angorayc Mar 1, 2023
2c1e0ac
fix unit tests
angorayc Mar 1, 2023
b3a0547
styling
angorayc Mar 2, 2023
0e9f211
styling
angorayc Mar 2, 2023
3156d84
update cypress tests
angorayc Mar 2, 2023
5ff27d6
Merge branch 'main' of github.com:elastic/kibana into enable-chart
angorayc Mar 2, 2023
14b4e93
Merge branch 'main' into enable-chart
angorayc Mar 6, 2023
bc5abfc
Merge branch 'main' into enable-chart
angorayc Mar 6, 2023
47b70b9
update cypress
angorayc Mar 6, 2023
ea3b5ae
Merge branch 'enable-chart' of github.com:angorayc/kibana into enable…
angorayc Mar 6, 2023
8cb71a3
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Mar 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -20,8 +20,9 @@ export const allowedExperimentalValues = Object.freeze({
pendingActionResponsesWithAck: true,
policyListEnabled: true,
policyResponseInFleetEnabled: true,
chartEmbeddablesEnabled: false,

chartEmbeddablesEnabled: true,
donutChartEmbeddablesEnabled: false, // Depends on https://github.com/elastic/kibana/issues/136409 item 2 - 6
alertsPreviewChartEmbeddablesEnabled: false, // Depends on https://github.com/elastic/kibana/issues/136409 item 9
/**
* This is used for enabling the end-to-end tests for the security_solution telemetry.
* We disable the telemetry since we don't have specific roles or permissions around it and
Expand Down
Expand Up @@ -127,7 +127,7 @@ describe('Sourcerer', () => {
isSourcererSelection(`auditbeat-*`);
isNotSourcererSelection('*beat*');
addIndexToDefault('*beat*');
isHostsStatValue('1 ');
isHostsStatValue('1');
openSourcerer();
openAdvancedSettings();
isSourcererSelection(`auditbeat-*`);
Expand Down
Expand Up @@ -6,7 +6,7 @@
*/

import { getNewRule } from '../../objects/rule';
import { ALERTS_HISTOGRAM_LEGEND, ALERTS_COUNT } from '../../screens/alerts';
import { ALERTS_HISTOGRAM_LEGEND, ALERTS_COUNT, LEGEND_ACTIONS } from '../../screens/alerts';
import { selectAlertsHistogram } from '../../tasks/alerts';
import { createCustomRuleEnabled } from '../../tasks/api_calls/rules';
import { cleanKibana } from '../../tasks/common';
Expand All @@ -16,34 +16,34 @@ import {
GLOBAL_SEARCH_BAR_FILTER_ITEM,
GLOBAL_SEARCH_BAR_FILTER_ITEM_DELETE,
} from '../../screens/search_bar';
import { HOVER_ACTIONS, TIMELINE_DATA_PROVIDERS_CONTAINER } from '../../screens/timeline';
import { TIMELINE_DATA_PROVIDERS_CONTAINER } from '../../screens/timeline';
import { closeTimelineUsingCloseButton } from '../../tasks/security_main';
import { openActiveTimeline } from '../../tasks/timeline';

describe('Histogram legend hover actions', { testIsolation: false }, () => {
const ruleConfigs = getNewRule();
before(() => {
cleanKibana();
login();
createCustomRuleEnabled(getNewRule(), 'new custom rule');
createCustomRuleEnabled(ruleConfigs, 'new custom rule');
visit(ALERTS_URL);
selectAlertsHistogram();
});

it('Filter in/out should add a filter to KQL bar', function () {
const expectedNumberOfAlerts = 2;
cy.get(ALERTS_HISTOGRAM_LEGEND).trigger('mouseover');
cy.get(HOVER_ACTIONS.FILTER_FOR).click();
cy.get(ALERTS_HISTOGRAM_LEGEND).click();
angorayc marked this conversation as resolved.
Show resolved Hide resolved
cy.get(LEGEND_ACTIONS.FILTER_FOR(ruleConfigs.name)).click();
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should(
'have.text',
`kibana.alert.rule.name: ${getNewRule().name}`
`kibana.alert.rule.name: ${ruleConfigs.name}`
);
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlerts} alerts`);

cy.get(ALERTS_HISTOGRAM_LEGEND).trigger('mouseover');
cy.get(HOVER_ACTIONS.FILTER_OUT).click();
cy.get(ALERTS_HISTOGRAM_LEGEND).click();
angorayc marked this conversation as resolved.
Show resolved Hide resolved
cy.get(LEGEND_ACTIONS.FILTER_OUT(ruleConfigs.name)).click();
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should(
'have.text',
`NOT kibana.alert.rule.name: ${getNewRule().name}`
`NOT kibana.alert.rule.name: ${ruleConfigs.name}`
);
cy.get(ALERTS_COUNT).should('not.exist');

Expand All @@ -52,9 +52,8 @@ describe('Histogram legend hover actions', { testIsolation: false }, () => {
});

it('Add To Timeline', function () {
cy.get(ALERTS_HISTOGRAM_LEGEND).trigger('mouseover');
cy.get(HOVER_ACTIONS.ADD_TO_TIMELINE).click();
openActiveTimeline();
cy.get(ALERTS_HISTOGRAM_LEGEND).click();
angorayc marked this conversation as resolved.
Show resolved Hide resolved
cy.get(LEGEND_ACTIONS.ADD_TO_TIMELINE(ruleConfigs.name)).click();
angorayc marked this conversation as resolved.
Show resolved Hide resolved
cy.get(TIMELINE_DATA_PROVIDERS_CONTAINER).should('be.visible');
cy.get(TIMELINE_DATA_PROVIDERS_CONTAINER).should('contain.text', getNewRule().name);
closeTimelineUsingCloseButton();
Expand Down
Expand Up @@ -6,7 +6,7 @@
*/

import { getBuildingBlockRule } from '../../objects/rule';
import { OVERVIEW_ALERTS_HISTOGRAM } from '../../screens/overview';
import { OVERVIEW_ALERTS_HISTOGRAM_EMPTY } from '../../screens/overview';
import { OVERVIEW } from '../../screens/security_header';
import { goToRuleDetails } from '../../tasks/alerts_detection_rules';
import { createCustomRuleEnabled } from '../../tasks/api_calls/rules';
Expand Down Expand Up @@ -43,6 +43,6 @@ describe('Alerts generated by building block rules', () => {
navigateFromHeaderTo(OVERVIEW);

// Check that generated events are hidden on the Overview page
cy.get(OVERVIEW_ALERTS_HISTOGRAM).should('contain.text', 'No data to display');
cy.get(OVERVIEW_ALERTS_HISTOGRAM_EMPTY).should('contain.text', 'No results found');
});
});
Expand Up @@ -10,24 +10,23 @@ import { getNewRule } from '../../objects/rule';
import {
ALERTS_COUNT,
TAKE_ACTION_POPOVER_BTN,
ALERT_COUNT_TABLE_FIRST_ROW_COUNT,
ALERTS_TREND_SIGNAL_RULE_NAME_PANEL,
SELECTED_ALERTS,
ALERT_COUNT_TABLE_COLUMN,
} from '../../screens/alerts';

import {
selectNumberOfAlerts,
waitForAlerts,
markAcknowledgedFirstAlert,
goToAcknowledgedAlerts,
clearGroupByTopInput,
closeAlerts,
closeFirstAlert,
goToClosedAlerts,
goToOpenedAlerts,
openAlerts,
openFirstAlert,
selectCountTable,
checkAlertCountFromAlertCountTable,
} from '../../tasks/alerts';
import { createCustomRuleEnabled } from '../../tasks/api_calls/rules';
import { cleanKibana, deleteAlertsAndRules } from '../../tasks/common';
Expand Down Expand Up @@ -56,7 +55,6 @@ describe('Changing alert status', () => {
closeAlerts();
waitForAlerts();
selectCountTable();
clearGroupByTopInput();
});

it('Open one alert when more than one closed alerts are selected', () => {
Expand All @@ -80,6 +78,7 @@ describe('Changing alert status', () => {
'have.text',
`Selected ${numberOfAlertsToBeSelected} alerts`
);
cy.get(TAKE_ACTION_POPOVER_BTN).should('exist');
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you add this because the test is flaky?

Copy link
Contributor Author

@angorayc angorayc Mar 1, 2023

Choose a reason for hiding this comment

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

There's a line on 84 as below, I think it wanted to check TAKE_ACTION_POPOVER_BTN was available here, so I added the check.

// cy.get(TAKE_ACTION_POPOVER_BTN).should('not.have.attr', 'disabled');


// TODO: Popover not shwing up in cypress UI, but code is in the UtilityBar
// cy.get(TAKE_ACTION_POPOVER_BTN).should('not.have.attr', 'disabled');
Expand All @@ -89,10 +88,8 @@ describe('Changing alert status', () => {

const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeOpened;
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlerts} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${expectedNumberOfAlerts}`
);

checkAlertCountFromAlertCountTable(expectedNumberOfAlerts);

goToOpenedAlerts();
waitForAlerts();
Expand All @@ -103,10 +100,8 @@ describe('Changing alert status', () => {
'have.text',
`${numberOfOpenedAlerts + numberOfAlertsToBeOpened} alerts`.toString()
);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${numberOfOpenedAlerts + numberOfAlertsToBeOpened}`
);

checkAlertCountFromAlertCountTable(numberOfOpenedAlerts + numberOfAlertsToBeOpened);
});
});
});
Expand All @@ -118,7 +113,6 @@ describe('Changing alert status', () => {
visit(ALERTS_URL);
waitForAlertsToPopulate();
selectCountTable();
clearGroupByTopInput();
});
it('Mark one alert as acknowledged when more than one open alerts are selected', () => {
cy.get(ALERTS_COUNT)
Expand All @@ -135,19 +129,14 @@ describe('Changing alert status', () => {
markAcknowledgedFirstAlert();
const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeMarkedAcknowledged;
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlerts} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${expectedNumberOfAlerts}`
);
checkAlertCountFromAlertCountTable(expectedNumberOfAlerts);

goToAcknowledgedAlerts();
waitForAlerts();

cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlertsToBeMarkedAcknowledged} alert`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${numberOfAlertsToBeMarkedAcknowledged}`
);

checkAlertCountFromAlertCountTable(numberOfAlertsToBeMarkedAcknowledged);
});
});
});
Expand All @@ -158,7 +147,6 @@ describe('Changing alert status', () => {
visit(ALERTS_URL);
waitForAlertsToPopulate();
selectCountTable();
clearGroupByTopInput();
});
it('Closes and opens alerts', () => {
const numberOfAlertsToBeClosed = 3;
Expand All @@ -167,7 +155,7 @@ describe('Changing alert status', () => {
.then((alertNumberString) => {
const numberOfAlerts = alertNumberString.split(' ')[0];
cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlerts} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should('have.text', `${numberOfAlerts}`);
checkAlertCountFromAlertCountTable(numberOfAlerts);

selectNumberOfAlerts(numberOfAlertsToBeClosed);

Expand All @@ -181,10 +169,7 @@ describe('Changing alert status', () => {

const expectedNumberOfAlertsAfterClosing = +numberOfAlerts - numberOfAlertsToBeClosed;
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlertsAfterClosing} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${expectedNumberOfAlertsAfterClosing}`
);
checkAlertCountFromAlertCountTable(expectedNumberOfAlertsAfterClosing);

goToClosedAlerts();
waitForAlerts();
Expand All @@ -204,10 +189,8 @@ describe('Changing alert status', () => {
'have.text',
`${expectedNumberOfClosedAlertsAfterOpened} alerts`
);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${expectedNumberOfClosedAlertsAfterOpened}`
);

checkAlertCountFromAlertCountTable(expectedNumberOfClosedAlertsAfterOpened);

goToOpenedAlerts();
waitForAlerts();
Expand All @@ -216,10 +199,8 @@ describe('Changing alert status', () => {
+numberOfAlerts - expectedNumberOfClosedAlertsAfterOpened;

cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfOpenedAlerts} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${expectedNumberOfOpenedAlerts}`
);

checkAlertCountFromAlertCountTable(expectedNumberOfOpenedAlerts);
});
});

Expand All @@ -240,30 +221,25 @@ describe('Changing alert status', () => {

const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeClosed;
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlerts} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${expectedNumberOfAlerts}`
);
checkAlertCountFromAlertCountTable(expectedNumberOfAlerts);

goToClosedAlerts();
waitForAlerts();

cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlertsToBeClosed} alert`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${numberOfAlertsToBeClosed}`
);

checkAlertCountFromAlertCountTable(numberOfAlertsToBeClosed);
});
});

it('Updates trend histogram whenever alert status is updated in table', () => {
it('Updates count table whenever alert status is updated in table', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MadameSheema , I changed the test description based on the content below, but I might have misunderstood, could you please check if I took it right?

Copy link
Member

Choose a reason for hiding this comment

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

That should be checked with the person who wrote this test.

const numberOfAlertsToBeClosed = 1;
cy.get(ALERTS_COUNT)
.invoke('text')
.then((alertNumberString) => {
const numberOfAlerts = alertNumberString.split(' ')[0];
cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlerts} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should('have.text', `${numberOfAlerts}`);
checkAlertCountFromAlertCountTable(numberOfAlerts);
angorayc marked this conversation as resolved.
Show resolved Hide resolved

selectNumberOfAlerts(numberOfAlertsToBeClosed);

Expand All @@ -274,10 +250,8 @@ describe('Changing alert status', () => {

const expectedNumberOfAlertsAfterClosing = +numberOfAlerts - numberOfAlertsToBeClosed;
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlertsAfterClosing} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${expectedNumberOfAlertsAfterClosing}`
);

checkAlertCountFromAlertCountTable(expectedNumberOfAlertsAfterClosing);

goToClosedAlerts();
waitForAlerts();
Expand All @@ -288,14 +262,14 @@ describe('Changing alert status', () => {
selectNumberOfAlerts(numberOfAlertsToBeOpened);

cy.get(SELECTED_ALERTS).should('have.text', `Selected ${numberOfAlertsToBeOpened} alert`);
cy.get(ALERTS_TREND_SIGNAL_RULE_NAME_PANEL).should('exist');
cy.get(ALERT_COUNT_TABLE_COLUMN(1)).should('exist');
angorayc marked this conversation as resolved.
Show resolved Hide resolved

openAlerts();
waitForAlerts();

cy.get(ALERTS_COUNT).should('not.exist');
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should('not.exist');
cy.get(ALERTS_TREND_SIGNAL_RULE_NAME_PANEL).should('not.exist');
cy.get(ALERT_COUNT_TABLE_COLUMN(3)).should('not.exist');
cy.get(ALERT_COUNT_TABLE_COLUMN(1)).should('not.exist');
});
});
});
Expand All @@ -310,7 +284,6 @@ describe('Changing alert status', () => {
visit(ALERTS_URL);
waitForAlertsToPopulate();
selectCountTable();
clearGroupByTopInput();
});
it('Mark one alert as acknowledged when more than one open alerts are selected', () => {
cy.get(ALERTS_COUNT)
Expand All @@ -327,19 +300,15 @@ describe('Changing alert status', () => {
markAcknowledgedFirstAlert();
const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeMarkedAcknowledged;
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlerts} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${expectedNumberOfAlerts}`
);

checkAlertCountFromAlertCountTable(expectedNumberOfAlerts);

goToAcknowledgedAlerts();
waitForAlerts();

cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlertsToBeMarkedAcknowledged} alert`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${numberOfAlertsToBeMarkedAcknowledged}`
);

checkAlertCountFromAlertCountTable(numberOfAlertsToBeMarkedAcknowledged);
});
});

Expand All @@ -350,7 +319,7 @@ describe('Changing alert status', () => {
.then((alertNumberString) => {
const numberOfAlerts = alertNumberString.split(' ')[0];
cy.get(ALERTS_COUNT).should('have.text', `${numberOfAlerts} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should('have.text', `${numberOfAlerts}`);
checkAlertCountFromAlertCountTable(numberOfAlerts);

selectNumberOfAlerts(numberOfAlertsToBeClosed);

Expand All @@ -364,10 +333,8 @@ describe('Changing alert status', () => {

const expectedNumberOfAlertsAfterClosing = +numberOfAlerts - numberOfAlertsToBeClosed;
cy.get(ALERTS_COUNT).should('have.text', `${expectedNumberOfAlertsAfterClosing} alerts`);
cy.get(ALERT_COUNT_TABLE_FIRST_ROW_COUNT).should(
'have.text',
`${expectedNumberOfAlertsAfterClosing}`
);

checkAlertCountFromAlertCountTable(expectedNumberOfAlertsAfterClosing);

goToClosedAlerts();
waitForAlerts();
Expand Down
Expand Up @@ -14,7 +14,8 @@ import { login, visit, visitHostDetailsPage } from '../../tasks/login';

import { HOSTS_URL } from '../../urls/navigation';

describe('Inspect', () => {
// This will be fixed in a follow up PR, https://github.com/elastic/kibana/issues/152359
describe.skip('Inspect', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind opening up an issue with these skipped tests and add it to the comments here and the two files below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue is up #152359, and the PR #151714

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

before(() => {
login();
});
Expand Down
Expand Up @@ -12,7 +12,8 @@ import { login, visit } from '../../tasks/login';

import { NETWORK_URL } from '../../urls/navigation';

describe('Inspect', () => {
// This will be fixed in a follow up PR, https://github.com/elastic/kibana/issues/152359
describe.skip('Inspect', () => {
context('Network stats and tables', () => {
before(() => {
login();
Expand Down