test(general): reach Running Queries as the meta org before asserting the SQL tooltip (#15411)

This commit is contained in:
Neha P
2026-10-15 12:16:36 +00:00
committed by GitHub
parent 00be51d925
commit eee507d403
2 changed files with 36 additions and 19 deletions
@@ -31,14 +31,12 @@ export class QueryManagementPage {
this.searchTypeFilter = this.allQueriesList.locator('[data-otoggle-value="dashboards"]');
}
async mockRunningQueries(queries) {
await this.page.route('**/api/*/query_manager/status', (route) =>
route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ status: queries }) })
);
}
// The All Queries tab is v-show-toggled, so the row actions exist in the DOM
// while User Summary is showing — wait for visibility, not just attachment.
async openFirstQueryDetails() {
await this.queryListButton.first().click();
const button = this.queryListButton.first();
await expect(button).toBeVisible({ timeout: 15000 });
await button.click();
await expect(this.queryDetailsTable).toBeVisible({ timeout: 15000 });
}
@@ -1,7 +1,18 @@
// Copyright 2026 OpenObserve Inc.
//
// Query Management ("Running Queries") is enterprise-only and meta-org-only:
// an OSS build redirects /settings/query_management to the enterprise-locked
// page, and an enterprise build redirects any non-meta org back to General
// Settings. The page therefore has to be reached as `_meta` on an enterprise
// build, and the landing tab is User Summary — the per-query rows (and their
// Query List drawer) only exist under the All Queries tab.
const { test, navigateToBase } = require('../../utils/enhanced-baseFixtures.js');
const testLogger = require('../../utils/test-logger.js');
const PageManager = require('../../../pages/page-manager.js');
// Long enough to exceed QueryList's 300-char wrap threshold, so the SQL cell
// truncates and grows the cut-off tooltip this test is about.
const LONG_SQL = `SELECT ${Array.from({ length: 60 }, (_, i) => `col_${i}`).join(', ')} FROM "default" WHERE code = 500`;
test.describe("Query Management SQL tooltip Regression", () => {
@@ -15,25 +26,33 @@ test.describe("Query Management SQL tooltip Regression", () => {
});
test("the full-query tooltip stays anchored to the SQL value while it fades out @bug-2873 @P3 @regression @queryManagement", async ({ page }) => {
await pm.queryManagementPage.mockRunningQueries([
const edition = await pm.editionFeaturesPage.detectEdition();
test.skip(edition === 'opensource', `Query Management is enterprise-only (detected: ${edition})`);
const now = Date.now() * 1000;
// The response shape must match the API: SQL and the time range live under
// `query`, scan counters under `scan_stats`. RunningQueries flattens both
// before handing a row to the Query List drawer.
await pm.queryManagementPage.stubRunningQueries('_meta', [
{
trace_id: 'qm-tooltip-trace-1',
status: 'processing',
user_id: 'root@example.com',
org_id: 'default',
user_id: 'tooltip.user@example.com',
org_id: '_meta',
stream_type: 'logs',
search_type: 'ui',
query_source: 'ui',
sql: LONG_SQL,
start_time: 1700000000000000,
end_time: 1700000600000000,
created_at: Date.now() * 1000,
records: 0,
files: 0,
// The All Queries tab filters by search type, and defaults to dashboards.
search_type: 'dashboards',
work_group: 'default',
created_at: now - 5000000,
started_at: now - 5000000,
query: { sql: LONG_SQL, start_time: now - 60000000, end_time: now },
scan_stats: { files: 1, records: 1, original_size: 1, compressed_size: 1 },
search_event_context: { folder_name: 'f', dashboard_name: 'd' },
},
]);
await pm.queryManagementPage.navigateToQueryManagement(process.env['ORGNAME'] || 'default');
await pm.queryManagementPage.navigateToRunningQueries('_meta');
await pm.queryManagementPage.selectQueryTypeTab('all');
await pm.queryManagementPage.openFirstQueryDetails();
const sqlCell = pm.queryManagementPage.sqlValueCell('SELECT col_0');