forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Adds "Creates timeline" Cypress test (elastic#76836…
…) (elastic#77871) * adds "Creates timeline" test * deletes timeline events spec * completes assertions * comments assertion * fixes typecheck error * waits for all the changes in the timeline to be performed before creating a new timeline and closing the toggle * fixes failing problem * fixes loop script * makes test realiable on visual mode * fixes merge issue * makes test more reliable * fixes typecheck issue * fixes typecheck * opens timeline from timeline settings Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
e04438a
commit ea360ec
Showing
27 changed files
with
307 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
x-pack/plugins/security_solution/cypress/integration/timeline_creation.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { timeline } from '../objects/timeline'; | ||
|
||
import { | ||
FAVORITE_TIMELINE, | ||
LOCKED_ICON, | ||
NOTES, | ||
NOTES_BUTTON, | ||
NOTES_COUNT, | ||
NOTES_TEXT_AREA, | ||
PIN_EVENT, | ||
TIMELINE_DESCRIPTION, | ||
// TIMELINE_FILTER, | ||
TIMELINE_QUERY, | ||
TIMELINE_TITLE, | ||
} from '../screens/timeline'; | ||
import { | ||
TIMELINES_DESCRIPTION, | ||
TIMELINES_PINNED_EVENT_COUNT, | ||
TIMELINES_NOTES_COUNT, | ||
TIMELINES_FAVORITE, | ||
} from '../screens/timelines'; | ||
|
||
import { loginAndWaitForPage } from '../tasks/login'; | ||
import { openTimelineUsingToggle } from '../tasks/security_main'; | ||
import { | ||
addDescriptionToTimeline, | ||
addFilter, | ||
addNameToTimeline, | ||
addNotesToTimeline, | ||
closeNotes, | ||
closeTimeline, | ||
createNewTimeline, | ||
markAsFavorite, | ||
openTimelineFromSettings, | ||
pinFirstEvent, | ||
populateTimeline, | ||
waitForTimelineChanges, | ||
} from '../tasks/timeline'; | ||
import { openTimeline } from '../tasks/timelines'; | ||
|
||
import { OVERVIEW_URL } from '../urls/navigation'; | ||
|
||
describe('Timelines', () => { | ||
before(() => { | ||
cy.server(); | ||
cy.route('PATCH', '**/api/timeline').as('timeline'); | ||
}); | ||
|
||
it('Creates a timeline', async () => { | ||
loginAndWaitForPage(OVERVIEW_URL); | ||
openTimelineUsingToggle(); | ||
populateTimeline(); | ||
addFilter(timeline.filter); | ||
pinFirstEvent(); | ||
|
||
cy.get(PIN_EVENT).should('have.attr', 'aria-label', 'Pinned event'); | ||
cy.get(LOCKED_ICON).should('be.visible'); | ||
|
||
addNameToTimeline(timeline.title); | ||
|
||
const response = await cy.wait('@timeline').promisify(); | ||
const timelineId = JSON.parse(response.xhr.responseText).data.persistTimeline.timeline | ||
.savedObjectId; | ||
|
||
addDescriptionToTimeline(timeline.description); | ||
addNotesToTimeline(timeline.notes); | ||
closeNotes(); | ||
markAsFavorite(); | ||
waitForTimelineChanges(); | ||
createNewTimeline(); | ||
closeTimeline(); | ||
openTimelineFromSettings(); | ||
|
||
cy.contains(timeline.title).should('exist'); | ||
cy.get(TIMELINES_DESCRIPTION).first().should('have.text', timeline.description); | ||
cy.get(TIMELINES_PINNED_EVENT_COUNT).first().should('have.text', '1'); | ||
cy.get(TIMELINES_NOTES_COUNT).first().should('have.text', '1'); | ||
cy.get(TIMELINES_FAVORITE).first().should('exist'); | ||
|
||
openTimeline(timelineId); | ||
|
||
cy.get(FAVORITE_TIMELINE).should('exist'); | ||
cy.get(TIMELINE_TITLE).should('have.attr', 'value', timeline.title); | ||
cy.get(TIMELINE_DESCRIPTION).should('have.attr', 'value', timeline.description); | ||
cy.get(TIMELINE_QUERY).should('have.text', timeline.query); | ||
// Comments this assertion until we agreed what to do with the filters. | ||
// cy.get(TIMELINE_FILTER(timeline.filter)).should('exist'); | ||
cy.get(NOTES_COUNT).should('have.text', '1'); | ||
cy.get(PIN_EVENT).should('have.attr', 'aria-label', 'Pinned event'); | ||
cy.get(NOTES_BUTTON).click(); | ||
cy.get(NOTES_TEXT_AREA).should('have.attr', 'placeholder', 'Add a Note'); | ||
cy.get(NOTES).should('have.text', timeline.notes); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
x-pack/plugins/security_solution/cypress/integration/timeline_events.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.