I just started using testcafe, so far I found the documentation helpful to do my test and automate my E2E.
I want to assert if a value exists in a td like this:
async checkBankAccount(accountNumber, currencyCode){
const formatedAccount = formatBankAccount(accountNumber, currencyCode);
console.log(formatedAccount);
await t
.expect(Selector('td').withText(formatedAccount).innerText).eql(formatBankAccount);
}
I am having the following error:
An assertion method is not specified.
I want to assert if it exists a td in my HTML that contains the text from formatedAccount.
Thanks
Use the exists property to check if an element is available.
async checkBankAccount(accountNumber, currencyCode){
const formatedAccount = formatBankAccount(accountNumber, currencyCode);
console.log(formatedAccount);
await t
.expect(Selector('td').withText(formatedAccount).exists).ok();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With