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

[8.12] [Discover] Improve histogram functional tests (#174038) #174065

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
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
12 changes: 3 additions & 9 deletions test/functional/apps/discover/group1/_discover_histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
await security.testUser.setRoles(['kibana_admin', 'long_window_logstash']);
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await PageObjects.common.navigateToApp('discover');
});
after(async () => {
Expand All @@ -65,13 +66,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should modify the time range when the histogram is brushed', async function () {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
// this is the number of renderings of the histogram needed when new data is fetched
let renderingCountInc = 1;
const prevRenderingCount = await elasticChart.getVisualizationRenderingCount();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
await queryBar.submitQuery();
await retry.waitFor('chart rendering complete', async () => {
const actualCount = await elasticChart.getVisualizationRenderingCount();
const expectedCount = prevRenderingCount + renderingCountInc;
Expand Down Expand Up @@ -107,8 +105,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should update correctly when switching data views and brushing the histogram', async () => {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.selectIndexPattern('logstash-*');
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.selectIndexPattern('long-window-logstash-*');
Expand Down Expand Up @@ -281,7 +277,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should recover from broken query search when clearing the query bar', async () => {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.timePicker.setDefaultAbsoluteRange();
// Make sure the chart is visible
await testSubjects.click('unifiedHistogramChartOptionsToggle');
await testSubjects.click('unifiedHistogramChartToggle');
Expand All @@ -294,8 +289,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

// now remove the query
await queryBar.clearQuery();
await queryBar.clickQuerySubmitButton();
await PageObjects.header.waitUntilLoadingHasFinished();
await queryBar.submitQuery();
await PageObjects.discover.waitUntilSearchingHasFinished();
// check no error state
expect(await PageObjects.discover.isChartVisible()).to.be(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
await security.testUser.setRoles(['kibana_admin', 'long_window_logstash']);
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
await PageObjects.common.navigateToApp('discover');
});
after(async () => {
Expand All @@ -64,13 +65,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should modify the time range when the histogram is brushed', async function () {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
// this is the number of renderings of the histogram needed when new data is fetched
let renderingCountInc = 1;
const prevRenderingCount = await elasticChart.getVisualizationRenderingCount();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
await queryBar.submitQuery();
await retry.waitFor('chart rendering complete', async () => {
const actualCount = await elasticChart.getVisualizationRenderingCount();
const expectedCount = prevRenderingCount + renderingCountInc;
Expand Down Expand Up @@ -108,8 +106,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should update correctly when switching data views and brushing the histogram', async () => {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.selectIndexPattern('logstash-*');
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.selectIndexPattern('long-window-logstash-*');
Expand All @@ -118,7 +114,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.discover.waitUntilSearchingHasFinished();
// TODO: The Serverless sidebar causes `PageObjects.discover.brushHistogram()`
// to brush a different range in the histogram, resulting in a different count
expect(await PageObjects.discover.getHitCount()).to.be('12');
expect(await PageObjects.discover.getHitCount()).to.be('10');
});

it('should update the histogram timerange when the query is resubmitted', async function () {
Expand Down Expand Up @@ -284,7 +280,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
it('should recover from broken query search when clearing the query bar', async () => {
await PageObjects.common.navigateToApp('discover');
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.timePicker.setDefaultAbsoluteRange();
// Make sure the chart is visible
await testSubjects.click('unifiedHistogramChartOptionsToggle');
await testSubjects.click('unifiedHistogramChartToggle');
Expand Down
Loading