@@ -34,13 +34,13 @@ test.describe('Operations Tab - Infinite Query', () => {
3434 await diagnostics . operations . waitForTableVisible ( ) ;
3535 await diagnostics . operations . waitForDataLoad ( ) ;
3636
37- // Wait a bit for the counter to stabilize after initial load
37+ // Wait a bit for the table to stabilize after initial load
3838 await page . waitForTimeout ( 1000 ) ;
3939
40- // Verify initial page loaded (should show count in badge )
41- const operationsCount = await diagnostics . operations . getOperationsCount ( ) ;
42- expect ( operationsCount ) . toBeGreaterThan ( 0 ) ;
43- expect ( operationsCount ) . toBeLessThanOrEqual ( 20 ) ; // Should have up to DEFAULT_PAGE_SIZE operations loaded initially
40+ // Verify initial page loaded (should have up to DEFAULT_PAGE_SIZE operations )
41+ const rowCount = await diagnostics . operations . getRowCount ( ) ;
42+ expect ( rowCount ) . toBeGreaterThan ( 0 ) ;
43+ expect ( rowCount ) . toBeLessThanOrEqual ( 20 ) ; // Should have up to DEFAULT_PAGE_SIZE operations loaded initially
4444
4545 // Verify first row data structure
4646 const firstRowData = await diagnostics . operations . getRowData ( 0 ) ;
@@ -78,32 +78,32 @@ test.describe('Operations Tab - Infinite Query', () => {
7878 await diagnostics . operations . waitForTableVisible ( ) ;
7979 await diagnostics . operations . waitForDataLoad ( ) ;
8080
81- // Get initial operations count
82- const initialOperationsCount = await diagnostics . operations . getOperationsCount ( ) ;
83- expect ( initialOperationsCount ) . toBeGreaterThan ( 0 ) ;
81+ // Get initial row count
82+ const initialRowCount = await diagnostics . operations . getRowCount ( ) ;
83+ expect ( initialRowCount ) . toBeGreaterThan ( 0 ) ;
8484
8585 // Scroll to bottom
8686 await diagnostics . operations . scrollToBottom ( ) ;
8787
88- // Wait for operations count to potentially change
89- let finalOperationsCount : number ;
88+ // Wait for row count to potentially change
89+ let finalRowCount : number ;
9090 try {
91- finalOperationsCount = await diagnostics . operations . waitForOperationsCountToChange (
92- initialOperationsCount ,
91+ finalRowCount = await diagnostics . operations . waitForRowCountToChange (
92+ initialRowCount ,
9393 3000 ,
9494 ) ;
9595 } catch ( _e ) {
9696 // If timeout, the count didn't change
97- finalOperationsCount = await diagnostics . operations . getOperationsCount ( ) ;
97+ finalRowCount = await diagnostics . operations . getRowCount ( ) ;
9898 }
9999
100100 // Check if more operations were loaded
101- if ( finalOperationsCount > initialOperationsCount ) {
101+ if ( finalRowCount > initialRowCount ) {
102102 // Infinite scroll worked - more operations were loaded
103- expect ( finalOperationsCount ) . toBeGreaterThan ( initialOperationsCount ) ;
103+ expect ( finalRowCount ) . toBeGreaterThan ( initialRowCount ) ;
104104 } else {
105- // No more data to load - operations count should stay the same
106- expect ( finalOperationsCount ) . toBe ( initialOperationsCount ) ;
105+ // No more data to load - row count should stay the same
106+ expect ( finalRowCount ) . toBe ( initialRowCount ) ;
107107 }
108108 } ) ;
109109
@@ -222,16 +222,12 @@ test.describe('Operations Tab - Infinite Query', () => {
222222 const rowCount = await diagnostics . operations . getRowCount ( ) ;
223223 expect ( rowCount ) . toBeLessThanOrEqual ( 1 ) ;
224224
225- // Verify operations count is 0
226- const operationsCount = await diagnostics . operations . getOperationsCount ( ) ;
227- expect ( operationsCount ) . toBe ( 0 ) ;
228-
229225 // Wait to ensure no infinite refetching occurs
230226 await page . waitForTimeout ( 3000 ) ;
231227
232- // Verify the count is still 0 (no infinite refetching)
233- const finalOperationsCount = await diagnostics . operations . getOperationsCount ( ) ;
234- expect ( finalOperationsCount ) . toBe ( 0 ) ;
228+ // Verify the count is still the same (no infinite refetching)
229+ const finalRowCount = await diagnostics . operations . getRowCount ( ) ;
230+ expect ( finalRowCount ) . toBe ( rowCount ) ;
235231 } ) ;
236232
237233 test ( 'stops pagination when receiving malformed response after valid data' , async ( { page} ) => {
@@ -254,9 +250,10 @@ test.describe('Operations Tab - Infinite Query', () => {
254250 await diagnostics . operations . waitForTableVisible ( ) ;
255251 await diagnostics . operations . waitForDataLoad ( ) ;
256252
257- // Verify initial page loaded (should have 20 operations)
258- const initialOperationsCount = await diagnostics . operations . getOperationsCount ( ) ;
259- expect ( initialOperationsCount ) . toBe ( 20 ) ;
253+ // Verify initial page loaded (virtualized table may not show all 20 rows)
254+ const initialRowCount = await diagnostics . operations . getRowCount ( ) ;
255+ expect ( initialRowCount ) . toBeGreaterThan ( 0 ) ;
256+ expect ( initialRowCount ) . toBeLessThanOrEqual ( 20 ) ;
260257
261258 // Verify first row data
262259 const firstRowData = await diagnostics . operations . getRowData ( 0 ) ;
@@ -274,16 +271,18 @@ test.describe('Operations Tab - Infinite Query', () => {
274271 await diagnostics . operations . waitForLoadingMoreToDisappear ( ) ;
275272 }
276273
277- // Verify the count remains at 20 (malformed response didn't add more)
278- const finalOperationsCount = await diagnostics . operations . getOperationsCount ( ) ;
279- expect ( finalOperationsCount ) . toBe ( 20 ) ;
274+ // Verify the count didn't significantly increase (malformed response didn't add more)
275+ const finalRowCount = await diagnostics . operations . getRowCount ( ) ;
276+ // With virtualization, row count might vary slightly but shouldn't exceed initial data
277+ expect ( finalRowCount ) . toBeLessThanOrEqual ( 20 ) ;
280278
281279 // Wait to ensure no infinite refetching occurs
282280 await page . waitForTimeout ( 3000 ) ;
283281
284- // Verify the count is still 20
285- const stillFinalCount = await diagnostics . operations . getOperationsCount ( ) ;
286- expect ( stillFinalCount ) . toBe ( 20 ) ;
282+ // Verify the count remains stable (no infinite refetching)
283+ const stillFinalRowCount = await diagnostics . operations . getRowCount ( ) ;
284+ // Allow for minor virtualization differences
285+ expect ( Math . abs ( stillFinalRowCount - finalRowCount ) ) . toBeLessThanOrEqual ( 5 ) ;
287286 } ) ;
288287
289288 test ( 'loads all operations when scrolling to the bottom multiple times' , async ( { page} ) => {
@@ -306,21 +305,24 @@ test.describe('Operations Tab - Infinite Query', () => {
306305 await diagnostics . operations . waitForTableVisible ( ) ;
307306 await diagnostics . operations . waitForDataLoad ( ) ;
308307
309- // Wait a bit for the counter to stabilize after initial load
308+ // Wait a bit for the table to stabilize after initial load
310309 await page . waitForTimeout ( 2000 ) ;
311310
312- // Get initial operations count (should be around 20)
313- const initialOperationsCount = await diagnostics . operations . getOperationsCount ( ) ;
314- expect ( initialOperationsCount ) . toBeGreaterThan ( 0 ) ;
315- expect ( initialOperationsCount ) . toBeLessThanOrEqual ( 20 ) ;
311+ // Get initial row count (should be around 20)
312+ const initialRowCount = await diagnostics . operations . getRowCount ( ) ;
313+ expect ( initialRowCount ) . toBeGreaterThan ( 0 ) ;
314+ expect ( initialRowCount ) . toBeLessThanOrEqual ( 20 ) ;
316315
317316 // Keep scrolling until all operations are loaded
318- let previousOperationsCount = initialOperationsCount ;
319- let currentOperationsCount = initialOperationsCount ;
317+ let previousRowCount = initialRowCount ;
318+ let currentRowCount = initialRowCount ;
320319 const maxScrollAttempts = 10 ; // Safety limit to prevent infinite loop
321320 let scrollAttempts = 0 ;
322321
323- while ( currentOperationsCount < 80 && scrollAttempts < maxScrollAttempts ) {
322+ // Keep track of whether we're still loading more data
323+ let hasMoreData = true ;
324+
325+ while ( hasMoreData && scrollAttempts < maxScrollAttempts ) {
324326 // Scroll to bottom
325327 await diagnostics . operations . scrollToBottom ( ) ;
326328
@@ -333,28 +335,33 @@ test.describe('Operations Tab - Infinite Query', () => {
333335 await diagnostics . operations . waitForLoadingMoreToDisappear ( ) ;
334336 }
335337
336- // Wait for operations count to change or timeout
338+ // Wait for row count to change or timeout
337339 try {
338- currentOperationsCount =
339- await diagnostics . operations . waitForOperationsCountToChange (
340- previousOperationsCount ,
341- 3000 ,
342- ) ;
340+ currentRowCount = await diagnostics . operations . waitForRowCountToChange (
341+ previousRowCount ,
342+ 3000 ,
343+ ) ;
344+ // If row count changed, we still have more data
345+ hasMoreData = true ;
343346 } catch ( _e ) {
344347 // If timeout, the count didn't change - we might have reached the end
345- currentOperationsCount = await diagnostics . operations . getOperationsCount ( ) ;
348+ currentRowCount = await diagnostics . operations . getRowCount ( ) ;
349+ hasMoreData = false ;
346350 }
347351
348- previousOperationsCount = currentOperationsCount ;
352+ previousRowCount = currentRowCount ;
349353 scrollAttempts ++ ;
350354 }
351355
352- // Verify all 80 operations were loaded
353- expect ( currentOperationsCount ) . toBe ( 80 ) ;
356+ // With virtualization, we can't verify exact count via DOM
357+ // But we should have more rows than initially
358+ expect ( currentRowCount ) . toBeGreaterThan ( initialRowCount ) ;
354359
355360 const rowCount = await diagnostics . operations . getRowCount ( ) ;
356- // Verify the last operation has the expected ID pattern
357- const lastRowData = await diagnostics . operations . getRowData ( rowCount - 1 ) ;
358- expect ( lastRowData [ 'Operation ID' ] ) . toContain ( 'ydb://' ) ;
361+ // Verify we can read data from the last visible row
362+ if ( rowCount > 0 ) {
363+ const lastRowData = await diagnostics . operations . getRowData ( rowCount - 1 ) ;
364+ expect ( lastRowData [ 'Operation ID' ] ) . toContain ( 'ydb://' ) ;
365+ }
359366 } ) ;
360367} ) ;
0 commit comments