Testing the api response gives me an error because the replacement character with protractor

I ran into a problem using protractor testing.

I am comparing text in my web application with the API I am doing. When I get a response with Postman, the text is written with HTML objects as: ú(ú) ñ(ñ)and I process it with a function decodeHTMLEntities()to decode these objects. Everything is fine up to this point.

The problem occurs when I receive ñor ¿(not encoded). I call the API in my test, and these characters return as , so the test fails. For instance:

ApiObject = {Country: 'España'}
expect('España').toBe(ApiObject.Country)

gives: Expected 'España' to be 'Espa a'

This is not a file format error, because if I do console.log('España'), it works great.

+4
source share

Source: https://habr.com/ru/post/1693583/


All Articles