@@ -76,4 +76,35 @@ test('Authentication example', async ({ page }) => {
76
76
await loginButton . click ( ) ;
77
77
78
78
await expect ( page . getByText ( 'You are logged in as admin' ) ) . toBeVisible ( ) ;
79
+ } ) ;
80
+
81
+ test ( 'table filtering and sorting' , async ( { page } ) => {
82
+ await page . goto ( BASE + '/documentation.sql?component=table#component' ) ;
83
+ await expect ( page . getByText ( 'Loading...' ) ) . not . toBeVisible ( ) ;
84
+
85
+ // Find the specific table section containing "Table" and "Chart"
86
+ const tableSection = page . locator ( '.table-responsive' , {
87
+ has : page . getByRole ( 'cell' , { name : 'Chart' } )
88
+ } ) ;
89
+
90
+ // Test search filtering
91
+ const searchInput = tableSection . getByPlaceholder ( 'Search…' ) ;
92
+ await searchInput . fill ( 'chart' ) ;
93
+ await expect ( tableSection . getByRole ( 'cell' , { name : 'Chart' } ) ) . toBeVisible ( ) ;
94
+ await expect ( tableSection . getByRole ( 'cell' , { name : 'Table' } ) ) . not . toBeVisible ( ) ;
95
+
96
+ // Clear search
97
+ await searchInput . clear ( ) ;
98
+
99
+ // Test sorting by name
100
+ await tableSection . getByRole ( 'button' , { name : 'name' } ) . click ( ) ;
101
+ let names = await tableSection . locator ( 'td.name' ) . allInnerTexts ( ) ;
102
+ const sortedNames = [ ...names ] . sort ( ) ;
103
+ expect ( names ) . toEqual ( sortedNames ) ;
104
+
105
+ // Test reverse sorting
106
+ await tableSection . getByRole ( 'button' , { name : 'name' } ) . click ( ) ;
107
+ names = await tableSection . locator ( 'td.name' ) . allInnerTexts ( ) ;
108
+ const reverseSortedNames = [ ...names ] . sort ( ) . reverse ( ) ;
109
+ expect ( names ) . toEqual ( reverseSortedNames ) ;
79
110
} ) ;
0 commit comments