I'd like to test a form in Jasmine, using Karma. When I enter wrong credentials and click the button, a notification appears with the appropriate message. Unfortunately, in the iframe in karma doesn't show this div, so the next expect fails because the selector does not match any element.
it('Testing a form', function () {
browser().navigateTo('/index.html');
input('firstName').enter('Wrong');
input('lastName').enter('Wrong');
element(':button.btn').click();
expect(element('.msg h1').text()).toMatch('Wrong Credentials');
}
The error I'm getting is
Selector .msg h1 did not match any elements.
When I use sleep(10) or pause() in order to see the form after the click event, the message is not appeared, that's why the selector doesn't match any element. Any idea please? Thank you very much!