@@ -535,21 +535,29 @@ def test_mixed_row_dimension_collapse_preserves_temporal_state(page_at_app: Page
535535 1 , timeout = 10000
536536 )
537537
538- us_total_row = container .locator ("tr" ).filter (has_text = "US Total" )
538+ us_total_row = container .locator (
539+ 'tr[data-testid="pivot-subtotal-row"]:visible'
540+ ).filter (has_text = "US Total" )
539541 expect (us_total_row ).to_have_count (1 , timeout = 5000 )
540542 us_group_toggle = us_total_row .get_by_test_id ("pivot-group-toggle-US" )
541- us_group_toggle .dispatch_event ("click" )
543+ us_group_toggle .evaluate (
544+ "el => { el.scrollIntoView({ block: 'center', inline: 'nearest' }); el.click(); }"
545+ )
542546 expect (us_group_toggle ).to_have_attribute ("aria-expanded" , "false" , timeout = 5000 )
543547 expect (container .get_by_text ("US Total" )).to_be_visible (timeout = 5000 )
544548 expect (container .get_by_test_id ("pivot-temporal-parent-row" )).to_have_count (
545549 0 , timeout = 5000
546550 )
547551
548- us_total_row = container .locator ("tr" ).filter (has_text = "US Total" )
552+ us_total_row = container .locator (
553+ 'tr[data-testid="pivot-subtotal-row"]:visible'
554+ ).filter (has_text = "US Total" )
549555 expect (us_total_row ).to_have_count (1 , timeout = 5000 )
550556 us_group_toggle = us_total_row .get_by_test_id ("pivot-group-toggle-US" )
551557 expect (us_group_toggle ).to_have_attribute ("aria-expanded" , "false" , timeout = 5000 )
552- us_group_toggle .dispatch_event ("click" )
558+ us_group_toggle .evaluate (
559+ "el => { el.scrollIntoView({ block: 'center', inline: 'nearest' }); el.click(); }"
560+ )
553561 expect (us_group_toggle ).to_have_attribute ("aria-expanded" , "true" , timeout = 5000 )
554562 expect (container .get_by_test_id ("pivot-temporal-parent-row" )).to_have_count (
555563 1 , timeout = 10000
@@ -1184,6 +1192,15 @@ def _drilldown_sort_button(panel, column_name: str):
11841192 )
11851193
11861194
1195+ def _drilldown_sort_header (panel , column_name : str ):
1196+ """Return the sortable header cell for a drilldown column."""
1197+ return (
1198+ panel .get_by_test_id ("drilldown-table" )
1199+ .locator ("th" )
1200+ .filter (has_text = column_name )
1201+ )
1202+
1203+
11871204def test_drilldown_client_pagination_shows_controls (page_at_app : Page ):
11881205 """Client-only: clicking a cell with >500 records shows pagination controls."""
11891206 page = page_at_app
@@ -1215,8 +1232,11 @@ def test_drilldown_client_sort_orders_full_result_before_pagination(page_at_app:
12151232 page = page_at_app
12161233 _ , panel = _open_drilldown_with_pagination (page , "test_pivot_drilldown_pagination" )
12171234
1235+ revenue_header = _drilldown_sort_header (panel , "Revenue" )
12181236 _drilldown_sort_button (panel , "Revenue" ).click ()
1237+ expect (revenue_header ).to_have_attribute ("aria-sort" , "ascending" , timeout = 5000 )
12191238 _drilldown_sort_button (panel , "Revenue" ).click ()
1239+ expect (revenue_header ).to_have_attribute ("aria-sort" , "descending" , timeout = 5000 )
12201240
12211241 # Fixture values for Alpha/2023 are 10..709 inclusive, so descending page 1
12221242 # starts at 709 and descending page 2 starts at 209 after the first 500 rows.
0 commit comments