[Discover] Improve Discover histogram time range tests (#71056)
* Improve Discover histogram tests * Use includes function to find a string Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
d499b91a9b
commit
216ef477ce
|
@ -96,25 +96,32 @@ export default function ({ getService, getPageObjects }) {
|
|||
it('should modify the time range when a bar is clicked', async function () {
|
||||
await PageObjects.timePicker.setDefaultAbsoluteRange();
|
||||
await PageObjects.discover.clickHistogramBar();
|
||||
await PageObjects.discover.waitUntilSearchingHasFinished();
|
||||
const time = await PageObjects.timePicker.getTimeConfig();
|
||||
expect(time.start).to.be('Sep 21, 2015 @ 09:00:00.000');
|
||||
expect(time.end).to.be('Sep 21, 2015 @ 12:00:00.000');
|
||||
await retry.waitFor('doc table to contain the right search result', async () => {
|
||||
const rowData = await PageObjects.discover.getDocTableField(1);
|
||||
expect(rowData).to.have.string('Sep 21, 2015 @ 11:59:22.316');
|
||||
log.debug(`The first timestamp value in doc table: ${rowData}`);
|
||||
return rowData.includes('Sep 21, 2015 @ 11:59:22.316');
|
||||
});
|
||||
});
|
||||
|
||||
it('should modify the time range when the histogram is brushed', async function () {
|
||||
await PageObjects.timePicker.setDefaultAbsoluteRange();
|
||||
await PageObjects.discover.brushHistogram();
|
||||
await PageObjects.discover.waitUntilSearchingHasFinished();
|
||||
|
||||
const newDurationHours = await PageObjects.timePicker.getTimeDurationInHours();
|
||||
expect(Math.round(newDurationHours)).to.be(24);
|
||||
|
||||
await retry.waitFor('doc table to contain the right search result', async () => {
|
||||
const rowData = await PageObjects.discover.getDocTableField(1);
|
||||
log.debug(`The first timestamp value in doc table: ${rowData}`);
|
||||
expect(Date.parse(rowData)).to.be.within(
|
||||
Date.parse('Sep 20, 2015 @ 17:30:00.000'),
|
||||
Date.parse('Sep 20, 2015 @ 23:30:00.000')
|
||||
);
|
||||
const dateParsed = Date.parse(rowData);
|
||||
//compare against the parsed date of Sep 20, 2015 @ 17:30:00.000 and Sep 20, 2015 @ 23:30:00.000
|
||||
return dateParsed >= 1442770200000 && dateParsed <= 1442791800000;
|
||||
});
|
||||
});
|
||||
|
||||
it('should show correct initial chart interval of Auto', async function () {
|
||||
|
|
Loading…
Reference in a new issue