Skip to content

Commit

Permalink
Fix cypress and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
christineweng committed Feb 3, 2023
1 parent 7dc454f commit 228135a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions x-pack/plugins/security_solution/cypress/screens/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export const ALERTS_COUNT =
export const ALERTS_TREND_SIGNAL_RULE_NAME_PANEL =
'[data-test-subj="render-content-kibana.alert.rule.name"]';

export const CHART_SELECT = '[data-test-subj="chartSelect"]';

export const CLOSE_ALERT_BTN = '[data-test-subj="close-alert-status"]';

export const CLOSE_SELECTED_ALERTS_BTN = '[data-test-subj="close-alert-status"]';
Expand Down Expand Up @@ -92,7 +90,7 @@ export const RULE_NAME = '[data-test-subj^=formatted-field][data-test-subj$=rule

export const SELECTED_ALERTS = '[data-test-subj="selectedShowBulkActionsButton"]';

export const SELECT_TABLE = '[data-test-subj="table"]';
export const SELECT_TABLE = '[data-test-subj="chart-select-table"]';

export const SEND_ALERT_TO_TIMELINE_BTN = '[data-test-subj="send-alert-to-timeline-button"]';

Expand Down
4 changes: 1 addition & 3 deletions x-pack/plugins/security_solution/cypress/tasks/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import {
ADD_EXCEPTION_BTN,
ALERT_CHECKBOX,
CHART_SELECT,
CLOSE_ALERT_BTN,
CLOSE_SELECTED_ALERTS_BTN,
EXPAND_ALERT_BTN,
Expand Down Expand Up @@ -257,8 +256,7 @@ export const openAlerts = () => {
};

export const selectCountTable = () => {
cy.get(CHART_SELECT).click({ force: true });
cy.get(SELECT_TABLE).click();
cy.get(SELECT_TABLE).click({ force: true });
};

export const clearGroupByTopInput = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const AlertsTreemapComponent: React.FC<Props> = ({
}

return (
<div data-test-subj="treemap">
<div data-test-subj="alerts-treemap">
<EuiFlexGroup gutterSize="none">
<ChartFlexItem grow={true} $minChartHeight={minChartHeight}>
{stackByField1 != null && !isEmpty(stackByField1) && normalizedData.length === 0 ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ describe('AlertsTreemapPanel', () => {
</TestProviders>
);

await waitFor(() => expect(screen.getByTestId('chartSelect')).toBeInTheDocument());
await waitFor(() => expect(screen.getByTestId('chart-select-tabs')).toBeInTheDocument());
});

it('renders field selection when `isPanelExpanded` is true', async () => {
Expand Down Expand Up @@ -305,6 +305,6 @@ describe('AlertsTreemapPanel', () => {
</TestProviders>
);

await waitFor(() => expect(screen.getByTestId('treemap')).toBeInTheDocument());
await waitFor(() => expect(screen.getByTestId('alerts-treemap')).toBeInTheDocument());
});
});

0 comments on commit 228135a

Please sign in to comment.