In project I use node js 20.5.1, playwright 1.37. with cucumber 8.0.0. I want to add own customer message if expected method return me a failed. I thought I could do it like below:
expect(3),"My custom message").toBeLessThanOrEqual(2);
And in test result I should for that step Error: My custom message,
,but I only see
Error: expect(received).toBeLessThanOrEqual(expected)
Do you know how I could handled with that ? :) Thanks for any tips :)
It seems like your error refers to another line of code. Anyway, in order to add a custom message to expect statement you should use:
await expect(page.getByText('Name'), 'should be logged in').toBeVisible();
as you can see in their official documentation here
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