Can someone please assist me with two issues I am facing:
1) Firstly, I am trying to match the text of an alert pop-up using the following code:
<div class="noty_message message"><span class="noty_text">Uh oh! Email or password is incorrect</span></div>
My current code is as follows:
var loginAlert = element(by.className('noty_text'));
expect(loginAlert.getAttribute('text')).toEqual("Uh oh! Email or password is incorrect")
However, I keep getting an error message saying: Expected null to equal 'Uh oh! Email or password is incorrect'.
Initially, I also attempted to find the text using getText()
2) The second issue involves a missing space in the text, but I am unsure how to fix it correctly. Here is the example:
<span class="tooltip-text">Uh oh! This<br>isn’t an email</span>
My code for solving this problem looks like this:
var newInvalidEmail = invalidEmail.getText().then(function (text) {
expect(text.replace(/\n/, '')).toBe("Uh oh! This isn't an email");
});
expect(newInvalidEmail).toEqual("Uh oh! This isn't an email")
The error message received is: Expected 'Uh oh! Thisisn’t an email' to be 'Uh oh! This isn't an email'.