Skip to content

Commit

Permalink
refactor getHitCount, use Last_1 year (#143912)
Browse files Browse the repository at this point in the history
* refactor getHitCount, use Last_1 year

* revert change to heartbeat test
  • Loading branch information
Lee Drengenberg authored Oct 25, 2022
1 parent 2cb04a6 commit 1cd4c48
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ export class DiscoverPageObject extends FtrService {
return await this.testSubjects.getVisibleText('unifiedHistogramQueryHits');
}

public async getHitCountInt() {
return parseInt(await this.getHitCount(), 10);
}

public async getDocHeader() {
const table = await this.getDocTable();
const docHeader = await table.getHeaders();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down
8 changes: 4 additions & 4 deletions x-pack/test/upgrade/apps/discover/discover_smoke_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 1cd4c48

Please sign in to comment.