mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Bringing cypress tests back (#109129)
* fixes threshold cypress tests * add ticket command * fixes threshold cypress tests * add ticket command * fixes 'Creates a new case with timeline and opens the timeline' test * unskips navigation tests * removes 'sets correct classes when the user starts dragging a host, but is not hovering over the data providers' test since we are not supporting drag and drop on timeline * removes drag and drop related tests from 'data_providers.spec.ts' * modifies todo on skipped exceptions tests to add more clarity * fixes 'attach' to case and local storage test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
a7fe773bb8
commit
91910dbecd
15 changed files with 34 additions and 153 deletions
|
@ -11,7 +11,6 @@ import {
|
|||
ALL_CASES_CLOSED_CASES_STATS,
|
||||
ALL_CASES_COMMENTS_COUNT,
|
||||
ALL_CASES_IN_PROGRESS_CASES_STATS,
|
||||
ALL_CASES_ITEM_ACTIONS_BTN,
|
||||
ALL_CASES_NAME,
|
||||
ALL_CASES_OPEN_CASES_COUNT,
|
||||
ALL_CASES_OPEN_CASES_STATS,
|
||||
|
@ -26,7 +25,6 @@ import {
|
|||
import {
|
||||
CASE_DETAILS_DESCRIPTION,
|
||||
CASE_DETAILS_PAGE_TITLE,
|
||||
// CASE_DETAILS_PUSH_TO_EXTERNAL_SERVICE_BTN,
|
||||
CASE_DETAILS_STATUS,
|
||||
CASE_DETAILS_TAGS,
|
||||
CASE_DETAILS_USER_ACTION_DESCRIPTION_USERNAME,
|
||||
|
@ -67,8 +65,8 @@ describe('Cases', () => {
|
|||
.as('mycase')
|
||||
);
|
||||
});
|
||||
// TODO: enable once attach timeline to cases is re-enabled
|
||||
it.skip('Creates a new case with timeline and opens the timeline', function () {
|
||||
|
||||
it('Creates a new case with timeline and opens the timeline', function () {
|
||||
loginAndWaitForPageWithoutDateRange(CASES_URL);
|
||||
goToCreateNewCase();
|
||||
fillCasesMandatoryfields(this.mycase);
|
||||
|
@ -92,7 +90,6 @@ describe('Cases', () => {
|
|||
cy.get(ALL_CASES_COMMENTS_COUNT).should('have.text', '0');
|
||||
cy.get(ALL_CASES_OPENED_ON).should('include.text', 'ago');
|
||||
cy.get(ALL_CASES_SERVICE_NOW_INCIDENT).should('have.text', 'Not pushed');
|
||||
cy.get(ALL_CASES_ITEM_ACTIONS_BTN).should('exist');
|
||||
|
||||
goToCaseDetails();
|
||||
|
||||
|
@ -108,7 +105,6 @@ describe('Cases', () => {
|
|||
cy.get(CASE_DETAILS_USERNAMES).eq(REPORTER).should('have.text', this.mycase.reporter);
|
||||
cy.get(CASE_DETAILS_USERNAMES).eq(PARTICIPANTS).should('have.text', this.mycase.reporter);
|
||||
cy.get(CASE_DETAILS_TAGS).should('have.text', expectedTags);
|
||||
// cy.get(CASE_DETAILS_PUSH_TO_EXTERNAL_SERVICE_BTN).should('have.attr', 'disabled');
|
||||
|
||||
openCaseTimeline();
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ const loadDetectionsPage = (role: ROLES) => {
|
|||
waitForAlertsToPopulate();
|
||||
};
|
||||
|
||||
// TODO: This test may need changes in our UI based on RBAC
|
||||
describe.skip('Alerts timeline', () => {
|
||||
describe('Alerts timeline', () => {
|
||||
before(() => {
|
||||
// First we login as a privileged user to create alerts.
|
||||
cleanKibana();
|
||||
|
@ -45,7 +44,7 @@ describe.skip('Alerts timeline', () => {
|
|||
});
|
||||
|
||||
it('should not allow user with read only privileges to attach alerts to cases', () => {
|
||||
cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click();
|
||||
cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click({ force: true });
|
||||
cy.get(ATTACH_ALERT_TO_CASE_BUTTON).should('not.exist');
|
||||
});
|
||||
});
|
||||
|
@ -56,7 +55,7 @@ describe.skip('Alerts timeline', () => {
|
|||
});
|
||||
|
||||
it('should allow a user with crud privileges to attach alerts to cases', () => {
|
||||
cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click();
|
||||
cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click({ force: true });
|
||||
cy.get(ATTACH_ALERT_TO_CASE_BUTTON).first().should('not.be.disabled');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -81,8 +81,7 @@ import { loginAndWaitForPageWithoutDateRange } from '../../tasks/login';
|
|||
|
||||
import { ALERTS_URL } from '../../urls/navigation';
|
||||
|
||||
// TODO: Alert counts and preview results not showing correct values. Need to fix this test
|
||||
describe.skip('Detection rules, threshold', () => {
|
||||
describe('Detection rules, threshold', () => {
|
||||
let rule = getNewThresholdRule();
|
||||
const expectedUrls = getNewThresholdRule().referenceUrls.join('');
|
||||
const expectedFalsePositives = getNewThresholdRule().falsePositivesExamples.join('');
|
||||
|
|
|
@ -64,7 +64,7 @@ describe('From alert', () => {
|
|||
esArchiverUnload('auditbeat_for_exceptions2');
|
||||
});
|
||||
|
||||
// TODO: Looks like the signal is missing some fields. Need to update to make sure it shows up
|
||||
// TODO: Unskip the test when `https://github.com/elastic/kibana/issues/108244` it is fixed
|
||||
it.skip('Creates an exception and deletes it', () => {
|
||||
addExceptionFromFirstAlert();
|
||||
addsException(getException());
|
||||
|
|
|
@ -62,7 +62,7 @@ describe('From rule', () => {
|
|||
esArchiverUnload('auditbeat_for_exceptions2');
|
||||
});
|
||||
|
||||
// TODO: Looks like the signal is missing some fields. Need to update to make sure it shows up
|
||||
// TODO: Unskip the test when `https://github.com/elastic/kibana/issues/108244` it is fixed
|
||||
it.skip('Creates an exception and deletes it', () => {
|
||||
goToExceptionsTab();
|
||||
addsExceptionFromRuleSettings(getException());
|
||||
|
|
|
@ -51,7 +51,7 @@ import {
|
|||
} from '../../screens/kibana_navigation';
|
||||
import { cleanKibana } from '../../tasks/common';
|
||||
|
||||
describe.skip('top-level navigation common to all pages in the Security app', () => {
|
||||
describe('top-level navigation common to all pages in the Security app', () => {
|
||||
before(() => {
|
||||
cleanKibana();
|
||||
loginAndWaitForPage(TIMELINES_URL);
|
||||
|
@ -111,7 +111,7 @@ describe.skip('top-level navigation common to all pages in the Security app', ()
|
|||
});
|
||||
});
|
||||
|
||||
describe.skip('Kibana navigation to all pages in the Security app ', () => {
|
||||
describe('Kibana navigation to all pages in the Security app ', () => {
|
||||
before(() => {
|
||||
loginAndWaitForPage(KIBANA_HOME);
|
||||
});
|
||||
|
|
|
@ -6,23 +6,12 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
TIMELINE_DATA_PROVIDERS,
|
||||
TIMELINE_DATA_PROVIDERS_EMPTY,
|
||||
TIMELINE_DROPPED_DATA_PROVIDERS,
|
||||
TIMELINE_DATA_PROVIDERS_ACTION_MENU,
|
||||
IS_DRAGGING_DATA_PROVIDERS,
|
||||
TIMELINE_FLYOUT_HEADER,
|
||||
TIMELINE_FLYOUT,
|
||||
} from '../../screens/timeline';
|
||||
import { HOSTS_NAMES_DRAGGABLE } from '../../screens/hosts/all_hosts';
|
||||
|
||||
import {
|
||||
dragAndDropFirstHostToTimeline,
|
||||
dragFirstHostToEmptyTimelineDataProviders,
|
||||
unDragFirstHostToEmptyTimelineDataProviders,
|
||||
dragFirstHostToTimeline,
|
||||
waitForAllHostsToBeLoaded,
|
||||
} from '../../tasks/hosts/all_hosts';
|
||||
import { waitForAllHostsToBeLoaded } from '../../tasks/hosts/all_hosts';
|
||||
|
||||
import { loginAndWaitForPage } from '../../tasks/login';
|
||||
import { openTimelineUsingToggle } from '../../tasks/security_main';
|
||||
|
@ -44,22 +33,6 @@ describe('timeline data providers', () => {
|
|||
closeTimeline();
|
||||
});
|
||||
|
||||
it.skip('renders the data provider of a host dragged from the All Hosts widget on the hosts page', () => {
|
||||
dragAndDropFirstHostToTimeline();
|
||||
openTimelineUsingToggle();
|
||||
cy.get(`${TIMELINE_FLYOUT} ${TIMELINE_DROPPED_DATA_PROVIDERS}`)
|
||||
.first()
|
||||
.invoke('text')
|
||||
.then((dataProviderText) => {
|
||||
cy.get(HOSTS_NAMES_DRAGGABLE)
|
||||
.first()
|
||||
.invoke('text')
|
||||
.should((hostname) => {
|
||||
expect(dataProviderText).to.eq(`host.name: "${hostname}"AND`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('displays the data provider action menu when Enter is pressed', (done) => {
|
||||
openTimelineUsingToggle();
|
||||
addDataProvider({ field: 'host.name', operator: 'exists' }).then(() => {
|
||||
|
@ -77,25 +50,4 @@ describe('timeline data providers', () => {
|
|||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('sets correct classes when the user starts dragging a host, but is not hovering over the data providers', () => {
|
||||
dragFirstHostToTimeline();
|
||||
|
||||
cy.get(IS_DRAGGING_DATA_PROVIDERS)
|
||||
.find(TIMELINE_DATA_PROVIDERS)
|
||||
.filter(':visible')
|
||||
.should('have.class', 'drop-target-data-providers');
|
||||
});
|
||||
|
||||
it.skip('render an extra highlighted area in dataProvider when the user starts dragging a host AND is hovering over the data providers', () => {
|
||||
dragFirstHostToEmptyTimelineDataProviders();
|
||||
|
||||
cy.get(IS_DRAGGING_DATA_PROVIDERS)
|
||||
.find(TIMELINE_DATA_PROVIDERS_EMPTY)
|
||||
.children()
|
||||
.should('exist');
|
||||
|
||||
// Release the dragging item so the cursor can peform other action
|
||||
unDragFirstHostToEmptyTimelineDataProviders();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,14 +8,12 @@
|
|||
import { TIMELINE_BOTTOM_BAR_TOGGLE_BUTTON } from '../../screens/security_main';
|
||||
import {
|
||||
CREATE_NEW_TIMELINE,
|
||||
IS_DRAGGING_DATA_PROVIDERS,
|
||||
TIMELINE_DATA_PROVIDERS,
|
||||
TIMELINE_FLYOUT_HEADER,
|
||||
TIMELINE_SETTINGS_ICON,
|
||||
} from '../../screens/timeline';
|
||||
import { cleanKibana } from '../../tasks/common';
|
||||
|
||||
import { dragFirstHostToTimeline, waitForAllHostsToBeLoaded } from '../../tasks/hosts/all_hosts';
|
||||
import { waitForAllHostsToBeLoaded } from '../../tasks/hosts/all_hosts';
|
||||
import { loginAndWaitForPage } from '../../tasks/login';
|
||||
import {
|
||||
closeTimelineUsingCloseButton,
|
||||
|
@ -78,13 +76,4 @@ describe('timeline flyout button', () => {
|
|||
cy.get('[data-test-subj="nav-search-option"]').its('length').should('be.gte', 1);
|
||||
closeTimelineUsingCloseButton();
|
||||
});
|
||||
|
||||
it.skip('sets correct classes when the user starts dragging a host, but is not hovering over the data providers', () => {
|
||||
dragFirstHostToTimeline();
|
||||
|
||||
cy.get(IS_DRAGGING_DATA_PROVIDERS)
|
||||
.find(TIMELINE_DATA_PROVIDERS)
|
||||
.filter(':visible')
|
||||
.should('have.class', 'drop-target-data-providers');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,12 +10,11 @@ import { loginAndWaitForPage } from '../../tasks/login';
|
|||
import { HOSTS_URL } from '../../urls/navigation';
|
||||
import { openEvents } from '../../tasks/hosts/main';
|
||||
import { DATAGRID_HEADERS } from '../../screens/timeline';
|
||||
import { TABLE_COLUMN_EVENTS_MESSAGE } from '../../screens/hosts/external_events';
|
||||
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', () => {
|
||||
beforeEach(() => {
|
||||
cleanKibana();
|
||||
loginAndWaitForPage(HOSTS_URL);
|
||||
|
@ -27,8 +26,11 @@ describe.skip('persistent timeline', () => {
|
|||
});
|
||||
|
||||
it('persist the deletion of a column', function () {
|
||||
cy.get(DATAGRID_HEADERS).eq(TABLE_COLUMN_EVENTS_MESSAGE).should('have.text', 'message');
|
||||
removeColumn(TABLE_COLUMN_EVENTS_MESSAGE);
|
||||
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);
|
||||
|
||||
|
@ -36,6 +38,6 @@ describe.skip('persistent timeline', () => {
|
|||
waitsForEventsToBeLoaded();
|
||||
|
||||
cy.get(DATAGRID_HEADERS).should('have.length', this.expectedNumberOfTimelineColumns);
|
||||
cy.get(DATAGRID_HEADERS).each(($el) => expect($el.text()).not.equal('message'));
|
||||
cy.get(DATAGRID_HEADERS).each(($el) => expect($el.text()).not.equal(MESSAGE_COLUMN));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,5 +8,3 @@
|
|||
export const ALL_HOSTS_TABLE = '[data-test-subj="table-allHosts-loading-false"]';
|
||||
|
||||
export const HOSTS_NAMES = '[data-test-subj="render-content-host.name"] a.euiLink';
|
||||
|
||||
export const HOSTS_NAMES_DRAGGABLE = '[data-test-subj="render-content-host.name"]';
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export const TABLE_COLUMN_EVENTS_MESSAGE = 2;
|
|
@ -39,6 +39,8 @@ export const DATAGRID_HEADERS =
|
|||
|
||||
export const FAVORITE_TIMELINE = '[data-test-subj="timeline-favorite-filled-star"]';
|
||||
|
||||
export const FIELD_BROWSER = '[data-test-subj="show-field-browser"]';
|
||||
|
||||
export const GRAPH_TAB_BUTTON = '[data-test-subj="timelineTabs-graph"]';
|
||||
|
||||
export const HEADER = '[data-test-subj="header"]';
|
||||
|
@ -143,12 +145,8 @@ export const TIMELINE_CORRELATION_INPUT = '[data-test-subj="eqlQueryBarTextInput
|
|||
|
||||
export const TIMELINE_CORRELATION_TAB = '[data-test-subj="timelineTabs-eql"]';
|
||||
|
||||
export const IS_DRAGGING_DATA_PROVIDERS = '.is-dragging';
|
||||
|
||||
export const TIMELINE_BOTTOM_BAR_CONTAINER = '[data-test-subj="timeline-bottom-bar-container"]';
|
||||
|
||||
export const TIMELINE_DATA_PROVIDERS = '[data-test-subj="dataProviders"]';
|
||||
|
||||
export const TIMELINE_DATA_PROVIDERS_ACTION_MENU = '[data-test-subj="providerActions"]';
|
||||
|
||||
export const TIMELINE_ADD_FIELD_BUTTON = '[data-test-subj="addField"]';
|
||||
|
@ -161,9 +159,6 @@ export const TIMELINE_DATA_PROVIDER_VALUE = `[data-test-subj="value"]`;
|
|||
|
||||
export const SAVE_DATA_PROVIDER_BTN = `[data-test-subj="save"]`;
|
||||
|
||||
export const TIMELINE_DATA_PROVIDERS_EMPTY =
|
||||
'[data-test-subj="dataProviders"] [data-test-subj="empty"]';
|
||||
|
||||
export const TIMELINE_DESCRIPTION = '[data-test-subj="timeline-description"]';
|
||||
|
||||
export const TIMELINE_DESCRIPTION_INPUT = '[data-test-subj="save-timeline-description"]';
|
||||
|
|
|
@ -293,7 +293,8 @@ export const fillDefineThresholdRuleAndContinue = (rule: ThresholdRule) => {
|
|||
const thresholdField = 0;
|
||||
const threshold = 1;
|
||||
|
||||
const typeThresholdField = ($el: Cypress.ObjectLike) => cy.wrap($el).type(rule.thresholdField);
|
||||
const typeThresholdField = ($el: Cypress.ObjectLike) =>
|
||||
cy.wrap($el).type(rule.thresholdField, { delay: 35 });
|
||||
|
||||
cy.get(IMPORT_QUERY_FROM_SAVED_TIMELINE_LINK).click();
|
||||
cy.get(TIMELINE(rule.timeline.id!)).click();
|
||||
|
@ -301,6 +302,7 @@ export const fillDefineThresholdRuleAndContinue = (rule: ThresholdRule) => {
|
|||
cy.get(THRESHOLD_INPUT_AREA)
|
||||
.find(INPUT)
|
||||
.then((inputs) => {
|
||||
cy.wrap(inputs[thresholdField]).click();
|
||||
cy.wrap(inputs[thresholdField]).pipe(typeThresholdField);
|
||||
cy.get(THRESHOLD_FIELD_SELECTION).click({ force: true });
|
||||
cy.wrap(inputs[threshold]).clear().type(rule.threshold);
|
||||
|
|
|
@ -5,52 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ALL_HOSTS_TABLE, HOSTS_NAMES_DRAGGABLE, HOSTS_NAMES } from '../../screens/hosts/all_hosts';
|
||||
import { TIMELINE_DATA_PROVIDERS, TIMELINE_DATA_PROVIDERS_EMPTY } from '../../screens/timeline';
|
||||
import { ALL_HOSTS_TABLE, HOSTS_NAMES } from '../../screens/hosts/all_hosts';
|
||||
|
||||
import { drag, dragWithoutDrop, drop } from '../../tasks/common';
|
||||
|
||||
export const dragAndDropFirstHostToTimeline = () => {
|
||||
cy.get(HOSTS_NAMES_DRAGGABLE)
|
||||
.first()
|
||||
.then((firstHost) => drag(firstHost));
|
||||
cy.get(TIMELINE_DATA_PROVIDERS)
|
||||
.filter(':visible')
|
||||
.then((dataProvidersDropArea) => drop(dataProvidersDropArea));
|
||||
};
|
||||
|
||||
export const dragFirstHostToEmptyTimelineDataProviders = () => {
|
||||
cy.get(HOSTS_NAMES_DRAGGABLE)
|
||||
.first()
|
||||
.then((host) => drag(host));
|
||||
|
||||
cy.get(TIMELINE_DATA_PROVIDERS_EMPTY)
|
||||
.filter(':visible')
|
||||
.then((dataProvidersDropArea) => dragWithoutDrop(dataProvidersDropArea));
|
||||
};
|
||||
|
||||
export const unDragFirstHostToEmptyTimelineDataProviders = () => {
|
||||
cy.get(HOSTS_NAMES_DRAGGABLE)
|
||||
.first()
|
||||
.then((host) => {
|
||||
cy.wrap(host)
|
||||
.trigger('mousemove', {
|
||||
button: 0,
|
||||
clientX: host[0].getBoundingClientRect().left,
|
||||
clientY: host[0].getBoundingClientRect().top,
|
||||
force: true,
|
||||
})
|
||||
.wait(300)
|
||||
.trigger('mouseup', { force: true })
|
||||
.wait(300);
|
||||
});
|
||||
};
|
||||
|
||||
export const dragFirstHostToTimeline = () => {
|
||||
cy.get(HOSTS_NAMES_DRAGGABLE)
|
||||
.first()
|
||||
.then((host) => drag(host));
|
||||
};
|
||||
export const openFirstHostDetails = () => {
|
||||
cy.get(HOSTS_NAMES).first().click({ force: true });
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import { Timeline, TimelineFilter } from '../objects/timeline';
|
||||
|
||||
import { ALL_CASES_CREATE_NEW_CASE_TABLE_BTN } from '../screens/all_cases';
|
||||
import { FIELDS_BROWSER_CHECKBOX } from '../screens/fields_browser';
|
||||
import { LOADING_INDICATOR } from '../screens/security_header';
|
||||
|
||||
import {
|
||||
|
@ -20,7 +21,7 @@ import {
|
|||
CLOSE_TIMELINE_BTN,
|
||||
COMBO_BOX,
|
||||
CREATE_NEW_TIMELINE,
|
||||
DATAGRID_HEADERS,
|
||||
FIELD_BROWSER,
|
||||
ID_FIELD,
|
||||
ID_HEADER_FIELD,
|
||||
ID_TOGGLE_FIELD,
|
||||
|
@ -70,6 +71,8 @@ import { REFRESH_BUTTON, TIMELINE } from '../screens/timelines';
|
|||
|
||||
import { drag, drop } from '../tasks/common';
|
||||
|
||||
import { closeFieldsBrowser, filterFieldsBrowser } from '../tasks/fields_browser';
|
||||
|
||||
export const hostExistsQuery = 'host.name: *';
|
||||
|
||||
export const addDescriptionToTimeline = (description: string) => {
|
||||
|
@ -327,13 +330,11 @@ export const dragAndDropIdToggleFieldToTimeline = () => {
|
|||
.then((headersDropArea) => drop(headersDropArea));
|
||||
};
|
||||
|
||||
export const removeColumn = (column: number) => {
|
||||
cy.get(DATAGRID_HEADERS)
|
||||
.eq(column)
|
||||
.click()
|
||||
.within(() => {
|
||||
cy.get('button').eq(0).click({ force: true });
|
||||
});
|
||||
export const removeColumn = (columnName: string) => {
|
||||
cy.get(FIELD_BROWSER).first().click();
|
||||
filterFieldsBrowser(columnName);
|
||||
cy.get(FIELDS_BROWSER_CHECKBOX(columnName)).click();
|
||||
closeFieldsBrowser();
|
||||
};
|
||||
|
||||
export const resetFields = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue