Where do I adjust to use an array? In the io_sample_callback? Please help

The data should be accessed in an async callback to be sure you see the correct values.

Some examples

cy.task(“generateJsonFromExcel”, …)
.then((user) =>
const dataList = [];

return dataList;
})
.then(() => {
cy.log(dataList)
cy.log(dataList[1])
cy.log(dataList.length)
})
or alias the result

cy.task(“generateJsonFromExcel”, …)
.then((user) =>
const dataList = [];

return dataList;
})
.as(‘dataList’)

cy.get(‘@dataList’).then(() => {
cy.log(dataList)
cy.log(dataList[1])
cy.log(dataList.length)
})

1 Like