Reputation: 355
I have a problem with .expect method which I cannot find a good solution for. In my test case after a certain step I am clicking on a button. This button-click opens a new page with the error text "Something went wrong". Now I would like to assert on that error text which has the selector body > app > main > div > error-page > div > h1
.
But every time this page is opened and the error is shown in the Console I get following error " AssertionError: object tested must be an array, an object, or a string, but undefined given"
I have tested .expect(errorMessage.value).eql('Something went wrong')
.
I have also tested with .expect(errorMessage.value).contains('Something went wrong')
I have also tested .expect(errorMessage.exists).ok()
and then "eql"
Any suggestions?
Upvotes: 3
Views: 876