All of first column has value "GOL"
To extract column 1 elements only, use cy.get('tr td:nth-child(1)')
To map to the text inside, this is a useful recipe Getting Text from List of Elements
const getTexts = (els) => Cypress._.map(els, 'innerText')
cy.get('tr td:nth-child(1)')
.then(getTexts)
.should('deep.equal', ['GOL', 'GOL', 'GOL'])
If the rows are dynamic, use .every()
cy.get('tr td:nth-child(1)')
.then(getTexts)
.should(vals => {
const allFirstColHasGol = vals.every(val => val === 'GOL')
assert(allFirstColHasGol, 'All first column has value "GOL"'))
})
First date is the latest
I recommend the dayjs library to handle dates
const dayjs = require('dayjs')
const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(customParseFormat)
const getTexts = (els) => Cypress._.map(els, 'innerText')
const toDate = (els) => Cypress._.map(els, el => dayjs(el, 'MM-DD-YYYY').$d)
cy.get('tr td:nth-child(4)')
.then(getTexts)
.then(toDate)
.should(dates => {
const firstDateIsLateset = dates.slice(1).every(date => dates[0] > date)
assert(firstDateIsLateset, 'First date is the largest'))
})
TDD with the following, and change column values to make it pass/fail
<table>
<tbody>
<tr>
<td><a>GOL</a></td>
<td><span>06-02-2023</span></td>
</tr>
<tr>
<td><a>GOL</a></td>
<td><span>06-01-2023</span></td>
</tr>
</tbody>
</table>