@@ -179,4 +179,137 @@ test.describe('Diagnostics Queries tab', async () => {
179179 // Verify the view was updated back
180180 expect ( await diagnostics . getSelectedQueryPeriod ( ) ) . toBe ( QueryPeriod . PerHour ) ;
181181 } ) ;
182+
183+ test ( 'FixedHeightQuery maintains consistent height and proper scrolling behavior' , async ( {
184+ page,
185+ } ) => {
186+ const pageQueryParams = {
187+ schema : tenantName ,
188+ database : tenantName ,
189+ tenantPage : 'diagnostics' ,
190+ diagnosticsTab : 'topQueries' ,
191+ } ;
192+ const tenantPage = new TenantPage ( page ) ;
193+ await tenantPage . goto ( pageQueryParams ) ;
194+
195+ const diagnostics = new Diagnostics ( page ) ;
196+ await expect ( diagnostics . table . isVisible ( ) ) . resolves . toBe ( true ) ;
197+
198+ // Verify we have enough rows to test scrolling
199+ const rowCount = await diagnostics . table . getRowCount ( ) ;
200+ if ( rowCount > 5 ) {
201+ // Test scrolling behavior: click on a row that might not be fully visible
202+ const targetRowIndex = Math . min ( rowCount , 8 ) ; // Target a row further down
203+
204+ // Click on the target row to test scrolling
205+ await diagnostics . table . clickRow ( targetRowIndex ) ;
206+
207+ // Wait for any scrolling animation
208+ await page . waitForTimeout ( 500 ) ;
209+
210+ // Verify the row is now visible in the viewport
211+ const isVisible = await diagnostics . table . isRowVisible ( targetRowIndex ) ;
212+ expect ( isVisible ) . toBe ( true ) ;
213+ }
214+ } ) ;
215+
216+ test ( 'FixedHeightQuery components have consistent height across different query lengths' , async ( {
217+ page,
218+ } ) => {
219+ const pageQueryParams = {
220+ schema : tenantName ,
221+ database : tenantName ,
222+ tenantPage : 'diagnostics' ,
223+ diagnosticsTab : 'topQueries' ,
224+ } ;
225+ const tenantPage = new TenantPage ( page ) ;
226+ await tenantPage . goto ( pageQueryParams ) ;
227+
228+ const diagnostics = new Diagnostics ( page ) ;
229+ await expect ( diagnostics . table . isVisible ( ) ) . resolves . toBe ( true ) ;
230+
231+ // Check that FixedHeightQuery components have the expected fixed height
232+ const fixedHeightElements = page . locator ( '.ydb-fixed-height-query' ) ;
233+ const elementCount = await fixedHeightElements . count ( ) ;
234+
235+ if ( elementCount > 1 ) {
236+ // Check that all FixedHeightQuery components have the same height
237+ const heights = [ ] ;
238+ for ( let i = 0 ; i < Math . min ( elementCount , 5 ) ; i ++ ) {
239+ const element = fixedHeightElements . nth ( i ) ;
240+ const height = await element . evaluate ( ( el ) => {
241+ return window . getComputedStyle ( el ) . height ;
242+ } ) ;
243+ heights . push ( height ) ;
244+ }
245+
246+ // All heights should be the same (88px for 4 lines)
247+ const firstHeight = heights [ 0 ] ;
248+ expect ( firstHeight ) . toBe ( '88px' ) ;
249+
250+ for ( const height of heights ) {
251+ expect ( height ) . toBe ( firstHeight ) ;
252+ }
253+ }
254+ } ) ;
255+
256+ test . only ( 'Scroll to row, get shareable link, navigate to URL and verify row is scrolled into view' , async ( {
257+ page,
258+ } ) => {
259+ const pageQueryParams = {
260+ schema : tenantName ,
261+ database : tenantName ,
262+ tenantPage : 'diagnostics' ,
263+ diagnosticsTab : 'topQueries' ,
264+ } ;
265+ const tenantPage = new TenantPage ( page ) ;
266+ await tenantPage . goto ( pageQueryParams ) ;
267+
268+ const diagnostics = new Diagnostics ( page ) ;
269+ await expect ( diagnostics . table . isVisible ( ) ) . resolves . toBe ( true ) ;
270+
271+ // Get the number of rows and select a row that requires scrolling
272+ const rowCount = await diagnostics . table . getRowCount ( ) ;
273+ if ( rowCount > 5 ) {
274+ const targetRowIndex = Math . min ( rowCount , 8 ) ; // Target a row further down
275+
276+ // Click on the target row to open the drawer
277+ await diagnostics . table . clickRow ( targetRowIndex ) ;
278+
279+ // Wait for drawer to open
280+ await page . waitForTimeout ( 500 ) ;
281+
282+ // Find and click the copy link button in the drawer
283+ const copyLinkButton = page . locator ( '.ydb-copy-link-button__icon' ) . first ( ) ;
284+ await expect ( copyLinkButton ) . toBeVisible ( ) ;
285+ await copyLinkButton . click ( ) ;
286+
287+ // Get the copied URL from clipboard
288+ const clipboardText = await page . evaluate ( ( ) => navigator . clipboard . readText ( ) ) ;
289+ expect ( clipboardText ) . toBeTruthy ( ) ;
290+ expect ( clipboardText ) . toContain ( '/tenant' ) ;
291+
292+ // Navigate to the copied URL
293+ await page . goto ( clipboardText ) ;
294+ await page . waitForTimeout ( 1000 ) ;
295+
296+ // Verify the table is visible and the target row is scrolled into view
297+ await expect ( diagnostics . table . isVisible ( ) ) . resolves . toBe ( true ) ;
298+
299+ // Check that the target row is visible in the viewport
300+ const isRowVisible = await diagnostics . table . isRowVisible ( targetRowIndex ) ;
301+ expect ( isRowVisible ) . toBe ( true ) ;
302+
303+ // Verify the row is highlighted/selected (if applicable)
304+ const rowElement = page . locator ( `tr.data-table__row:nth-child(${ targetRowIndex } )` ) ;
305+ const hasActiveClass = await rowElement . evaluate ( ( el : HTMLElement ) => {
306+ return (
307+ el . classList . contains ( 'kv-top-queries__row_active' ) ||
308+ el . classList . contains ( 'active' ) ||
309+ el . getAttribute ( 'aria-selected' ) === 'true'
310+ ) ;
311+ } ) ;
312+ expect ( hasActiveClass ) . toBe ( true ) ;
313+ }
314+ } ) ;
182315} ) ;
0 commit comments