@@ -118,6 +118,7 @@ export async function testTab(
118118) : Promise < void > {
119119 // Run the "Expect each tab to become selected, to go to the correct url, and to show all of its columns when selected" test
120120 await page . goto ( startTab . url ) ;
121+ await page . getByTestId ( TEST_IDS . TABLE_FIRST_CELL ) . waitFor ( ) ;
121122 await expect ( getFirstRowNthColumnCellLocator ( page , 1 ) ) . toBeVisible ( ) ;
122123 await getTabByText ( page , endTab . tabName ) . click ( ) ;
123124 await expect ( page ) . toHaveURL ( endTab . url ) ;
@@ -183,13 +184,12 @@ export async function testSortAzul(
183184 }
184185 if ( columnObject ?. sortable ) {
185186 // Locator that can be clicked to sort the column
186- const columnSortLocator = page . getByRole ( "button" , {
187- exact : true ,
188- name : columnObject . name ,
189- } ) ;
187+ const columnSortLocator = page
188+ . locator ( MUI_CLASSES . TABLE_SORT_LABEL )
189+ . filter ( { hasText : columnObject . name } ) ;
190190 // Locator for the column sort icon
191191 const sortIconLocator = columnSortLocator . locator (
192- ".MuiTableSortLabel-icon"
192+ MUI_CLASSES . TABLE_SORT_LABEL_ICON
193193 ) ;
194194 // If on the first cell, expect the sort icon to be visible. Otherwise, expect it not to be
195195 if ( columnPosition === 0 ) {
@@ -1245,9 +1245,7 @@ export async function testPaginationContent(
12451245 * @returns - a Playwright locator object for the tab with the specified text.
12461246 */
12471247export const getTabByText = ( page : Page , tabText : string ) : Locator => {
1248- return page . locator ( "[role='tab']" , {
1249- has : page . locator ( `text="${ tabText } "` ) ,
1250- } ) ;
1248+ return page . locator ( "[role='tab']" ) . filter ( { hasText : tabText } ) ;
12511249} ;
12521250
12531251/* eslint-enable sonarjs/no-duplicate-string -- Checking duplicate strings again*/
0 commit comments