Skip to content

Commit 3b49d7c

Browse files
committed
wait for all quotas to load (without pagination)
1 parent 93c2ef1 commit 3b49d7c

File tree

2 files changed

+11
-98
lines changed

2 files changed

+11
-98
lines changed

frontend/tests/test-variant-console/quotas/pagination.spec.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@ test.describe('Quotas - Display 50 quotas', () => {
2828
});
2929

3030
await test.step(`Verify all ${QUOTAS_TEST_LIMIT} quotas are visible on the page`, async () => {
31-
// Count rows containing our test quota IDs
31+
// Wait for all quotas to load (app loads in batches)
32+
// Use toPass() to retry until all batches have loaded
33+
await expect(async () => {
34+
const visibleQuotaCount = await page
35+
.locator('tr')
36+
.filter({ hasText: `quota-test-${timestamp}` })
37+
.count();
38+
expect(visibleQuotaCount).toBe(QUOTAS_TEST_LIMIT);
39+
}).toPass({ timeout: 15_000, intervals: [500, 1000] });
40+
41+
// Final verification - count should now be stable at 50
3242
const visibleQuotaCount = await page
3343
.locator('tr')
3444
.filter({ hasText: `quota-test-${timestamp}` })

frontend/tests/test-variant-console/utils/quota-page.ts

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ export class QuotaPage {
2727
await expect(this.page.getByText(entityName)).not.toBeVisible();
2828
}
2929

30-
async verifyEntityType(entityType: 'client-id' | 'user' | 'ip') {
31-
const cells = await this.page.locator('td').allTextContents();
32-
expect(cells).toContain(entityType);
33-
}
34-
3530
async verifyProducerRate(rateValue: string, entityName?: string) {
3631
if (entityName) {
3732
// Find the row containing the entity name and verify the rate value is in that row
@@ -51,15 +46,6 @@ export class QuotaPage {
5146
}
5247
}
5348

54-
async verifyControllerMutationRate(rateValue: string, entityName?: string) {
55-
if (entityName) {
56-
const row = this.page.locator('tr').filter({ hasText: entityName });
57-
await expect(row.locator('td').filter({ hasText: rateValue })).toBeVisible();
58-
} else {
59-
await expect(this.page.getByText(rateValue)).toBeVisible();
60-
}
61-
}
62-
6349
/**
6450
* Check if a specific entity name appears in the table
6551
*/
@@ -77,87 +63,4 @@ export class QuotaPage {
7763
await this.page.goto(`${baseURL}/quotas`);
7864
await expect(this.page.getByRole('heading', { name: 'Quotas' })).toBeVisible();
7965
}
80-
81-
/**
82-
* Pagination methods
83-
*/
84-
async hasPagination(): Promise<boolean> {
85-
return this.page
86-
.getByText(/Page \d+ of \d+/)
87-
.isVisible()
88-
.catch(() => false);
89-
}
90-
91-
async getCurrentPageNumber(): Promise<number> {
92-
const paginationText = await this.page.getByText(/Page \d+ of \d+/).textContent();
93-
if (!paginationText) return 1;
94-
const match = paginationText.match(/Page (\d+) of \d+/);
95-
return match ? Number.parseInt(match[1]) : 1;
96-
}
97-
98-
async getTotalPageCount(): Promise<number> {
99-
const paginationText = await this.page.getByText(/Page \d+ of \d+/).textContent();
100-
if (!paginationText) return 1;
101-
const match = paginationText.match(/Page \d+ of (\d+)/);
102-
return match ? Number.parseInt(match[1]) : 1;
103-
}
104-
105-
async goToNextPage() {
106-
await this.page.getByRole('button', { name: 'Go to next page' }).click();
107-
await this.page.waitForTimeout(300); // Brief wait for table to update
108-
}
109-
110-
async goToPreviousPage() {
111-
await this.page.getByRole('button', { name: 'Go to previous page' }).click();
112-
await this.page.waitForTimeout(300);
113-
}
114-
115-
async goToFirstPage() {
116-
await this.page.getByRole('button', { name: 'Go to first page' }).click();
117-
await this.page.waitForTimeout(300);
118-
}
119-
120-
async goToLastPage() {
121-
await this.page.getByRole('button', { name: 'Go to last page' }).click();
122-
await this.page.waitForTimeout(300);
123-
}
124-
125-
async setRowsPerPage(rows: 10 | 20 | 25 | 30 | 40 | 50) {
126-
const selectTrigger = this.page.locator('button[role="combobox"]').filter({ hasText: /\d+/ });
127-
await selectTrigger.click();
128-
await this.page.getByRole('option', { name: rows.toString() }).click();
129-
await this.page.waitForTimeout(300);
130-
}
131-
132-
async countQuotasOnCurrentPage(filterText?: string): Promise<number> {
133-
const locator = filterText
134-
? this.page.locator('tr').filter({ hasText: filterText })
135-
: this.page.locator('tbody tr');
136-
return locator.count();
137-
}
138-
139-
async countQuotasAcrossAllPages(filterText?: string): Promise<number> {
140-
const hasPagination = await this.hasPagination();
141-
142-
if (!hasPagination) {
143-
return this.countQuotasOnCurrentPage(filterText);
144-
}
145-
146-
const totalPages = await this.getTotalPageCount();
147-
let totalCount = 0;
148-
149-
// Go to first page
150-
await this.goToFirstPage();
151-
152-
for (let i = 1; i <= totalPages; i++) {
153-
const count = await this.countQuotasOnCurrentPage(filterText);
154-
totalCount += count;
155-
156-
if (i < totalPages) {
157-
await this.goToNextPage();
158-
}
159-
}
160-
161-
return totalCount;
162-
}
16366
}

0 commit comments

Comments
 (0)