Skip to content

Commit

Permalink
[Backport 1.0] added fix for gantt-charts test for different timezones (
Browse files Browse the repository at this point in the history
#818)

* added fix for gantt-charts test for different timezones

Signed-off-by: sumukhswamy <[email protected]>

* added fix for gantt-charts test for different timezones

Signed-off-by: sumukhswamy <[email protected]>

* added fix for gantt-charts test for different timezones

Signed-off-by: sumukhswamy <[email protected]>

* Replacing day.js with moment.js

Signed-off-by: sumukhswamy <[email protected]>

---------

Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy authored Sep 6, 2023
1 parent d59de45 commit b0495d8
Showing 1 changed file with 46 additions and 12 deletions.
58 changes: 46 additions & 12 deletions cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/// <reference types="cypress" />

import { BASE_PATH } from '../../../utils/constants';
import moment from 'moment';

const delay = 100;
const GANTT_VIS_NAME =
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit b0495d8

Please sign in to comment.