[RAC] Show all alerts, not only "open" workflow status, and remove Workflow filter related logic and clean up the code (#120231) (#121281)

* Remove comments

* Remove workflow code from Alert page and make currentFilter in t grid optional

* Remove workflow props for AlertsTableTGridProps

* Remove unused import

* Remove workflow state from Alert page state container

* Update page state container

* Update tests

* Remove builk actions tests

* Remove bulk actions provider

* Remove does not render case options in the overflow menu test

* Resume permissions for cases test

* Fix does not render case options in the overflow menu test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	x-pack/test/observability_functional/apps/observability/index.ts
This commit is contained in:
Faisal Kanout 2021-12-15 15:44:14 +03:00 committed by GitHub
parent 49be0438f4
commit 46b07f178b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 86 additions and 451 deletions

View file

@ -58,7 +58,7 @@ function AlertsPage() {
const { prepend } = core.http.basePath;
const refetch = useRef<() => void>();
const timefilterService = useTimefilterService();
const { rangeFrom, setRangeFrom, rangeTo, setRangeTo, kuery, setKuery, workflowStatus } =
const { rangeFrom, setRangeFrom, rangeTo, setRangeTo, kuery, setKuery } =
useAlertsPageStateContainer();
useEffect(() => {
@ -112,15 +112,6 @@ function AlertsPage() {
];
}, [indexNames]);
// Keep the Workflow status code commented (no delete) as requested: https://github.com/elastic/kibana/issues/117686
// const setWorkflowStatusFilter = useCallback(
// (value: AlertWorkflowStatus) => {
// setWorkflowStatus(value);
// },
// [setWorkflowStatus]
// );
const onQueryChange = useCallback(
({ dateRange, query }) => {
if (rangeFrom === dateRange.from && rangeTo === dateRange.to && kuery === (query ?? '')) {
@ -223,8 +214,6 @@ function AlertsPage() {
<EuiFlexItem>
<EuiFlexGroup justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem grow={false}>
{/* Keep the Workflow status code commented (no delete) as requested: https://github.com/elastic/kibana/issues/117686*/}
{/* <WorkflowStatusFilter status={workflowStatus} onChange={setWorkflowStatusFilter} /> */}
<AlertsStatusFilter status={alertFilterStatus} onChange={setAlertStatusFilter} />
</EuiFlexItem>
</EuiFlexGroup>
@ -236,7 +225,6 @@ function AlertsPage() {
rangeFrom={rangeFrom}
rangeTo={rangeTo}
kuery={kuery}
workflowStatus={workflowStatus}
setRefetch={setRefetch}
/>
</EuiFlexItem>

View file

@ -14,7 +14,6 @@ import {
ALERT_DURATION,
ALERT_REASON,
ALERT_STATUS,
ALERT_WORKFLOW_STATUS,
TIMESTAMP,
} from '@kbn/rule-data-utils/technical_field_names';
@ -31,7 +30,7 @@ import {
import styled from 'styled-components';
import React, { Suspense, useMemo, useState, useCallback, useEffect } from 'react';
import usePrevious from 'react-use/lib/usePrevious';
import { pick } from 'lodash';
import { getAlertsPermissions } from '../../../../hooks/use_alert_permission';
import type {
@ -46,7 +45,6 @@ import type { TopAlert } from '../alerts_page/alerts_page';
import { useKibana } from '../../../../../../../../src/plugins/kibana_react/public';
import type {
ActionProps,
AlertWorkflowStatus,
ColumnHeaderOptions,
ControlColumnProps,
RowRenderer,
@ -67,12 +65,10 @@ interface AlertsTableTGridProps {
rangeFrom: string;
rangeTo: string;
kuery: string;
workflowStatus: AlertWorkflowStatus;
setRefetch: (ref: () => void) => void;
}
interface ObservabilityActionsProps extends ActionProps {
currentStatus: AlertWorkflowStatus;
setFlyoutAlert: React.Dispatch<React.SetStateAction<TopAlert | undefined>>;
}
@ -136,11 +132,7 @@ function ObservabilityActions({
data,
eventId,
ecsData,
currentStatus,
refetch,
setFlyoutAlert,
setEventsLoading,
setEventsDeleted,
}: ObservabilityActionsProps) {
const { core, observabilityRuleTypeRegistry } = usePluginContext();
const dataFieldEs = data.reduce((acc, d) => ({ ...acc, [d.field]: d.value }), {});
@ -154,14 +146,6 @@ function ObservabilityActions({
() => parseAlert(observabilityRuleTypeRegistry),
[observabilityRuleTypeRegistry]
);
// const alertDataConsumer = useMemo<string>(
// () => get(dataFieldEs, ALERT_RULE_CONSUMER, [''])[0],
// [dataFieldEs]
// );
// const alertDataProducer = useMemo<string>(
// () => get(dataFieldEs, ALERT_RULE_PRODUCER, [''])[0],
// [dataFieldEs]
// );
const alert = parseObservabilityAlert(dataFieldEs);
const { prepend } = core.http.basePath;
@ -187,30 +171,6 @@ function ObservabilityActions({
};
}, [data, eventId, ecsData]);
// Hide the WorkFlow filter, but keep its code as required in https://github.com/elastic/kibana/issues/117686
// const onAlertStatusUpdated = useCallback(() => {
// setActionsPopover(null);
// if (refetch) {
// refetch();
// }
// }, [setActionsPopover, refetch]);
// const alertPermissions = useGetUserAlertsPermissions(
// capabilities,
// alertDataConsumer === 'alerts' ? alertDataProducer : alertDataConsumer
// );
// const statusActionItems = useStatusBulkActionItems({
// eventIds: [eventId],
// currentStatus,
// indexName: ecsData._index ?? '',
// setEventsLoading,
// setEventsDeleted,
// onUpdateSuccess: onAlertStatusUpdated,
// onUpdateFailure: onAlertStatusUpdated,
// });
const ruleId = alert.fields['kibana.alert.rule.uuid'] ?? null;
const linkToRule = ruleId ? prepend(paths.management.ruleDetails(ruleId)) : null;
@ -234,8 +194,7 @@ function ObservabilityActions({
}),
]
: []),
// Hide the WorkFlow filter, but keep its code as required in https://github.com/elastic/kibana/issues/117686
// ...(alertPermissions.crud ? statusActionItems : []),
...(!!linkToRule
? [
<EuiContextMenuItem
@ -308,8 +267,6 @@ function ObservabilityActions({
</>
);
}
// Hide the WorkFlow filter, but keep its code as required in https://github.com/elastic/kibana/issues/117686
const FIELDS_WITHOUT_CELL_ACTIONS = [
'@timestamp',
'signal.rule.risk_score',
@ -319,8 +276,8 @@ const FIELDS_WITHOUT_CELL_ACTIONS = [
];
export function AlertsTableTGrid(props: AlertsTableTGridProps) {
const { indexNames, rangeFrom, rangeTo, kuery, workflowStatus, setRefetch } = props;
const prevWorkflowStatus = usePrevious(workflowStatus);
const { indexNames, rangeFrom, rangeTo, kuery, setRefetch } = props;
const {
timelines,
application: { capabilities },
@ -345,12 +302,6 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
const [deletedEventIds, setDeletedEventIds] = useState<string[]>([]);
useEffect(() => {
if (workflowStatus !== prevWorkflowStatus) {
setDeletedEventIds([]);
}
}, [workflowStatus, prevWorkflowStatus]);
useEffect(() => {
if (tGridState) {
const newState = JSON.stringify({
@ -384,14 +335,13 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
<ObservabilityActions
{...actionProps}
setEventsDeleted={setEventsDeleted}
currentStatus={workflowStatus}
setFlyoutAlert={setFlyoutAlert}
/>
);
},
},
];
}, [workflowStatus, setEventsDeleted]);
}, [setEventsDeleted]);
const onStateChange = useCallback(
(state: TGridState) => {
@ -417,8 +367,6 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
type,
columns: tGridState?.columns ?? columns,
deletedEventIds,
// Hide the WorkFlow filter, but keep its code as required in https://github.com/elastic/kibana/issues/117686
// defaultCellActions: getDefaultCellActions({ addToQuery }),
disabledCellActions: FIELDS_WITHOUT_CELL_ACTIONS,
end: rangeTo,
filters: [],
@ -429,7 +377,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
footerText: translations.alertsTable.footerTextLabel,
onStateChange,
query: {
query: `${ALERT_WORKFLOW_STATUS}: ${workflowStatus}${kuery !== '' ? ` and ${kuery}` : ''}`,
query: kuery,
language: 'kuery',
},
renderCellValue: getRenderCellValue({ setFlyoutAlert }),
@ -446,7 +394,7 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
sortDirection,
},
],
filterStatus: workflowStatus as AlertWorkflowStatus,
leadingControlColumns,
trailingControlColumns,
unit: (totalAlerts: number) => translations.alertsTable.showingAlertsTitle(totalAlerts),
@ -456,7 +404,6 @@ export function AlertsTableTGrid(props: AlertsTableTGridProps) {
rangeTo,
hasAlertsCrudPermissions,
indexNames,
workflowStatus,
kuery,
rangeFrom,
setRefetch,

View file

@ -9,13 +9,11 @@ import {
createStateContainer,
createStateContainerReactHelpers,
} from '../../../../../../../../src/plugins/kibana_utils/public';
import type { AlertWorkflowStatus } from '../../../../../common/typings';
interface AlertsPageContainerState {
rangeFrom: string;
rangeTo: string;
kuery: string;
workflowStatus: AlertWorkflowStatus;
}
interface AlertsPageStateTransitions {
@ -24,23 +22,18 @@ interface AlertsPageStateTransitions {
) => (rangeFrom: string) => AlertsPageContainerState;
setRangeTo: (state: AlertsPageContainerState) => (rangeTo: string) => AlertsPageContainerState;
setKuery: (state: AlertsPageContainerState) => (kuery: string) => AlertsPageContainerState;
setWorkflowStatus: (
state: AlertsPageContainerState
) => (workflowStatus: AlertWorkflowStatus) => AlertsPageContainerState;
}
const defaultState: AlertsPageContainerState = {
rangeFrom: 'now-15m',
rangeTo: 'now',
kuery: '',
workflowStatus: 'open',
};
const transitions: AlertsPageStateTransitions = {
setRangeFrom: (state) => (rangeFrom) => ({ ...state, rangeFrom }),
setRangeTo: (state) => (rangeTo) => ({ ...state, rangeTo }),
setKuery: (state) => (kuery) => ({ ...state, kuery }),
setWorkflowStatus: (state) => (workflowStatus) => ({ ...state, workflowStatus }),
};
const alertsPageStateContainer = createStateContainer(defaultState, transitions);

View file

@ -29,11 +29,8 @@ export function useAlertsPageStateContainer() {
useUrlStateSyncEffect(stateContainer);
const { setRangeFrom, setRangeTo, setKuery, setWorkflowStatus } = stateContainer.transitions;
const { rangeFrom, rangeTo, kuery, workflowStatus } = useContainerSelector(
stateContainer,
(state) => state
);
const { setRangeFrom, setRangeTo, setKuery } = stateContainer.transitions;
const { rangeFrom, rangeTo, kuery } = useContainerSelector(stateContainer, (state) => state);
return {
rangeFrom,
@ -42,8 +39,6 @@ export function useAlertsPageStateContainer() {
setRangeTo,
kuery,
setKuery,
workflowStatus,
setWorkflowStatus,
};
}

View file

@ -92,7 +92,7 @@ export interface TGridStandaloneProps {
loadingText: React.ReactNode;
filters: Filter[];
footerText: React.ReactNode;
filterStatus: AlertStatus;
filterStatus?: AlertStatus;
hasAlertsCrudPermissions: ({
ruleConsumer,
ruleProducer,

View file

@ -1,52 +0,0 @@
/*
* 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 { FtrProviderContext } from '../../../ftr_provider_context';
const CHECKBOX_SELECTOR = 'select-event';
const CHECKBOX_PRODUCER_SELECTOR = 'select-event-rule-producer';
const BULK_ACTIONS_CONTAINER = 'bulk-actions-button-container';
const SELECTED_BULK_ACTIONS_BUTTON = 'selectedShowBulkActionsButton';
export function ObservabilityAlertsBulkActionsProvider({ getService }: FtrProviderContext) {
const find = getService('find');
const testSubjects = getService('testSubjects');
const getCheckboxSelector = async () => {
return await find.allByCssSelector(testSubjects.getCssSelector(`~${CHECKBOX_SELECTOR}`));
};
const missingCheckboxSelectorOrFail = async () => {
return await testSubjects.missingOrFail(`~${CHECKBOX_SELECTOR}`);
};
const getCheckboxSelectorPerProducer = async (producer: string) => {
return await find.allByCssSelector(
testSubjects.getCssSelector(`~${CHECKBOX_PRODUCER_SELECTOR}-${producer}`)
);
};
const getBulkActionsContainer = async () => {
return await testSubjects.find(BULK_ACTIONS_CONTAINER);
};
const getBulkActionsContainerOrFail = async () => {
return await testSubjects.existOrFail(BULK_ACTIONS_CONTAINER);
};
const getBulkActionsButton = async () => {
return await testSubjects.find(SELECTED_BULK_ACTIONS_BUTTON);
};
return {
getCheckboxSelector,
getCheckboxSelectorPerProducer,
missingCheckboxSelectorOrFail,
getBulkActionsContainer,
getBulkActionsContainerOrFail,
getBulkActionsButton,
};
}

View file

@ -26,7 +26,7 @@ const ALERTS_TABLE_CONTAINER_SELECTOR = 'events-viewer-panel';
const VIEW_RULE_DETAILS_SELECTOR = 'viewRuleDetails';
const VIEW_RULE_DETAILS_FLYOUT_SELECTOR = 'viewRuleDetailsFlyout';
const ACTION_COLUMN_INDEX = 1;
const ACTION_COLUMN_INDEX = 0;
type WorkflowStatus = 'open' | 'acknowledged' | 'closed';

View file

@ -8,7 +8,6 @@
import { ObservabilityAlertsPaginationProvider } from './pagination';
import { ObservabilityAlertsCommonProvider } from './common';
import { ObservabilityAlertsAddToCaseProvider } from './add_to_case';
import { ObservabilityAlertsBulkActionsProvider } from './bulk_actions';
import { FtrProviderContext } from '../../../ftr_provider_context';
@ -16,12 +15,10 @@ export function ObservabilityAlertsProvider(context: FtrProviderContext) {
const common = ObservabilityAlertsCommonProvider(context);
const pagination = ObservabilityAlertsPaginationProvider(context);
const addToCase = ObservabilityAlertsAddToCaseProvider(context);
const bulkActions = ObservabilityAlertsBulkActionsProvider(context);
return {
common,
pagination,
addToCase,
bulkActions,
};
}

View file

@ -68,7 +68,7 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
});
});
describe.skip('When user has read permissions for cases', () => {
describe('When user has read permissions for cases', () => {
before(async () => {
await observability.users.setTestUserRole(
observability.users.defineBasicObservabilityRole({
@ -83,7 +83,6 @@ export default ({ getService, getPageObjects }: FtrProviderContext) => {
await observability.users.restoreDefaultTestUserRole();
});
// Hide the WorkFlow filter, but keep its code as required in https://github.com/elastic/kibana/issues/117686
it('does not render case options in the overflow menu', async () => {
await observability.alerts.common.openActionsMenuForRow(0);
await retry.try(async () => {

View file

@ -0,0 +1,67 @@
/*
* 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 expect from '@kbn/expect';
import { ALERT_STATUS_RECOVERED, ALERT_STATUS_ACTIVE } from '@kbn/rule-data-utils';
import { FtrProviderContext } from '../../../ftr_provider_context';
const ALL_ALERTS = 40;
const ACTIVE_ALERTS = 10;
const RECOVERED_ALERTS = 30;
export default ({ getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
describe('alert status filter', function () {
this.tags('includeFirefox');
const observability = getService('observability');
const retry = getService('retry');
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts');
await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs');
await observability.alerts.common.navigateToTimeWithData();
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts');
await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs');
});
it('is filtered to only show "all" alerts by default', async () => {
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(ALL_ALERTS);
});
});
it('can be filtered to only show "active" alerts using the filter button', async () => {
await observability.alerts.common.setAlertStatusFilter(ALERT_STATUS_ACTIVE);
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(ACTIVE_ALERTS);
});
});
it('can be filtered to only show "recovered" alerts using the filter button', async () => {
await observability.alerts.common.setAlertStatusFilter(ALERT_STATUS_RECOVERED);
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(RECOVERED_ALERTS);
});
});
it('can be filtered to only show "all" alerts using the filter button', async () => {
await observability.alerts.common.setAlertStatusFilter();
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(ALL_ALERTS);
});
});
});
};

View file

@ -1,204 +0,0 @@
/*
* 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.
*/
/*
* 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 expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
async function asyncForEach<T>(array: T[], callback: (item: T, index: number) => void) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index);
}
}
export default ({ getService, getPageObjects }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
const observability = getService('observability');
const retry = getService('retry');
// Hide the WorkFlow filter, but keep its code as required in https://github.com/elastic/kibana/issues/117686
describe.skip('Observability alerts / Bulk actions', function () {
this.tags('includeFirefox');
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts');
await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs');
await esArchiver.load(
'x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0'
);
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs');
await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts');
await esArchiver.unload(
'x-pack/test/apm_api_integration/common/fixtures/es_archiver/apm_8.0.0'
);
});
describe('When user has all priviledges for logs app', () => {
before(async () => {
await observability.users.setTestUserRole(
observability.users.defineBasicObservabilityRole({
logs: ['all'],
})
);
await observability.alerts.common.navigateToTimeWithData();
});
after(async () => {
await observability.users.restoreDefaultTestUserRole();
});
it('logs checkboxes are enabled', async () => {
const logsCheckboxes =
await observability.alerts.bulkActions.getCheckboxSelectorPerProducer('logs');
await asyncForEach(logsCheckboxes, async (checkbox, index) => {
expect(await checkbox.isEnabled()).to.be(true);
});
});
describe('when checkbox is clicked', async () => {
it('shows bulk actions container', async () => {
const logsCheckboxes =
await observability.alerts.bulkActions.getCheckboxSelectorPerProducer('logs');
await logsCheckboxes[0].click();
await observability.alerts.bulkActions.getBulkActionsContainerOrFail();
});
describe('when selected bulk action button is clicked', async () => {
it('opens overflow menu with workflow status options', async () => {
await retry.try(async () => {
await (await observability.alerts.bulkActions.getBulkActionsButton()).click();
});
});
});
});
});
describe('When user has all priviledges for apm app', () => {
before(async () => {
await observability.users.setTestUserRole(
observability.users.defineBasicObservabilityRole({
apm: ['all'],
})
);
await observability.alerts.common.navigateToTimeWithData();
});
after(async () => {
await observability.users.restoreDefaultTestUserRole();
});
it('apm checkboxes are enabled', async () => {
const apmCheckboxes = await observability.alerts.bulkActions.getCheckboxSelectorPerProducer(
'apm'
);
await asyncForEach(apmCheckboxes, async (checkbox, index) => {
expect(await checkbox.isEnabled()).to.be(true);
});
});
describe('when checkbox is clicked', async () => {
it('shows bulk actions container', async () => {
const apmCheckboxes =
await observability.alerts.bulkActions.getCheckboxSelectorPerProducer('apm');
await apmCheckboxes[0].click();
await observability.alerts.bulkActions.getBulkActionsContainerOrFail();
});
describe('when selected bulk action button is clicked', async () => {
it('opens overflow menu with workflow status options', async () => {
await retry.try(async () => {
await (await observability.alerts.bulkActions.getBulkActionsButton()).click();
});
});
});
});
});
describe('When user has read permissions for logs', () => {
before(async () => {
await observability.users.setTestUserRole(
observability.users.defineBasicObservabilityRole({
logs: ['read'],
})
);
await observability.alerts.common.navigateToTimeWithData();
});
after(async () => {
await observability.users.restoreDefaultTestUserRole();
});
it('checkbox is not visible', async () => {
await observability.alerts.bulkActions.missingCheckboxSelectorOrFail();
});
});
describe('When user has read permissions for apm', () => {
before(async () => {
await observability.users.setTestUserRole(
observability.users.defineBasicObservabilityRole({
apm: ['read'],
})
);
await observability.alerts.common.navigateToTimeWithData();
});
after(async () => {
await observability.users.restoreDefaultTestUserRole();
});
it('checkbox is not displayed', async () => {
await observability.alerts.bulkActions.missingCheckboxSelectorOrFail();
});
});
describe('When user has mixed permissions for observability apps', () => {
before(async () => {
await observability.users.setTestUserRole(
observability.users.defineBasicObservabilityRole({
logs: ['all'],
apm: ['read'],
observabilityCases: ['read'],
})
);
await observability.alerts.common.navigateToTimeWithData();
});
after(async () => {
await observability.users.restoreDefaultTestUserRole();
});
it('apm checkboxes are disabled', async () => {
const apmCheckboxes = await observability.alerts.bulkActions.getCheckboxSelectorPerProducer(
'apm'
);
await asyncForEach(apmCheckboxes, async (checkbox, index) => {
expect(await checkbox.isEnabled()).to.be(false);
});
});
it('logs checkboxes are enabled', async () => {
const logsCheckboxes =
await observability.alerts.bulkActions.getCheckboxSelectorPerProducer('logs');
await asyncForEach(logsCheckboxes, async (checkbox, index) => {
expect(await checkbox.isEnabled()).to.be(true);
});
});
});
});
};

View file

@ -15,8 +15,8 @@ async function asyncForEach<T>(array: T[], callback: (item: T, index: number) =>
}
const ACTIVE_ALERTS_CELL_COUNT = 78;
const RECOVERED_ALERTS_CELL_COUNT = 120;
const TOTAL_ALERTS_CELL_COUNT = 165;
const RECOVERED_ALERTS_CELL_COUNT = 150;
const TOTAL_ALERTS_CELL_COUNT = 200;
export default ({ getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');

View file

@ -34,7 +34,8 @@ export default ({ getService }: FtrProviderContext) => {
await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs');
});
describe(`When less than ${ROWS_NEEDED_FOR_PAGINATION} alerts are found`, () => {
// This will fail after removing workflow filter i.e. show all not only "open" https://github.com/elastic/kibana/issues/119946
describe.skip(`When less than ${ROWS_NEEDED_FOR_PAGINATION} alerts are found`, () => {
before(async () => {
// current archiver has 8 active alerts
await observability.alerts.common.setAlertStatusFilter(ALERT_STATUS_ACTIVE);
@ -123,7 +124,7 @@ export default ({ getService }: FtrProviderContext) => {
await observability.alerts.common.alertDataIsBeingLoaded();
await observability.alerts.common.alertDataHasLoaded();
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(3);
expect(tableRows.length).to.be(10);
});
it('Goes to previous page', async () => {

View file

@ -1,95 +0,0 @@
/*
* 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 expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';
const OPEN_ALERTS_ROWS_COUNT = 33;
export default ({ getService }: FtrProviderContext) => {
const esArchiver = getService('esArchiver');
// Keep the Workflow status code commented (no delete) as requested: https://github.com/elastic/kibana/issues/117686
describe.skip('alert workflow status', function () {
this.tags('includeFirefox');
const observability = getService('observability');
const retry = getService('retry');
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/observability/alerts');
await esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs');
await observability.alerts.common.navigateToTimeWithData();
});
after(async () => {
await esArchiver.unload('x-pack/test/functional/es_archives/observability/alerts');
await esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs');
});
it('is filtered to only show "open" alerts by default', async () => {
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(OPEN_ALERTS_ROWS_COUNT);
});
});
it('can be set to "acknowledged" using the row menu', async () => {
await observability.alerts.common.setWorkflowStatusForRow(0, 'acknowledged');
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(32);
});
});
it('can be filtered to only show "acknowledged" alerts using the filter button', async () => {
await observability.alerts.common.setWorkflowStatusFilter('acknowledged');
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(6);
});
});
it('can be set to "closed" using the row menu', async () => {
await observability.alerts.common.setWorkflowStatusForRow(0, 'closed');
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(5);
});
});
it('can be filtered to only show "closed" alerts using the filter button', async () => {
await observability.alerts.common.setWorkflowStatusFilter('closed');
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(3);
});
});
it('can be set to "open" using the row menu', async () => {
await observability.alerts.common.setWorkflowStatusForRow(0, 'open');
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(2);
});
});
it('can be filtered to only show "open" alerts using the filter button', async () => {
await observability.alerts.common.setWorkflowStatusFilter('open');
await retry.try(async () => {
const tableRows = await observability.alerts.common.getTableCellsInRows();
expect(tableRows.length).to.be(3);
});
});
});
};

View file

@ -14,11 +14,10 @@ export default function ({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./exploratory_view'));
loadTestFile(require.resolve('./alerts'));
loadTestFile(require.resolve('./alerts/alert_disclaimer'));
loadTestFile(require.resolve('./alerts/workflow_status'));
loadTestFile(require.resolve('./alerts/alert_status'));
loadTestFile(require.resolve('./alerts/pagination'));
loadTestFile(require.resolve('./alerts/add_to_case'));
loadTestFile(require.resolve('./alerts/state_synchronization'));
loadTestFile(require.resolve('./alerts/bulk_actions'));
loadTestFile(require.resolve('./alerts/table_storage'));
});
}