From 4ae6c04e735bef7d47fa8ab335f2a64fd6a9b7df Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Sat, 26 Sep 2020 17:58:31 +0200 Subject: [PATCH] fixes url timeline flaky test --- .../cypress/integration/url_state.spec.ts | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/x-pack/plugins/security_solution/cypress/integration/url_state.spec.ts b/x-pack/plugins/security_solution/cypress/integration/url_state.spec.ts index 2588c580dedd34..47e1a4153c07a7 100644 --- a/x-pack/plugins/security_solution/cypress/integration/url_state.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/url_state.spec.ts @@ -32,16 +32,18 @@ import { waitForIpsTableToBeLoaded } from '../tasks/network/flows'; import { clearSearchBar, kqlSearch, navigateFromHeaderTo } from '../tasks/security_header'; import { openTimelineUsingToggle } from '../tasks/security_main'; import { - addDescriptionToTimeline, addNameToTimeline, closeTimeline, - executeTimelineKQL, + populateTimeline, waitForTimelineChanges, } from '../tasks/timeline'; import { HOSTS_URL } from '../urls/navigation'; import { ABSOLUTE_DATE_RANGE } from '../urls/state'; +import { timeline } from '../objects/timeline'; +import { TIMELINE } from '../screens/create_new_case'; + const ABSOLUTE_DATE = { endTime: '2019-08-01T20:33:29.186Z', endTimeTimeline: '2019-08-02T21:03:29.186Z', @@ -51,8 +53,7 @@ const ABSOLUTE_DATE = { startTimeTimeline: '2019-08-02T20:03:29.186Z', }; -// FLAKY: https://github.com/elastic/kibana/issues/61612 -describe.skip('url state', () => { +describe('url state', () => { it('sets the global start and end dates from the url', () => { loginAndWaitForPageWithoutDateRange(ABSOLUTE_DATE_RANGE.url); cy.get(DATE_PICKER_START_DATE_POPOVER_BUTTON).should( @@ -222,23 +223,12 @@ describe.skip('url state', () => { it('sets and reads the url state for timeline by id', () => { loginAndWaitForPage(HOSTS_URL); openTimelineUsingToggle(); - executeTimelineKQL('host.name: *'); - - cy.get(SERVER_SIDE_EVENT_COUNT) - .invoke('text') - .then((strCount) => { - const intCount = +strCount; - cy.wrap(intCount).should('be.above', 0); - }); + populateTimeline(); cy.server(); cy.route('PATCH', '**/api/timeline').as('timeline'); - const timelineName = 'Security'; - const timelineDescription = 'This is the best timeline of the world'; - addNameToTimeline(timelineName); - waitForTimelineChanges(); - addDescriptionToTimeline(timelineDescription); + addNameToTimeline(timeline.title); waitForTimelineChanges(); cy.wait('@timeline').then((response) => { @@ -249,9 +239,10 @@ describe.skip('url state', () => { cy.visit('/app/home'); cy.visit(`/app/security/timelines?timeline=(id:'${timelineId}',isOpen:!t)`); cy.get(DATE_PICKER_APPLY_BUTTON_TIMELINE).should('exist'); - cy.get(DATE_PICKER_APPLY_BUTTON_TIMELINE).invoke('text').should('not.equal', 'Updating'); + cy.get(DATE_PICKER_APPLY_BUTTON_TIMELINE).should('not.have.text', 'Updating'); + cy.get(TIMELINE).should('be.visible'); cy.get(TIMELINE_TITLE).should('be.visible'); - cy.get(TIMELINE_TITLE).should('have.attr', 'value', timelineName); + cy.get(TIMELINE_TITLE).should('have.attr', 'value', timeline.title); }); }); });