I am trying to write a test in Protractor without linking my test strongly to the specific page layout.
For example, with a typical login page, I would like to verify that if the credentials are incorrect, an error message appears.
The way my markup displays this error:
<div class="alert alert-danger">
<ul>
<li>Invalid username or password.</li>
</ul>
</div>
This unordered list may contain other errors, so I don’t want to make a statement in the list item itself. In any case, I can decide not to display the error in the form of a list and may want to show it in some other way.
I just want to claim that the page contains: Invalid username or password.
I would like to do something like:
expect(page.getContents()).to.contain('Invalid username or password.');
But of course this does not work.
- , Protractor, ?