Skip to content

Commit

Permalink
time format test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsongl committed Nov 18, 2019
1 parent 88e2edc commit ea8e0c6
Show file tree
Hide file tree
Showing 53 changed files with 167 additions and 234 deletions.
5 changes: 1 addition & 4 deletions test/accessibility/apps/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

import { FtrProviderContext } from '../ftr_provider_context';

const FROM_TIME = '2015-09-19 06:31:44.000';
const TO_TIME = '2015-09-23 18:31:44.000';

export default function({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'timePicker']);
const a11y = getService('a11y');
Expand All @@ -36,7 +33,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
defaultIndex: 'logstash-*',
});
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setAbsoluteRange(FROM_TIME, TO_TIME);
await PageObjects.timePicker.setDefaultAbsoluteRange();
});

it('main view', async () => {
Expand Down
4 changes: 1 addition & 3 deletions test/functional/apps/context/_discover_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import expect from '@kbn/expect';

const TEST_DISCOVER_START_TIME = '2015-09-19 06:31:44.000';
const TEST_DISCOVER_END_TIME = '2015-09-23 18:31:44.000';
const TEST_COLUMN_NAMES = ['@message'];
const TEST_FILTER_COLUMN_NAMES = [['extension', 'jpg'], ['geo.src', 'IN']];

Expand All @@ -34,7 +32,7 @@ export default function ({ getService, getPageObjects }) {
this.tags('smoke');
before(async function () {
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setAbsoluteRange(TEST_DISCOVER_START_TIME, TEST_DISCOVER_END_TIME);
await PageObjects.timePicker.setDefaultAbsoluteRange();
await Promise.all(TEST_COLUMN_NAMES.map((columnName) => (
PageObjects.discover.clickFieldListItemAdd(columnName)
)));
Expand Down
19 changes: 8 additions & 11 deletions test/functional/apps/dashboard/dashboard_time.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import expect from '@kbn/expect';

const dashboardName = 'Dashboard Test Time';

const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';

export default function ({ getPageObjects, getService }) {
const PageObjects = getPageObjects(['dashboard', 'header', 'timePicker']);
const browser = getService('browser');
Expand All @@ -46,31 +43,31 @@ export default function ({ getPageObjects, getService }) {
});

it('Does not set the time picker on open', async () => {
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setDefaultAbsoluteRange();

await PageObjects.dashboard.loadSavedDashboard(dashboardName);

const time = await PageObjects.timePicker.getTimeConfig();
expect(time.start).to.equal('Sep 19, 2015 @ 06:31:44.000');
expect(time.end).to.equal('Sep 23, 2015 @ 18:31:44.000');
expect(time.start).to.equal(PageObjects.timePicker.defaultStartTime);
expect(time.end).to.equal(PageObjects.timePicker.defaultEndTime);
});
});

describe('dashboard with stored timed', function () {
it('is saved with time', async function () {
await PageObjects.dashboard.switchToEditMode();
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true });
});

it('sets time on open', async function () {
await PageObjects.timePicker.setAbsoluteRange('2019-01-01 00:00:00.000', '2019-01-02 00:00:00.000');
await PageObjects.timePicker.setAbsoluteRange('Jan 1, 2019 @ 00:00:00.000', 'Jan 2, 2019 @ 00:00:00.000');

await PageObjects.dashboard.loadSavedDashboard(dashboardName);

const time = await PageObjects.timePicker.getTimeConfig();
expect(time.start).to.equal('Sep 19, 2015 @ 06:31:44.000');
expect(time.end).to.equal('Sep 23, 2015 @ 18:31:44.000');
expect(time.start).to.equal(PageObjects.timePicker.defaultStartTime);
expect(time.end).to.equal(PageObjects.timePicker.defaultEndTime);
});

// If time is stored with a dashboard, it's supposed to override the current time settings when opened.
Expand Down Expand Up @@ -99,7 +96,7 @@ export default function ({ getPageObjects, getService }) {
it('preserved during navigation', async function () {
await PageObjects.dashboard.loadSavedDashboard(dashboardName);

await PageObjects.timePicker.setAbsoluteRange('2019-01-01 00:00:00.000', '2019-01-02 00:00:00.000');
await PageObjects.timePicker.setAbsoluteRange('Jan 1, 2019 @ 00:00:00.000', 'Jan 2, 2019 @ 00:00:00.000');
await PageObjects.header.clickVisualize();
await PageObjects.header.clickDashboard();

Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/dashboard/dashboard_time_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function ({ getService, getPageObjects }) {
await dashboardExpect.docTableFieldCount(150);

// Set to time range with no data
await PageObjects.timePicker.setAbsoluteRange('2000-01-01 00:00:00.000', '2000-01-01 01:00:00.000');
await PageObjects.timePicker.setAbsoluteRange('Jan 1, 2000 @ 00:00:00.000', 'Jan 1, 2000 @ 01:00:00.000');
await dashboardExpect.docTableFieldCount(0);
});

Expand Down
16 changes: 8 additions & 8 deletions test/functional/apps/dashboard/embeddable_rendering.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.preserveCrossAppState();
await PageObjects.dashboard.clickNewDashboard();

const fromTime = '2018-01-01 00:00:00.000';
const toTime = '2018-04-13 00:00:00.000';
const fromTime = 'Jan 1, 2018 @ 00:00:00.000';
const toTime = 'Apr 13, 2018 @ 00:00:00.000';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
});

Expand Down Expand Up @@ -145,8 +145,8 @@ export default function ({ getService, getPageObjects }) {

it('data rendered correctly when dashboard is opened from listing page', async () => {
// Change the time to make sure that it's updated when re-opened from the listing page.
const fromTime = '2018-05-10 00:00:00.000';
const toTime = '2018-05-11 00:00:00.000';
const fromTime = 'May 10, 2018 @ 00:00:00.000';
const toTime = 'May 11, 2018 @ 00:00:00.000';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.dashboard.loadSavedDashboard('embeddable rendering test');
await PageObjects.dashboard.waitForRenderComplete();
Expand All @@ -162,16 +162,16 @@ export default function ({ getService, getPageObjects }) {
});

it('panels are updated when time changes outside of data', async () => {
const fromTime = '2018-05-11 00:00:00.000';
const toTime = '2018-05-12 00:00:00.000';
const fromTime = 'May 11, 2018 @ 00:00:00.000';
const toTime = 'May 12, 2018 @ 00:00:00.000';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.dashboard.waitForRenderComplete();
await expectNoDataRenders();
});

it('panels are updated when time changes inside of data', async () => {
const fromTime = '2018-01-01 00:00:00.000';
const toTime = '2018-04-13 00:00:00.000';
const fromTime = 'Jan 1, 2018 @ 00:00:00.000';
const toTime = 'Apr 13, 2018 @ 00:00:00.000';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.dashboard.waitForRenderComplete();
await expectAllDataRenders();
Expand Down
10 changes: 5 additions & 5 deletions test/functional/apps/dashboard/view_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: true });

await PageObjects.dashboard.switchToEditMode();
await PageObjects.timePicker.setAbsoluteRange('2013-09-19 06:31:44.000', '2013-09-19 06:31:44.000');
await PageObjects.timePicker.setAbsoluteRange('Sep 19, 2013 @ 06:31:44.000', 'Sep 19, 2013 @ 06:31:44.000');
await PageObjects.dashboard.clickCancelOutOfEditMode();

// confirm lose changes
Expand Down Expand Up @@ -161,10 +161,10 @@ export default function ({ getService, getPageObjects }) {
describe('and preserves edits on cancel', function () {
it('when time changed is stored with dashboard', async function () {
await PageObjects.dashboard.gotoDashboardEditMode(dashboardName);
await PageObjects.timePicker.setAbsoluteRange('2013-09-19 06:31:44.000', '2013-09-19 06:31:44.000');
await PageObjects.timePicker.setAbsoluteRange('Sep 19, 2013 @ 06:31:44.000', 'Sep 19, 2013 @ 06:31:44.000');
await PageObjects.dashboard.saveDashboard(dashboardName, true);
await PageObjects.dashboard.switchToEditMode();
await PageObjects.timePicker.setAbsoluteRange('2015-09-19 06:31:44.000', '2015-09-19 06:31:44.000');
await PageObjects.timePicker.setAbsoluteRange('Sep 19, 2015 @ 06:31:44.000', 'Sep 19, 2015 @ 06:31:44.000');
await PageObjects.dashboard.clickCancelOutOfEditMode();

await PageObjects.common.clickCancelOnModal();
Expand All @@ -186,7 +186,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.setTimepickerInDataRange();
await PageObjects.dashboard.saveDashboard(dashboardName, true);
await PageObjects.dashboard.switchToEditMode();
await PageObjects.timePicker.setAbsoluteRange('2013-09-19 06:31:44.000', '2013-09-19 06:31:44.000');
await PageObjects.timePicker.setAbsoluteRange('Sep 19, 2013 @ 06:31:44.000', 'Sep 19, 2013 @ 06:31:44.000');
const newTime = await PageObjects.timePicker.getTimeConfig();

await PageObjects.dashboard.clickCancelOutOfEditMode();
Expand All @@ -208,7 +208,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.dashboard.gotoDashboardEditMode(dashboardName);
await PageObjects.dashboard.saveDashboard(dashboardName, { storeTimeWithDashboard: false });
await PageObjects.dashboard.switchToEditMode();
await PageObjects.timePicker.setAbsoluteRange('2014-10-19 06:31:44.000', '2014-12-19 06:31:44.000');
await PageObjects.timePicker.setAbsoluteRange('Oct 19, 2014 @ 06:31:44.000', 'Dec 19, 2014 @ 06:31:44.000');
await PageObjects.dashboard.clickCancelOutOfEditMode();

await PageObjects.common.expectConfirmModalOpenState(false);
Expand Down
8 changes: 4 additions & 4 deletions test/functional/apps/discover/_date_nanos.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common', 'timePicker', 'discover']);
const kibanaServer = getService('kibanaServer');
const fromTime = '2019-09-22 20:31:44.000';
const toTime = '2019-09-23 03:31:44.000';
const fromTime = 'Sep 22, 2019 @ 20:31:44.000';
const toTime = 'Sep 23, 2019 @ 03:31:44.000';

describe('date_nanos', function () {

Expand All @@ -41,8 +41,8 @@ export default function ({ getService, getPageObjects }) {

it('should show a timestamp with nanoseconds in the first result row', async function () {
const time = await PageObjects.timePicker.getTimeConfig();
expect(time.start).to.be('Sep 22, 2019 @ 20:31:44.000');
expect(time.end).to.be('Sep 23, 2019 @ 03:31:44.000');
expect(time.start).to.be(fromTime);
expect(time.end).to.be(toTime);
const rowData = await PageObjects.discover.getDocTableIndex(1);
expect(rowData.startsWith('Sep 22, 2019 @ 23:50:13.253123345')).to.be.ok();
});
Expand Down
4 changes: 2 additions & 2 deletions test/functional/apps/discover/_date_nanos_mixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default function ({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common', 'timePicker', 'discover']);
const kibanaServer = getService('kibanaServer');
const fromTime = '2019-01-01 00:00:00.000';
const toTime = '2019-01-01 23:59:59.999';
const fromTime = 'Jan 1, 2019 @ 00:00:00.000';
const toTime = 'Jan 1, 2019 @ 23:59:59.999';

describe('date_nanos_mixed', function () {

Expand Down
24 changes: 11 additions & 13 deletions test/functional/apps/discover/_discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export default function ({ getService, getPageObjects }) {
};

describe('discover test', function describeIndexTests() {
const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';

before(async function () {
log.debug('load kibana index with default index pattern');
Expand All @@ -45,7 +43,7 @@ export default function ({ getService, getPageObjects }) {
await kibanaServer.uiSettings.replace(defaultSettings);
log.debug('discover');
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setDefaultAbsoluteRange();
});

describe('query', function () {
Expand All @@ -54,8 +52,8 @@ export default function ({ getService, getPageObjects }) {

it('should show correct time range string by timepicker', async function () {
const time = await PageObjects.timePicker.getTimeConfig();
expect(time.start).to.be('Sep 19, 2015 @ 06:31:44.000');
expect(time.end).to.be('Sep 23, 2015 @ 18:31:44.000');
expect(time.start).to.be(PageObjects.timePicker.defaultStartTime);
expect(time.end).to.be(PageObjects.timePicker.defaultEndTime);
const rowData = await PageObjects.discover.getDocTableIndex(1);
log.debug('check the newest doc timestamp in UTC (check diff timezone in last test)');
expect(rowData.startsWith('Sep 22, 2015 @ 23:50:13.253')).to.be.ok();
Expand Down Expand Up @@ -88,12 +86,12 @@ export default function ({ getService, getPageObjects }) {

it('should show correct time range string in chart', async function () {
const actualTimeString = await PageObjects.discover.getChartTimespan();
const expectedTimeString = `Sep 19, 2015 @ 06:31:44.000 - Sep 23, 2015 @ 18:31:44.000`;
const expectedTimeString = `${PageObjects.timePicker.defaultStartTime} - ${PageObjects.timePicker.defaultEndTime}`;
expect(actualTimeString).to.be(expectedTimeString);
});

it('should modify the time range when a bar is clicked', async function () {
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.clickHistogramBar();
const time = await PageObjects.timePicker.getTimeConfig();
expect(time.start).to.be('Sep 21, 2015 @ 09:00:00.000');
Expand All @@ -103,7 +101,7 @@ export default function ({ getService, getPageObjects }) {
});

it('should modify the time range when the histogram is brushed', async function () {
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.brushHistogram();

const newDurationHours = await PageObjects.timePicker.getTimeDurationInHours();
Expand All @@ -113,7 +111,7 @@ export default function ({ getService, getPageObjects }) {
});

it('should show correct initial chart interval of Auto', async function () {
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
const actualInterval = await PageObjects.discover.getChartInterval();

Expand All @@ -135,8 +133,8 @@ export default function ({ getService, getPageObjects }) {
});

describe('query #2, which has an empty time range', () => {
const fromTime = '1999-06-11 09:22:11.000';
const toTime = '1999-06-12 11:21:04.000';
const fromTime = 'Jun 11, 1999 @ 09:22:11.000';
const toTime = 'Jun 12, 1999 @ 11:21:04.000';

before(async () => {
log.debug('setAbsoluteRangeForAnotherQuery');
Expand All @@ -159,7 +157,7 @@ export default function ({ getService, getPageObjects }) {

before(async () => {
log.debug('setAbsoluteRangeForAnotherQuery');
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
});

Expand Down Expand Up @@ -213,7 +211,7 @@ export default function ({ getService, getPageObjects }) {
await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'America/Phoenix' });
await browser.refresh();
await PageObjects.header.awaitKibanaChrome();
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setDefaultAbsoluteRange();

log.debug('check that the newest doc timestamp is now -7 hours from the UTC time in the first test');
const rowData = await PageObjects.discover.getDocTableIndex(1);
Expand Down
4 changes: 1 addition & 3 deletions test/functional/apps/discover/_doc_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

import expect from '@kbn/expect';

const TEST_DOC_START_TIME = '2015-09-19 06:31:44.000';
const TEST_DOC_END_TIME = '2015-09-23 18:31:44.000';
const TEST_COLUMN_NAMES = ['@message'];
const TEST_FILTER_COLUMN_NAMES = [['extension', 'jpg'], ['geo.src', 'IN']];

Expand All @@ -35,7 +33,7 @@ export default function ({ getService, getPageObjects }) {
before(async function () {
await esArchiver.loadIfNeeded('logstash_functional');
await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setAbsoluteRange(TEST_DOC_START_TIME, TEST_DOC_END_TIME);
await PageObjects.timePicker.setDefaultAbsoluteRange();
await Promise.all(TEST_COLUMN_NAMES.map((columnName) => (
PageObjects.discover.clickFieldListItemAdd(columnName)
)));
Expand Down
4 changes: 1 addition & 3 deletions test/functional/apps/discover/_field_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export default function ({ getService, getPageObjects }) {
describe('discover tab', function describeIndexTests() {
this.tags('smoke');
before(async function () {
const fromTime = '2015-09-19 06:31:44.000';
const toTime = '2015-09-23 18:31:44.000';

await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('discover');
Expand All @@ -41,7 +39,7 @@ export default function ({ getService, getPageObjects }) {
});

await PageObjects.common.navigateToApp('discover');
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.timePicker.setDefaultAbsoluteRange();
});

describe('field data', function () {
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/discover/_inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function ({ getService, getPageObjects }) {
});

it('should display request stats with results', async () => {
await PageObjects.timePicker.setAbsoluteRange('2015-09-19 06:31:44.000', '2015-09-23 18:31:44.000');
await PageObjects.timePicker.setDefaultAbsoluteRange();

await inspector.open();
const requestStats = await inspector.getTableData();
Expand Down
Loading

0 comments on commit ea8e0c6

Please sign in to comment.