Using a Playwright/Javascript framework, I am trying to validate a specific element “Draft project brief” card IS PRESENT within the specific “To Do” column.
“Draft” card should be present in “To do” column
Here is the DOM file with the “Draft” card highlighted.
“Draft” card HTML
Another look at the DOM file showing the “To Do” column highlighted.
“To Do” column with “Draft” card nested
First, I tried .toContain(), but it looks like it is comparing the two elements against each other and not asserting if the draftCard element is present within toDoColumn.
tried .toContain()
Second, I tried .not.toBeNull(), and test is passing, but when I intentionally switch the wrong column (“Done”) to be sure, it is still passing. So that tells me this method is not accurately checking if the card is in the correct column.
tried not.toBeNull()
Third, I tried this method I had seen on an online forum, but it was also giving me a false positive. It would pass when I put the correct column, and it was also pass when I put the incorrect column.
tried .locator()
Lastly, I tried .toHaveAttribute(), but this seems to only check the exact given top div element, and does not check the child elements of the div.
tried .toHaveAttribute()
I am a bit new to Playwright/Javascript so any advice would be much appreciated!!
marsknows is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.