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 { loginAndWaitForPage } from '../tasks/login';
|
||||||
import { openTimelineUsingToggle } from '../tasks/security_main';
|
import { openTimelineUsingToggle } from '../tasks/security_main';
|
||||||
import {
|
import {
|
||||||
addDescriptionToTimeline,
|
|
||||||
addFilter,
|
addFilter,
|
||||||
addNameToTimeline,
|
addNameAndDescriptionToTimeline,
|
||||||
addNotesToTimeline,
|
addNotesToTimeline,
|
||||||
closeTimeline,
|
closeTimeline,
|
||||||
createNewTimeline,
|
createNewTimeline,
|
||||||
|
@ -58,21 +57,20 @@ describe('Timelines', () => {
|
||||||
|
|
||||||
loginAndWaitForPage(OVERVIEW_URL);
|
loginAndWaitForPage(OVERVIEW_URL);
|
||||||
openTimelineUsingToggle();
|
openTimelineUsingToggle();
|
||||||
populateTimeline();
|
addNameAndDescriptionToTimeline(timeline);
|
||||||
addFilter(timeline.filter);
|
|
||||||
pinFirstEvent();
|
|
||||||
|
|
||||||
cy.get(PIN_EVENT)
|
|
||||||
.should('have.attr', 'aria-label')
|
|
||||||
.and('match', /Unpin the event in row 2/);
|
|
||||||
cy.get(LOCKED_ICON).should('be.visible');
|
|
||||||
|
|
||||||
addNameToTimeline(timeline.title);
|
|
||||||
|
|
||||||
cy.wait('@timeline').then(({ response }) => {
|
cy.wait('@timeline').then(({ response }) => {
|
||||||
const timelineId = response!.body.data.persistTimeline.timeline.savedObjectId;
|
const timelineId = response!.body.data.persistTimeline.timeline.savedObjectId;
|
||||||
|
|
||||||
addDescriptionToTimeline(timeline.description);
|
populateTimeline();
|
||||||
|
addFilter(timeline.filter);
|
||||||
|
pinFirstEvent();
|
||||||
|
|
||||||
|
cy.get(PIN_EVENT)
|
||||||
|
.should('have.attr', 'aria-label')
|
||||||
|
.and('match', /Unpin the event in row 2/);
|
||||||
|
cy.get(LOCKED_ICON).should('be.visible');
|
||||||
|
|
||||||
addNotesToTimeline(timeline.notes);
|
addNotesToTimeline(timeline.notes);
|
||||||
markAsFavorite();
|
markAsFavorite();
|
||||||
waitForTimelineChanges();
|
waitForTimelineChanges();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
* 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';
|
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');
|
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) => {
|
export const addNotesToTimeline = (notes: string) => {
|
||||||
cy.get(NOTES_TAB_BUTTON).click();
|
cy.get(NOTES_TAB_BUTTON).click();
|
||||||
cy.get(NOTES_TEXT_AREA).type(notes);
|
cy.get(NOTES_TEXT_AREA).type(notes);
|
||||||
|
|
Loading…
Reference in a new issue