@@ -34,16 +34,16 @@ def test_header_menu_sort_key_asc(page_at_app: Page):
3434 menu = page .get_by_test_id ("header-menu-Region" )
3535 expect (menu ).to_be_visible (timeout = 5000 )
3636
37- menu .get_by_test_id ("header-sort-key-asc" ).evaluate ("el => el.click()" )
38-
39- expect (container .get_by_test_id ("pivot-row-header" ).first ).to_have_text (
40- "East" , timeout = 10000
41- )
42-
43- row_headers = [
37+ row_headers_before = [
4438 h .inner_text () for h in container .get_by_test_id ("pivot-row-header" ).all ()
4539 ]
46- assert row_headers == sorted (row_headers ), f"Rows not sorted A->Z: { row_headers } "
40+ expected_headers = sorted (row_headers_before )
41+
42+ menu .get_by_test_id ("header-sort-key-asc" ).click (force = True )
43+
44+ expect (container .get_by_test_id ("pivot-row-header" )).to_have_text (
45+ expected_headers , timeout = 10000
46+ )
4747
4848
4949def test_header_menu_sort_key_desc (page_at_app : Page ):
@@ -59,21 +59,14 @@ def test_header_menu_sort_key_desc(page_at_app: Page):
5959 row_headers_before = [
6060 h .inner_text () for h in container .get_by_test_id ("pivot-row-header" ).all ()
6161 ]
62+ expected_headers = sorted (row_headers_before , reverse = True )
6263 sort_button = menu .get_by_test_id ("header-sort-key-desc" )
6364 sort_button .evaluate ("el => el.click()" )
6465
65- expect (container .get_by_test_id ("pivot-row-header" ). first ).to_have_text (
66- "West" , timeout = 10000
66+ expect (container .get_by_test_id ("pivot-row-header" )).to_have_text (
67+ expected_headers , timeout = 10000
6768 )
6869
69- row_headers = [
70- h .inner_text () for h in container .get_by_test_id ("pivot-row-header" ).all ()
71- ]
72- assert row_headers != row_headers_before
73- assert row_headers == sorted (
74- row_headers , reverse = True
75- ), f"Rows not sorted Z->A: { row_headers } "
76-
7770
7871def test_header_menu_sort_by_value (page_at_app : Page ):
7972 """Sorting by value via header menu reorders rows by aggregated measure."""
@@ -89,10 +82,14 @@ def test_header_menu_sort_by_value(page_at_app: Page):
8982 h .inner_text () for h in container .get_by_test_id ("pivot-row-header" ).all ()
9083 ]
9184 menu .get_by_test_id ("header-sort-value-desc" ).evaluate ("el => el.click()" )
85+ page .get_by_test_id ("header-sort-value-field" ).select_option ("Revenue" )
86+ page .get_by_test_id ("header-sort-col-key" ).select_option ("" )
9287
93- expect (container .get_by_test_id ("pivot-row-header" ).first ).to_have_text (
94- "South" , timeout = 10000
88+ expect (container .get_by_test_id ("pivot-row-header" )).to_have_text (
89+ ["South" , "North" , "West" , "East" ],
90+ timeout = 10000 ,
9591 )
92+
9693 row_headers_after = [
9794 h .inner_text () for h in container .get_by_test_id ("pivot-row-header" ).all ()
9895 ]
@@ -176,12 +173,12 @@ def test_header_menu_show_values_as_pct(page_at_app: Page):
176173
177174 trigger = container .get_by_test_id ("header-menu-trigger-Revenue" ).first
178175 expect (trigger ).to_be_visible (timeout = 5000 )
179- trigger .click ()
176+ trigger .click (force = True )
180177
181- display_group = container .get_by_test_id ("header-menu-display" )
178+ display_group = page .get_by_test_id ("header-menu-display" )
182179 expect (display_group ).to_be_visible (timeout = 5000 )
183180
184- container .get_by_test_id ("header-display-pct_of_total" ).click ()
181+ page .get_by_test_id ("header-display-pct_of_total" ).click (force = True )
185182
186183 cells = container .get_by_test_id ("pivot-data-cell" )
187184 expect (cells .first ).to_contain_text ("%" , timeout = 10000 )
0 commit comments