Need help with accessing and verifying data from specific cells in a table.
The table consists of 10 rows and each row has 13 cells. I want to extract values and perform assertions only on cells 1, 2, 3, and 5.
Below is the snippet of code I am using:
let rows = element.all(by.tagName('tr'));
let data = rows.map((row) => {
let cells = row.all(by.tagName('td'));
return {
position: cells.get(1).getText(),
category: cells.get(2).getText(),
value: cells.get(3).getText(),
points: cells.get(5).getText()
}
})
expect(data).to.deep.equal([
{position: "1", category: "test1", value: "11", points: "3"},
{position: "2", category: "test2", value: "12", points: "5"},
{position: "3", category: "test3", value: "13", points: "3"},
{position: "4", category: "test4", value: "14", points: "5"},
{position: "5", category: "test5", value: "15", points: "3"},
{position: "6", category: "test6", value: "16", points: "5"},
{position: "7", category: "test7", value: "17", points: "3"},
{position: "8", category: "test8", value: "18", points: "5"},
{position: "9", category: "test9", value: "19", points: "3"},
{position: "10", category: "test10", value: "20", points: "5"}
]);
Seeking assistance on resolving an error message that says:
AssertionError: expected { Object (flow_, stack_, ...) } to deeply equal [ Array(10) ]