[Security Solution] Unskipping Cypress local storage test (#161655)

This commit is contained in:
Gloria Hornero 2023-07-12 15:56:20 +02:00 committed by GitHub
parent 91e065ebc4
commit 11856ab1d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 15 deletions

View file

@ -5,40 +5,40 @@
* 2.0.
*/
import { cleanKibana, reload } from '../../../tasks/common';
import { reload } from '../../../tasks/common';
import { login, visit } from '../../../tasks/login';
import { HOSTS_URL } from '../../../urls/navigation';
import { openEvents } from '../../../tasks/hosts/main';
import { DATAGRID_HEADERS } from '../../../screens/timeline';
import { DATAGRID_HEADERS, DATAGRID_HEADER } from '../../../screens/timeline';
import { waitsForEventsToBeLoaded } from '../../../tasks/hosts/events';
import { removeColumn } from '../../../tasks/timeline';
// TODO: Fix bug in persisting the columns of timeline
describe.skip('persistent timeline', () => {
describe('persistent timeline', () => {
before(() => {
cleanKibana();
login();
visit(HOSTS_URL);
openEvents();
waitsForEventsToBeLoaded();
/* Stores in 'expectedNumberOfTimelineColumns' alias the number of columns we are going to have
after the delition of the column */
cy.get(DATAGRID_HEADERS).then((header) =>
cy.wrap(header.length - 1).as('expectedNumberOfTimelineColumns')
);
});
it('persist the deletion of a column', function () {
const MESSAGE_COLUMN = 'message';
const MESSAGE_COLUMN_POSITION = 2;
cy.get(DATAGRID_HEADERS).eq(MESSAGE_COLUMN_POSITION).should('have.text', MESSAGE_COLUMN);
removeColumn(MESSAGE_COLUMN);
cy.get(DATAGRID_HEADERS).should('have.length', this.expectedNumberOfTimelineColumns);
/* For testing purposes we are going to use the message column */
const COLUMN = 'message';
cy.get(DATAGRID_HEADER(COLUMN)).should('exist');
removeColumn(COLUMN);
reload();
waitsForEventsToBeLoaded();
/* After the deletion of the message column and the reload of the page, we make sure
we have the expected number of columns and that the message column is not displayed */
cy.get(DATAGRID_HEADERS).should('have.length', this.expectedNumberOfTimelineColumns);
cy.get(DATAGRID_HEADERS).each(($el) => expect($el.text()).not.equal(MESSAGE_COLUMN));
cy.get(DATAGRID_HEADER(COLUMN)).should('not.exist');
});
});

View file

@ -39,8 +39,11 @@ export const CREATE_NEW_TIMELINE_TEMPLATE = '[data-test-subj="template-timeline-
export const DATA_PROVIDERS = '.field-value';
export const DATAGRID_HEADERS =
'[data-test-subj="events-viewer-panel"] [data-test-subj^="dataGridHeaderCell-"]';
export const DATAGRID_HEADERS = '[data-test-subj^="dataGridHeaderCell-"]';
export const DATAGRID_HEADER = (header: string) => {
return `[data-test-subj="dataGridHeaderCell-${header}"]`;
};
export const DATE_PICKER_END = '[data-test-subj="superDatePickerendDatePopoverButton"]';