new coderrrr
new coderrrr

Reputation: 25

Wanted to simulate an API or network error to display the error modal in testcafe

test('should amount field and name field reset after submit', async ()=>{
 
 const amountInput = await Selector('.amount');
 await t.typeText(input, 10);

 const nameInput = await Selector('.name');
 await t.typeText(input, "test");

 await t.click(Selector('button'));

 await t.click(Selector('transfer'));

 after calling api...

 showing error modal
})

I am using TestCafe for automation testing. After clicking on the transfer button, I want to simulate an API or network error to display the error modal. Then, will close the modal to verify that the input values are not reset.

Upvotes: 0

Views: 24

Answers (0)

Related Questions