cy.intercept returns always uppercase body results; how to solve? I am using cy.intercept to get data from an API and compare it with the screen, so it is always returning uppercase values. With that said, my compare code is failing when using cy.get(element).should('contain', apiValue) because we have firstlettercapitalized on screen and uppercase on API.
cy.intercept('GET', '/api-customers/welcome').as('getAPIwelcome')
cy.wait(['@getAPIwelcome']).spread( (getAPI) => { validatePageContents(getAPI);
})
export const validatePageContents = (getAPIwelcome) => {
let custName = getAPIwelcome.response?.body.firstName
}
Thanks.
I have this code example and the value from the API when opening the request/response from postman for example has the value “Jonathan” for first name but the object custName has the value "JONATHAN".
I am just trying to understand the reason.