I am working on an automation in Cypress that goes through all my invoices (on invoce portal) and if the amount on the invoice is greater than 0, I want to click on the "PAY" button and continue the payment flow. But there are cases when the amount is zero and the "PAY" button is not displayed, in this case I need to change the next flow and instead of cashing the invoice I need to delete it.
So I would like to find a way to include the condition in the test and so basically branch the test into two possible scenarios. The condition should look something like this:
- when "PAY" button exists -> invoice reimbursement flow
- when the "PAY" button does not exist or the displayed amount is 0 -> invoice deletion flow
Thank you for any advice