forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Defend Workflows] Fix bug when event filter value cannot be changed …
…without using {backspace} (elastic#192196) ## Summary This PR does 2 things around editing the value field for an Event Filter. 1. It fixes the issue when during editing an existing Event Filter you cannot update the value without pressing {backspace}, by clearing selection when user is typing: 5da28aa Before: ![before](https://github.com/user-attachments/assets/7355c788-a9fd-4ea5-81b3-89ae41db2ee7) ➡️ After: ![after](https://github.com/user-attachments/assets/aa928fa4-6203-4fad-8f9b-4e586ac4d562) 2. Improves suggestions: before the change, suggestions were there initially, but after they are narrowed down by typing, they won't be displayed again after the user clears the input field. Therefore f9d60cf sets the suggestion search query unconditionally, helping with this issue. Before: ![before](https://github.com/user-attachments/assets/87ccfba6-5b9d-4976-a5af-13c3d56db373) ➡️ After: ![after](https://github.com/user-attachments/assets/c21a909c-4b45-470e-9e77-9edc269f07f7) ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
fa74847
commit b31d119
Showing
4 changed files
with
200 additions
and
34 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
87 changes: 87 additions & 0 deletions
87
x-pack/plugins/security_solution/public/management/cypress/e2e/artifacts/event_filters.cy.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,87 @@ | ||
/* | ||
* 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 { APP_EVENT_FILTERS_PATH } from '../../../../../common/constants'; | ||
import type { ArtifactsFixtureType } from '../../fixtures/artifacts_page'; | ||
import { getArtifactsListTestsData } from '../../fixtures/artifacts_page'; | ||
import { | ||
createArtifactList, | ||
createPerPolicyArtifact, | ||
removeAllArtifacts, | ||
} from '../../tasks/artifacts'; | ||
import { loadPage } from '../../tasks/common'; | ||
import { indexEndpointHosts } from '../../tasks/index_endpoint_hosts'; | ||
import { login } from '../../tasks/login'; | ||
import type { ReturnTypeFromChainable } from '../../types'; | ||
|
||
describe('Event Filters', { tags: ['@ess', '@serverless'] }, () => { | ||
let endpointData: ReturnTypeFromChainable<typeof indexEndpointHosts> | undefined; | ||
|
||
const CONDITION_VALUE = 'valuesAutocompleteMatch'; | ||
const SUBMIT_BUTTON = 'EventFiltersListPage-flyout-submitButton'; | ||
|
||
before(() => { | ||
indexEndpointHosts().then((indexEndpoints) => { | ||
endpointData = indexEndpoints; | ||
}); | ||
}); | ||
|
||
after(() => { | ||
removeAllArtifacts(); | ||
|
||
endpointData?.cleanup(); | ||
endpointData = undefined; | ||
}); | ||
|
||
beforeEach(() => { | ||
removeAllArtifacts(); | ||
}); | ||
|
||
describe('when editing event filter value', () => { | ||
let eventFiltersMock: ArtifactsFixtureType; | ||
beforeEach(() => { | ||
login(); | ||
|
||
eventFiltersMock = getArtifactsListTestsData().find( | ||
({ tabId }) => tabId === 'eventFilters' | ||
) as ArtifactsFixtureType; | ||
|
||
createArtifactList(eventFiltersMock.createRequestBody.list_id); | ||
createPerPolicyArtifact(eventFiltersMock.artifactName, eventFiltersMock.createRequestBody); | ||
|
||
loadPage(APP_EVENT_FILTERS_PATH); | ||
|
||
cy.getByTestSubj('EventFiltersListPage-card-header-actions-button').click(); | ||
cy.getByTestSubj('EventFiltersListPage-card-cardEditAction').click(); | ||
cy.getByTestSubj('EventFiltersListPage-flyout').should('exist'); | ||
}); | ||
|
||
it('should be able to modify after deleting value with {backspace}', () => { | ||
cy.getByTestSubj(CONDITION_VALUE).type(' {backspace}.lnk{enter}'); | ||
cy.getByTestSubj(SUBMIT_BUTTON).click(); | ||
|
||
cy.getByTestSubj('EventFiltersListPage-flyout').should('not.exist'); | ||
cy.contains('notepad.exe.lnk'); | ||
}); | ||
|
||
it('should be able to modify without using {backspace}', () => { | ||
cy.getByTestSubj(CONDITION_VALUE).type('.lnk{enter}'); | ||
cy.getByTestSubj(SUBMIT_BUTTON).click(); | ||
|
||
cy.getByTestSubj('EventFiltersListPage-flyout').should('not.exist'); | ||
cy.contains('notepad.exe.lnk'); | ||
}); | ||
|
||
it('should show suggestions when filter value is cleared', () => { | ||
cy.getByTestSubj(CONDITION_VALUE).clear(); | ||
cy.getByTestSubj(CONDITION_VALUE).type('aaaaaaaaaaaaaa as custom input'); | ||
cy.get('button[role="option"]').should('have.length', 0); | ||
|
||
cy.getByTestSubj(CONDITION_VALUE).find('input').clear(); | ||
cy.get('button[role="option"]').should('have.length.above', 1); | ||
}); | ||
}); | ||
}); |
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