Skip to content

Commit 6d6cc2d

Browse files
committed
fix: test
1 parent ed82cd4 commit 6d6cc2d

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

tests/suites/tenant/diagnostics/Diagnostics.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,19 @@ export class Diagnostics {
325325
await this.refreshButton.click();
326326
}
327327

328+
async waitForTableDataWithRefresh(maxRetries = 10, refreshInterval = 1000): Promise<boolean> {
329+
for (let i = 0; i < maxRetries; i++) {
330+
await this.clickRefreshButton();
331+
await this.page.waitForTimeout(refreshInterval);
332+
333+
const rowCount = await this.table.getRowCount();
334+
if (rowCount > 0) {
335+
return true;
336+
}
337+
}
338+
return false;
339+
}
340+
328341
async setAutoRefresh(option: string): Promise<void> {
329342
await this.autoRefreshSelect.click();
330343
const optionLocator = this.autoRefreshSelect.locator(`text=${option}`);

tests/suites/tenant/diagnostics/tabs/queries.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from '../Diagnostics';
1515
import {setupTopQueriesMock} from '../mocks';
1616

17-
test.describe('Diagnostics Queries tab', async () => {
17+
test.describe.only('Diagnostics Queries tab', async () => {
1818
test('No runnning queries in Queries if no queries are running', async ({page}) => {
1919
const pageQueryParams = {
2020
schema: tenantName,
@@ -118,9 +118,6 @@ test.describe('Diagnostics Queries tab', async () => {
118118
await queryEditor.waitForStatus('Completed');
119119
}
120120

121-
// Wait for query statistics to be collected
122-
await page.waitForTimeout(2000);
123-
124121
// Now navigate to diagnostics to check the top queries
125122
const pageQueryParams = {
126123
schema: tenantName,
@@ -132,9 +129,9 @@ test.describe('Diagnostics Queries tab', async () => {
132129

133130
const diagnostics = new Diagnostics(page);
134131

135-
// Verify table has data
136-
await expect(diagnostics.table.isVisible()).resolves.toBe(true);
137-
await expect(diagnostics.table.getRowCount()).resolves.toBeGreaterThan(0);
132+
// Wait for data to appear with active refreshing
133+
const hasData = await diagnostics.waitForTableDataWithRefresh();
134+
expect(hasData).toBe(true);
138135

139136
// Verify first row has non-empty values for key columns (test first 4 columns)
140137
for (const column of QueryTopColumns.slice(0, 4)) {

0 commit comments

Comments
 (0)