i tried to read price form webPage through cypress to convert $49.99 to 49.99 to be able to compare it with 40.00
with this code
cy.get('.s-item').find('.s-item__price').invoke('text')
.each(txt => txt.replace(/\$/g, '').then(parseFloat).should('be.gt', 40.00) // true
.and('be.lt',100.00 ) // true
and i get this error
cy.each() can only operate on an array like subject. Your subject was: $49.99
then i tried to remove each
cy.get('.s-item').find('.s-item__price').invoke('text')
.then(txt => txt.replace(/\$/g, '').then(parseFloat).should('be.gt', 40.00) // true
.and('be.lt',100.00 ) // true
and i get this error
txt.replace(...).then is not a function
how to solve it?