@@ -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 ( / P a g e \d + o f \d + / )
87- . isVisible ( )
88- . catch ( ( ) => false ) ;
89- }
90-
91- async getCurrentPageNumber ( ) : Promise < number > {
92- const paginationText = await this . page . getByText ( / P a g e \d + o f \d + / ) . textContent ( ) ;
93- if ( ! paginationText ) return 1 ;
94- const match = paginationText . match ( / P a g e ( \d + ) o f \d + / ) ;
95- return match ? Number . parseInt ( match [ 1 ] ) : 1 ;
96- }
97-
98- async getTotalPageCount ( ) : Promise < number > {
99- const paginationText = await this . page . getByText ( / P a g e \d + o f \d + / ) . textContent ( ) ;
100- if ( ! paginationText ) return 1 ;
101- const match = paginationText . match ( / P a g e \d + o f ( \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