improves timeline creation cypress test (#88628)
This commit is contained in:
parent
f7d9212c34
commit
df99216bae
|
@ -32,9 +32,8 @@ import { cleanKibana } from '../tasks/common';
|
|||
import { loginAndWaitForPage } from '../tasks/login';
|
||||
import { openTimelineUsingToggle } from '../tasks/security_main';
|
||||
import {
|
||||
addDescriptionToTimeline,
|
||||
addFilter,
|
||||
addNameToTimeline,
|
||||
addNameAndDescriptionToTimeline,
|
||||
addNotesToTimeline,
|
||||
closeTimeline,
|
||||
createNewTimeline,
|
||||
|
@ -58,6 +57,11 @@ describe('Timelines', () => {
|
|||
|
||||
loginAndWaitForPage(OVERVIEW_URL);
|
||||
openTimelineUsingToggle();
|
||||
addNameAndDescriptionToTimeline(timeline);
|
||||
|
||||
cy.wait('@timeline').then(({ response }) => {
|
||||
const timelineId = response!.body.data.persistTimeline.timeline.savedObjectId;
|
||||
|
||||
populateTimeline();
|
||||
addFilter(timeline.filter);
|
||||
pinFirstEvent();
|
||||
|
@ -67,12 +71,6 @@ describe('Timelines', () => {
|
|||
.and('match', /Unpin the event in row 2/);
|
||||
cy.get(LOCKED_ICON).should('be.visible');
|
||||
|
||||
addNameToTimeline(timeline.title);
|
||||
|
||||
cy.wait('@timeline').then(({ response }) => {
|
||||
const timelineId = response!.body.data.persistTimeline.timeline.savedObjectId;
|
||||
|
||||
addDescriptionToTimeline(timeline.description);
|
||||
addNotesToTimeline(timeline.notes);
|
||||
markAsFavorite();
|
||||
waitForTimelineChanges();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { TimelineFilter } from '../objects/timeline';
|
||||
import { Timeline, TimelineFilter } from '../objects/timeline';
|
||||
|
||||
import { ALL_CASES_CREATE_NEW_CASE_TABLE_BTN } from '../screens/all_cases';
|
||||
|
||||
|
@ -72,6 +72,16 @@ export const addNameToTimeline = (name: string) => {
|
|||
cy.get(TIMELINE_TITLE_INPUT).should('not.exist');
|
||||
};
|
||||
|
||||
export const addNameAndDescriptionToTimeline = (timeline: Timeline) => {
|
||||
cy.get(TIMELINE_EDIT_MODAL_OPEN_BUTTON).first().click();
|
||||
cy.get(TIMELINE_TITLE_INPUT).type(`${timeline.title}{enter}`);
|
||||
cy.get(TIMELINE_TITLE_INPUT).should('have.attr', 'value', timeline.title);
|
||||
cy.get(TIMELINE_DESCRIPTION_INPUT).type(timeline.description);
|
||||
cy.get(TIMELINE_DESCRIPTION_INPUT).invoke('val').should('equal', timeline.description);
|
||||
cy.get(TIMELINE_EDIT_MODAL_SAVE_BUTTON).click();
|
||||
cy.get(TIMELINE_TITLE_INPUT).should('not.exist');
|
||||
};
|
||||
|
||||
export const addNotesToTimeline = (notes: string) => {
|
||||
cy.get(NOTES_TAB_BUTTON).click();
|
||||
cy.get(NOTES_TEXT_AREA).type(notes);
|
||||
|
|
Loading…
Reference in a new issue