Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.0] added fix for gantt-charts test for different timezones #818

Merged
merged 4 commits into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading