I have written a test case which contains multiple scope. Now, one of the test cases might be failed if text is not correct or wrong value or for waiting time. Normally it shows fail if those situation occurs. But I want to handle those errors so that user can get a message instead of error. I have tried in the following way. But it not catching any error. It always goes to then block. I have written a wrong message in expectation, so that I can get catch, but nothing working properly.
Here is my code
Modified Code
it('save button is clicked and Save notification is appeared', async () => {
await click.onto(ContentPage.saveEdit);
// I want to wait here
ContentPage.saveNotification.isPresent().then(async function() {
await expect(ContentPage.saveNotification.getText()).toContain('0030565002C0 Updated.')
}).catch(function (err) {
console.log(err)
});
});
jasmine provide an optional message for any expectation