We have an API that returns HTML and want to write tests to validate that the HTML being returned is valid. We are not trying to parse the HTML, just do a direct comparison. Based on similar tests we created for JSON responses, we hoped something like this would work
const body = pm.response.text();
pm.test("check text body", function() {
pm.expect(body).to.eql(
{
<html>
<body>
My expected text here...
</body>
</html>
}
);
});