Im trying to check the content of a span containing a calculated price like this:
let currentPrice = '';
cy.get('[data-cy="orgsub-price-span"]', { timeout: 2000 }).then(($ele) => {
currentPrice = $ele.text();
cy.log(`'Current Price : ${currentPrice}`);
});
currentPrint always comes out ''.
I can get a value in the browser console:
document.querySelector('[data-cy="orgsub-price-span"]').textContent;
and I can see the value in the Cypress console.
The angular html is like:
<span data-cy="orgsub-price-span" *ngIf="!calculating">
{{ (totalCharge - discount + totalTax) }}
</span>
Ive tried sprinkling cy.wait(x) herw and there but that doesn't help.
Anyone got a suggestion?
Thanks