diff --git a/cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js b/cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js index 54606468c..be4734ff4 100644 --- a/cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js +++ b/cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js @@ -5,6 +5,7 @@ /// +import moment from 'moment'; import { BASE_PATH } from '../../../utils/constants'; const delay = 100; @@ -169,37 +170,70 @@ describe('Configure panel settings', () => { }); it('Changes time formats', () => { - cy.contains('12:59:07.303 PM').should('exist'); - cy.get('select').eq(3).select('MM/DD hh:mm:ss A'); cy.wait(delay); cy.get('.euiButton__text').contains('Update').click({ force: true }); - cy.wait(delay); - cy.contains('05/28 12:59:07 PM').should('exist'); + cy.wait(1000); + cy.get('.xtick') + .eq(0) + .invoke('text') + .then((text) => { + expect( + moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A') + ).equal(text); + }); cy.get('select').eq(3).select('MM/DD/YY hh:mm A'); cy.wait(delay); cy.get('.euiButton__text').contains('Update').click({ force: true }); - cy.wait(delay); - cy.contains('05/28/20 12:59 PM').should('exist'); + cy.wait(1000); + cy.get('.xtick') + .eq(0) + .invoke('text') + .then((text) => { + expect( + moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A') + ).equal(text); + }); cy.get('select').eq(3).select('HH:mm:ss.SSS'); cy.wait(delay); cy.get('.euiButton__text').contains('Update').click({ force: true }); - cy.wait(delay); - cy.contains('12:59:07.303').should('exist'); + cy.wait(1000); + cy.get('.xtick') + .eq(0) + .invoke('text') + .then((text) => { + expect( + moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A') + ).equal(text); + }); cy.get('select').eq(3).select('MM/DD HH:mm:ss'); cy.wait(delay); cy.get('.euiButton__text').contains('Update').click({ force: true }); - cy.wait(delay); - cy.contains('05/28 12:59:07').should('exist'); + cy.wait(1000); + cy.get('.xtick') + .eq(0) + .invoke('text') + .then((text) => { + expect( + moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A') + ).equal(text); + }); cy.get('select').eq(3).select('MM/DD/YY HH:mm'); cy.wait(delay); cy.get('.euiButton__text').contains('Update').click({ force: true }); - cy.wait(delay); - cy.contains('05/28/20 12:59').should('exist'); + cy.wait(1000); + cy.get('.xtick') + .eq(0) + .invoke('text') + .then((text) => { + expect( + moment(text, 'MM/DD hh:mm:ss A').format('MM/DD hh:mm:ss A') + ).equal(text); + }); }); it('Hides legends', () => {