[Alerting] Fixed search results are not updated when search term is removed on Rules and Connectors page (#103663) (#103849)
This commit is contained in:
parent
876d1f5f5f
commit
fe30b1bec8
2 changed files with 43 additions and 1 deletions
|
@ -539,7 +539,12 @@ export const AlertsList: React.FunctionComponent = () => {
|
|||
fullWidth
|
||||
isClearable
|
||||
data-test-subj="alertSearchField"
|
||||
onChange={(e) => setInputText(e.target.value)}
|
||||
onChange={(e) => {
|
||||
setInputText(e.target.value);
|
||||
if (e.target.value === '') {
|
||||
setSearchText(e.target.value);
|
||||
}
|
||||
}}
|
||||
onKeyUp={(e) => {
|
||||
if (e.keyCode === ENTER_KEY) {
|
||||
setSearchText(inputText);
|
||||
|
|
|
@ -109,6 +109,43 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
]);
|
||||
});
|
||||
|
||||
it('should update alert list on the search clear button click', async () => {
|
||||
await createAlert({ name: 'b' });
|
||||
await createAlert({ name: 'c' });
|
||||
await refreshAlertsList();
|
||||
await pageObjects.triggersActionsUI.searchAlerts('b');
|
||||
|
||||
const searchResults = await pageObjects.triggersActionsUI.getAlertsList();
|
||||
expect(searchResults).to.eql([
|
||||
{
|
||||
name: 'b',
|
||||
tagsText: 'foo, bar',
|
||||
alertType: 'Test: Noop',
|
||||
interval: '1m',
|
||||
},
|
||||
]);
|
||||
const searchClearButton = await find.byCssSelector('.euiFormControlLayoutClearButton');
|
||||
await searchClearButton.click();
|
||||
await find.byCssSelector(
|
||||
'.euiBasicTable[data-test-subj="alertsList"]:not(.euiBasicTable-loading)'
|
||||
);
|
||||
const searchResultsAfterClear = await pageObjects.triggersActionsUI.getAlertsList();
|
||||
expect(searchResultsAfterClear).to.eql([
|
||||
{
|
||||
name: 'b',
|
||||
tagsText: 'foo, bar',
|
||||
alertType: 'Test: Noop',
|
||||
interval: '1m',
|
||||
},
|
||||
{
|
||||
name: 'c',
|
||||
tagsText: 'foo, bar',
|
||||
alertType: 'Test: Noop',
|
||||
interval: '1m',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it('should search for tags', async () => {
|
||||
const createdAlert = await createAlert();
|
||||
await refreshAlertsList();
|
||||
|
|
Loading…
Reference in a new issue