I have an array and I want to display it item by item to check an amount. The moment I give console.log to the array it shows me the elements and when I try to display it as an index it gives me undefined.
let localFinishPrice = []
cy.get(':nth-child(1) > :nth-child(2) > .bold').invoke("text").then((text)=>{
let localPrice = parseFloat(text.substring(1))
localFinishPrice.push(localPrice)
})
cy.get('#totals_table > tbody > :nth-child(2) > :nth-child(2)').invoke("text").then((text)=>{
let localPrice = parseFloat(text.substring(1))
localFinishPrice.push(localPrice)
})
cy.get(':nth-child(3) > :nth-child(2) > .bold').invoke("text").then((text) => {
let localPrice = parseFloat(text.substring(1))
localFinishPrice.push(localPrice)
})
if(localFinishPrice[0] + localFinishPrice[1] == localFinishPrice[2])
cy.log("Finish price is ok")
else
cy.log("Finish price isn't ok")