forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RAC] [Observability] Expand Observability alerts page functional tes…
…ts (elastic#111297) * Regenerate data and add tests
- Loading branch information
1 parent
d389bf5
commit a0c24f2
Showing
8 changed files
with
291 additions
and
26 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
Binary file modified
BIN
+335 Bytes
(120%)
x-pack/test/functional/es_archives/observability/alerts/data.json.gz
Binary file not shown.
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
129 changes: 129 additions & 0 deletions
129
x-pack/test/functional/services/observability/alerts.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,129 @@ | ||
/* | ||
* 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 querystring from 'querystring'; | ||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
import { WebElementWrapper } from '../../../../../test/functional/services/lib/web_element_wrapper'; | ||
|
||
// Based on the x-pack/test/functional/es_archives/observability/alerts archive. | ||
const DATE_WITH_DATA = { | ||
rangeFrom: '2021-09-01T13:36:22.109Z', | ||
rangeTo: '2021-09-03T13:36:22.109Z', | ||
}; | ||
|
||
const ALERTS_FLYOUT_SELECTOR = 'alertsFlyout'; | ||
|
||
export function ObservabilityAlertsProvider({ getPageObjects, getService }: FtrProviderContext) { | ||
const testSubjects = getService('testSubjects'); | ||
const flyoutService = getService('flyout'); | ||
const pageObjects = getPageObjects(['common']); | ||
const retry = getService('retry'); | ||
|
||
const navigateToTimeWithData = async () => { | ||
return await pageObjects.common.navigateToUrlWithBrowserHistory( | ||
'observability', | ||
'/alerts', | ||
`?${querystring.stringify(DATE_WITH_DATA)}` | ||
); | ||
}; | ||
|
||
const getTableCells = async () => { | ||
// NOTE: This isn't ideal, but EuiDataGrid doesn't really have the concept of "rows" | ||
return await testSubjects.findAll('dataGridRowCell'); | ||
}; | ||
|
||
const getTableOrFail = async () => { | ||
return await testSubjects.existOrFail('events-viewer-panel'); | ||
}; | ||
|
||
const getNoDataStateOrFail = async () => { | ||
return await testSubjects.existOrFail('tGridEmptyState'); | ||
}; | ||
|
||
// Query Bar | ||
const getQueryBar = async () => { | ||
return await testSubjects.find('queryInput'); | ||
}; | ||
|
||
const getQuerySubmitButton = async () => { | ||
return await testSubjects.find('querySubmitButton'); | ||
}; | ||
|
||
const clearQueryBar = async () => { | ||
return await (await getQueryBar()).clearValueWithKeyboard({ charByChar: true }); | ||
}; | ||
|
||
const typeInQueryBar = async (query: string) => { | ||
return await (await getQueryBar()).type(query); | ||
}; | ||
|
||
const submitQuery = async (query: string) => { | ||
await typeInQueryBar(query); | ||
return await (await getQuerySubmitButton()).click(); | ||
}; | ||
|
||
// Flyout | ||
const getOpenFlyoutButton = async () => { | ||
return await testSubjects.find('openFlyoutButton'); | ||
}; | ||
|
||
const openAlertsFlyout = async () => { | ||
await (await getOpenFlyoutButton()).click(); | ||
await retry.waitFor( | ||
'flyout open', | ||
async () => await testSubjects.exists(ALERTS_FLYOUT_SELECTOR, { timeout: 2500 }) | ||
); | ||
}; | ||
|
||
const getAlertsFlyout = async () => { | ||
return await testSubjects.find(ALERTS_FLYOUT_SELECTOR); | ||
}; | ||
|
||
const getAlertsFlyoutOrFail = async () => { | ||
return await testSubjects.existOrFail(ALERTS_FLYOUT_SELECTOR); | ||
}; | ||
|
||
const getAlertsFlyoutTitle = async () => { | ||
return await testSubjects.find('alertsFlyoutTitle'); | ||
}; | ||
|
||
const closeAlertsFlyout = async () => { | ||
return await flyoutService.close(ALERTS_FLYOUT_SELECTOR); | ||
}; | ||
|
||
const getAlertsFlyoutViewInAppButtonOrFail = async () => { | ||
return await testSubjects.existOrFail('alertsFlyoutViewInAppButton'); | ||
}; | ||
|
||
const getAlertsFlyoutDescriptionListTitles = async (): Promise<WebElementWrapper[]> => { | ||
const flyout = await getAlertsFlyout(); | ||
return await testSubjects.findAllDescendant('alertsFlyoutDescriptionListTitle', flyout); | ||
}; | ||
|
||
const getAlertsFlyoutDescriptionListDescriptions = async (): Promise<WebElementWrapper[]> => { | ||
const flyout = await getAlertsFlyout(); | ||
return await testSubjects.findAllDescendant('alertsFlyoutDescriptionListDescription', flyout); | ||
}; | ||
|
||
return { | ||
clearQueryBar, | ||
typeInQueryBar, | ||
submitQuery, | ||
getTableCells, | ||
getTableOrFail, | ||
getNoDataStateOrFail, | ||
openAlertsFlyout, | ||
getAlertsFlyout, | ||
getAlertsFlyoutTitle, | ||
closeAlertsFlyout, | ||
navigateToTimeWithData, | ||
getAlertsFlyoutOrFail, | ||
getAlertsFlyoutViewInAppButtonOrFail, | ||
getAlertsFlyoutDescriptionListTitles, | ||
getAlertsFlyoutDescriptionListDescriptions, | ||
}; | ||
} |
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.