I would like to know if Cypress supports nested loops? In my case, I have a table where I need to iterate over each row (row is represented by the "data-automationid="DetailsRowFields"") and then over each cell.
Although I attempted to create a function that would extract it, I am unsure if it can be done.
export function getCellData() : Promise<Map<string, string>> {
return new Cypress.Promise((resolve) => {
const cellMap = new Map<string, string>();
cy.get('div[data-automationid="DetailsRowFields"]')
.each((rowElement) => {
rowElement.children()
.each((child) => {
const ariaIndex = child.attr('aria-colindex');
const cellData = child.text();
cellMap.set(ariaIndex, cellData);
});
})
.then(() => resolve(cellMap));
});
}
