refactor getHitCount, use Last_1 year (#143912) (#143954)

* refactor getHitCount, use Last_1 year

* revert change to heartbeat test

(cherry picked from commit 1cd4c4892d)

Co-authored-by: Lee Drengenberg <lee.drengenberg@elastic.co>
This commit is contained in:
Kibana Machine 2022-10-25 11:31:01 -04:00 committed by GitHub
parent 794da3f676
commit 75595ce8e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 8 deletions

View file

@ -243,6 +243,10 @@ export class DiscoverPageObject extends FtrService {
return await this.testSubjects.getVisibleText('discoverQueryHits');
}
public async getHitCountInt() {
return parseInt(await this.getHitCount(), 10);
}
public async getDocHeader() {
const table = await this.getDocTable();
const docHeader = await table.getHeaders();

View file

@ -18,7 +18,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.selectIndexPattern('filebeat-*');
await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year');
await retry.try(async () => {
const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10);
const hitCount = await PageObjects.discover.getHitCountInt();
expect(hitCount).to.be.greaterThan(0);
});
});

View file

@ -28,7 +28,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.selectIndexPattern('metricbeat-*');
await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year');
await retry.try(async function () {
const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10);
const hitCount = await PageObjects.discover.getHitCountInt();
expect(hitCount).to.be.greaterThan(0);
});
});

View file

@ -32,7 +32,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.selectIndexPattern('packetbeat-*');
await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year');
await retry.try(async function () {
const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10);
const hitCount = await PageObjects.discover.getHitCountInt();
expect(hitCount).to.be.greaterThan(0);
});
});

View file

@ -27,7 +27,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.selectIndexPattern('winlogbeat-*');
await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year');
await retry.try(async function () {
const hitCount = parseInt(await PageObjects.discover.getHitCount(), 10);
const hitCount = await PageObjects.discover.getHitCountInt();
expect(hitCount).to.be.greaterThan(0);
});
});

View file

@ -40,12 +40,12 @@ export default function ({ getPageObjects }: FtrProviderContext) {
await PageObjects.discover.selectIndexPattern(String(index));
await PageObjects.discover.waitUntilSearchingHasFinished();
if (timefield) {
await PageObjects.timePicker.setCommonlyUsedTime('Last_24 hours');
await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year');
await PageObjects.discover.waitUntilSearchingHasFinished();
}
});
it('shows hit count greater than zero', async () => {
const hitCount = await PageObjects.discover.getHitCount();
const hitCount = await PageObjects.discover.getHitCountInt();
if (hits === '') {
expect(hitCount).to.be.greaterThan(0);
} else {
@ -69,12 +69,12 @@ export default function ({ getPageObjects }: FtrProviderContext) {
await PageObjects.home.launchSampleDiscover(name);
await PageObjects.header.waitUntilLoadingHasFinished();
if (timefield) {
await PageObjects.timePicker.setCommonlyUsedTime('Last_24 hours');
await PageObjects.timePicker.setCommonlyUsedTime('Last_1 year');
await PageObjects.discover.waitUntilSearchingHasFinished();
}
});
it('shows hit count greater than zero', async () => {
const hitCount = await PageObjects.discover.getHitCount();
const hitCount = await PageObjects.discover.getHitCountInt();
if (hits === '') {
expect(hitCount).to.be.greaterThan(0);
} else {