-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Actionable Observability] Integrate the shareable alert table in the…
… Overview Page (#140024) * Refactor observability overview page * Fix type and file name * Use shareable alert table in overview page * Add functional test for overview page * Fix functional tests * Fix flaky test * Remove only and add retry for opening alerts section * Wait for the overview page to load before opening alerts section * Add waitForAlertsSectionToAppear * Add waiting for alerts table loading to disappear * Add longer timeout for loading alerts table * Increase timeout for alerts table to be loaded
- Loading branch information
1 parent
9f0a9e7
commit 5a0313b
Showing
18 changed files
with
245 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...__snapshots__/build_es_query.test.ts.snap → ...__snapshots__/build_es_query.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
x-pack/test/functional/services/observability/overview/common.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* 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'; | ||
|
||
// Based on the x-pack/test/functional/es_archives/observability/alerts archive. | ||
const DATE_WITH_DATA = { | ||
rangeFrom: '2021-10-18T13:36:22.109Z', | ||
rangeTo: '2021-10-20T13:36:22.109Z', | ||
}; | ||
|
||
const ALERTS_TITLE = 'Alerts'; | ||
const ALERTS_ACCORDION_SELECTOR = `accordion-${ALERTS_TITLE}`; | ||
const ALERTS_SECTION_BUTTON_SELECTOR = `button[aria-controls="${ALERTS_TITLE}"]`; | ||
const ALERTS_TABLE_NO_DATA_SELECTOR = 'alertsStateTableEmptyState'; | ||
const ALERTS_TABLE_WITH_DATA_SELECTOR = 'alertsTable'; | ||
const ALERTS_TABLE_LOADING_SELECTOR = 'internalAlertsPageLoading'; | ||
|
||
export function ObservabilityOverviewCommonProvider({ | ||
getPageObjects, | ||
getService, | ||
}: FtrProviderContext) { | ||
const find = getService('find'); | ||
const pageObjects = getPageObjects(['common']); | ||
const testSubjects = getService('testSubjects'); | ||
const retry = getService('retry'); | ||
|
||
const navigateToOverviewPageWithAlerts = async () => { | ||
return await pageObjects.common.navigateToUrlWithBrowserHistory( | ||
'observability', | ||
'/overview', | ||
`?rangeFrom=${DATE_WITH_DATA.rangeFrom}&rangeTo=${DATE_WITH_DATA.rangeTo}`, | ||
{ ensureCurrentUrl: false } | ||
); | ||
}; | ||
|
||
const navigateToOverviewPage = async () => { | ||
return await pageObjects.common.navigateToUrlWithBrowserHistory( | ||
'observability', | ||
'/overview', | ||
undefined, | ||
{ ensureCurrentUrl: false } | ||
); | ||
}; | ||
|
||
const waitForAlertsAccordionToAppear = async () => { | ||
await retry.waitFor('alert accordion to appear', async () => { | ||
return await testSubjects.exists(ALERTS_ACCORDION_SELECTOR); | ||
}); | ||
}; | ||
|
||
const waitForAlertsTableLoadingToDisappear = async () => { | ||
await retry.try(async () => { | ||
await testSubjects.missingOrFail(ALERTS_TABLE_LOADING_SELECTOR, { timeout: 10000 }); | ||
}); | ||
}; | ||
|
||
const openAlertsSection = async () => { | ||
await waitForAlertsAccordionToAppear(); | ||
const alertSectionButton = await find.byCssSelector(ALERTS_SECTION_BUTTON_SELECTOR); | ||
return await alertSectionButton.click(); | ||
}; | ||
|
||
const openAlertsSectionAndWaitToAppear = async () => { | ||
await openAlertsSection(); | ||
await waitForAlertsTableLoadingToDisappear(); | ||
await retry.waitFor('alerts table to appear', async () => { | ||
return ( | ||
(await testSubjects.exists(ALERTS_TABLE_NO_DATA_SELECTOR)) || | ||
(await testSubjects.exists(ALERTS_TABLE_WITH_DATA_SELECTOR)) | ||
); | ||
}); | ||
}; | ||
|
||
const getAlertsTableNoDataOrFail = async () => { | ||
return await testSubjects.existOrFail(ALERTS_TABLE_NO_DATA_SELECTOR); | ||
}; | ||
|
||
return { | ||
getAlertsTableNoDataOrFail, | ||
navigateToOverviewPageWithAlerts, | ||
navigateToOverviewPage, | ||
openAlertsSectionAndWaitToAppear, | ||
}; | ||
} |
18 changes: 18 additions & 0 deletions
18
x-pack/test/functional/services/observability/overview/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* 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 { ObservabilityOverviewCommonProvider } from './common'; | ||
|
||
import { FtrProviderContext } from '../../../ftr_provider_context'; | ||
|
||
export function ObservabilityOverviewProvider(context: FtrProviderContext) { | ||
const common = ObservabilityOverviewCommonProvider(context); | ||
|
||
return { | ||
common, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.