|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the Elastic License |
| 4 | + * 2.0; you may not use this file except in compliance with the Elastic License |
| 5 | + * 2.0. |
| 6 | + */ |
| 7 | + |
| 8 | +import { cleanKibana } from '../../tasks/common'; |
| 9 | + |
| 10 | +import { loginAndWaitForPage } from '../../tasks/login'; |
| 11 | +import { openTimelineUsingToggle } from '../../tasks/security_main'; |
| 12 | +import { openTimelineFieldsBrowser, populateTimeline } from '../../tasks/timeline'; |
| 13 | + |
| 14 | +import { HOSTS_URL, ALERTS_URL } from '../../urls/navigation'; |
| 15 | + |
| 16 | +import { waitForAlertsIndexToBeCreated, waitForAlertsPanelToBeLoaded } from '../../tasks/alerts'; |
| 17 | +import { createCustomRuleActivated } from '../../tasks/api_calls/rules'; |
| 18 | + |
| 19 | +import { getNewRule } from '../../objects/rule'; |
| 20 | +import { refreshPage } from '../../tasks/security_header'; |
| 21 | +import { waitForAlertsToPopulate } from '../../tasks/create_new_rule'; |
| 22 | +import { openEventsViewerFieldsBrowser } from '../../tasks/hosts/events'; |
| 23 | + |
| 24 | +describe('Create DataView runtime field', () => { |
| 25 | + before(() => { |
| 26 | + cleanKibana(); |
| 27 | + }); |
| 28 | + |
| 29 | + it('adds field to alert table', () => { |
| 30 | + const fieldName = 'field.name.alert.page'; |
| 31 | + loginAndWaitForPage(ALERTS_URL); |
| 32 | + waitForAlertsPanelToBeLoaded(); |
| 33 | + waitForAlertsIndexToBeCreated(); |
| 34 | + createCustomRuleActivated(getNewRule()); |
| 35 | + refreshPage(); |
| 36 | + waitForAlertsToPopulate(500); |
| 37 | + openEventsViewerFieldsBrowser(); |
| 38 | + |
| 39 | + cy.get('[data-test-subj="create-field"]').click(); |
| 40 | + cy.get('.indexPatternFieldEditorMaskOverlay').find('[data-test-subj="input"]').type(fieldName); |
| 41 | + cy.get('[data-test-subj="fieldSaveButton"]').click(); |
| 42 | + |
| 43 | + cy.get( |
| 44 | + `[data-test-subj="events-viewer-panel"] [data-test-subj="dataGridHeaderCell-${fieldName}"]` |
| 45 | + ).should('exist'); |
| 46 | + }); |
| 47 | + |
| 48 | + it('adds field to timeline', () => { |
| 49 | + const fieldName = 'field.name.timeline'; |
| 50 | + |
| 51 | + loginAndWaitForPage(HOSTS_URL); |
| 52 | + openTimelineUsingToggle(); |
| 53 | + populateTimeline(); |
| 54 | + openTimelineFieldsBrowser(); |
| 55 | + |
| 56 | + cy.get('[data-test-subj="create-field"]').click(); |
| 57 | + cy.get('.indexPatternFieldEditorMaskOverlay').find('[data-test-subj="input"]').type(fieldName); |
| 58 | + cy.get('[data-test-subj="fieldSaveButton"]').click(); |
| 59 | + |
| 60 | + cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${fieldName}"]`).should( |
| 61 | + 'exist' |
| 62 | + ); |
| 63 | + }); |
| 64 | +}); |
0 commit comments