I need to sort partOfArray table I need to getText , upperToCase
when do outside function I got “partOfArray is not defined”
when doing te same inside function cannot read properties of undefinied (reading each)\
it('name sorting test', () => {
cy.visit(`${Cypress.env('res_URL')}/test`);
const array = cy.get('#CustomerDDL').children()
.then(function (array) {
console.log(array)
const shiftArray = array.map((function () { return this.label; }))
console.log(shiftArray)
const partOfArray = shiftArray.slice(1, 100)
})
.each(($option, index) => {
partOfArray.push(Cypress.$($option).text());
})
.then(() => {
const sortArray = partOfArray.sort();
expect(partOfArray).to.equal(sortArray);
})
})
})