-
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.
[Security Solution][Detections] Adds ip_range and text types to value…
… list upload form (#73109) * Adds two more types to the value lists form * Adds `ip_range` and `text` types * Replaces radio group with select * Add custom command for attaching a file to an input This will be used to excercise value list uploads. * Add some missing test subjects for our value lists modal * Add cypress test for value lists modal This exercises the happy path: opening the modal, uploading a list, and asserting that it subsequently appears in the table. Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
6d4bb9d
commit b15a0a9
Showing
10 changed files
with
156 additions
and
26 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
x-pack/plugins/security_solution/cypress/fixtures/value_list.txt
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,6 @@ | ||
these | ||
are | ||
keywords | ||
for | ||
a | ||
list |
43 changes: 43 additions & 0 deletions
43
x-pack/plugins/security_solution/cypress/integration/value_lists.spec.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,43 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { loginAndWaitForPageWithoutDateRange } from '../tasks/login'; | ||
import { DETECTIONS_URL } from '../urls/navigation'; | ||
import { | ||
waitForAlertsPanelToBeLoaded, | ||
waitForAlertsIndexToBeCreated, | ||
goToManageAlertsDetectionRules, | ||
} from '../tasks/alerts'; | ||
import { | ||
waitForListsIndexToBeCreated, | ||
waitForValueListsModalToBeLoaded, | ||
openValueListsModal, | ||
selectValueListsFile, | ||
uploadValueList, | ||
} from '../tasks/lists'; | ||
import { VALUE_LISTS_TABLE, VALUE_LISTS_ROW } from '../screens/lists'; | ||
|
||
describe('value lists', () => { | ||
describe('management modal', () => { | ||
it('creates a keyword list from an uploaded file', () => { | ||
loginAndWaitForPageWithoutDateRange(DETECTIONS_URL); | ||
waitForAlertsPanelToBeLoaded(); | ||
waitForAlertsIndexToBeCreated(); | ||
waitForListsIndexToBeCreated(); | ||
goToManageAlertsDetectionRules(); | ||
waitForValueListsModalToBeLoaded(); | ||
openValueListsModal(); | ||
selectValueListsFile(); | ||
uploadValueList(); | ||
|
||
cy.get(VALUE_LISTS_TABLE) | ||
.find(VALUE_LISTS_ROW) | ||
.should(($row) => { | ||
expect($row.text()).to.contain('value_list.txt'); | ||
}); | ||
}); | ||
}); | ||
}); |
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,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export const VALUE_LISTS_MODAL_ACTIVATOR = '[data-test-subj="open-value-lists-modal-button"]'; | ||
export const VALUE_LISTS_TABLE = '[data-test-subj="value-lists-table"]'; | ||
export const VALUE_LISTS_ROW = '.euiTableRow'; | ||
export const VALUE_LIST_FILE_PICKER = '[data-test-subj="value-list-file-picker"]'; | ||
export const VALUE_LIST_FILE_UPLOAD_BUTTON = '[data-test-subj="value-lists-form-import-action"]'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { | ||
VALUE_LISTS_MODAL_ACTIVATOR, | ||
VALUE_LIST_FILE_PICKER, | ||
VALUE_LIST_FILE_UPLOAD_BUTTON, | ||
} from '../screens/lists'; | ||
|
||
export const waitForListsIndexToBeCreated = () => { | ||
cy.request({ url: '/api/lists/index', retryOnStatusCodeFailure: true }).then((response) => { | ||
if (response.status !== 200) { | ||
cy.wait(7500); | ||
} | ||
}); | ||
}; | ||
|
||
export const waitForValueListsModalToBeLoaded = () => { | ||
cy.get(VALUE_LISTS_MODAL_ACTIVATOR).should('exist'); | ||
cy.get(VALUE_LISTS_MODAL_ACTIVATOR).should('not.be.disabled'); | ||
}; | ||
|
||
export const openValueListsModal = () => { | ||
cy.get(VALUE_LISTS_MODAL_ACTIVATOR).click(); | ||
}; | ||
|
||
export const selectValueListsFile = () => { | ||
cy.get(VALUE_LIST_FILE_PICKER).attachFile('value_list.txt').trigger('change', { force: true }); | ||
}; | ||
|
||
export const uploadValueList = () => { | ||
cy.get(VALUE_LIST_FILE_UPLOAD_BUTTON).click(); | ||
}; |
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