You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 6, 2025. It is now read-only.
test.only(`Default page Group codes table `,async({
page, screen, within
})=>{consttable=awaitscreen.queryByTestId('nested-table-GroupCode')consttableHeader=within(table).getAllByRole('columnheader')expect(awaittableHeader.nth(0).textContent()).toEqual("Active")expect(awaittableHeader.nth(1).textContent()).toEqual("Code")expect(awaittableHeader.nth(2).textContent()).toEqual("Description")//using playwright locator to find the total no of rows /<tbody> </tbody> tag returns 1 when there are no rows.lettotal;total=awaitpage.locator('table[data-testid=nested-table-GroupCode] tbody').count();console.log("total"+total).// letting the loop run only if total is not equal to 1if(total!=1){constrowgroup=within(table).getAllByRole('rowgroup')lettotalRows=awaitwithin(rowgroup.nth(1)).getAllByRole('row')console.log("total Rows"+totalRows)letnoOfRows=awaitwithin(rowgroup.nth(1)).getAllByRole('row').count().--->Thislineisfailingwhentherearenorows,ascountreturnsnothing.console.log("No of Rows "+noOfRows);for(leti=0;i<noOfRows;i++){letcellValues=awaitwithin(totalRows.nth(i)).getAllByRole('cell')letnoOfCells=awaitwithin(totalRows.nth(i)).getAllByRole('cell').count()console.log("No of cells "+noOfCells);for(letj=0;j<noOfCells;j++){awaitexpect(cellValues.nth(j)).not.toBeNull();console.log("cellValue: "+awaitcellValues.nth(j).textContent());}}}});
here is the code:
is there a direct way to verify using playwright testing library to verify if the table has no rows other than table header?