A few tests i am writing requires me to check first if i am logged in to the service, and unfortunately when i am not, it won’t send me a proper formated JSON response, but rather 500 Internal Server Error. Since this error code is used for so much, i need to check if a specific string is in the HTML.
I have been trying so many different things, and all i really want is to check if a h2 header has certain words in it, to confirm.
I got really confused about the syntax of cheerio here, and it would always return me a null, so i tried to just convert the response body to text and see if i could get anywhere there, but that did not work either.
Would anyone be so kind to point me in the direction of just searching the whole response body for a string? It is so easy on tests, but that functionality is not in pre-request scripts…