The client app under testing generates UUIDs for certain ID fields, hence the POST requests to the API are not predictable.
I could compare property by property and just skip those ID fields, but this is quite cumbersome as the request bodies will become quite complex. So my idea was to place the IDs from the request body into the expected value, but I couldn't find a way. So I need to refer to the request body in the "should" function below to have something like 'id: requestBody.id' where the placeholder << UUID >> is.
cy.route('POST', '/property').as('post-property');
cy.wait('@post-property')
.its('requestBody')
.should('deep.equal', {
id: << UUID >>,
name: 'Test Property',
nr: 'P01',
property_type_id: 1001,
address: {
id: << UUID >>,
address_type_id: 1000,
street: 'Musterstrasse',
street_nr: '27',
zip: '8000'
},
});