You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the @nightwatch/apitesting plugin sometimes I will use deep equal (.eql) to save time comparing properties and values in a response object to my expectation. This works great when everything passes, but when there is a equality mismatch failure the console output returns something like
– Can do a partial booking update (310ms)
→ ✖ NightwatchAssertError
expected { firstname: 'Really', …(5) } to deeply equal { firstname: 'Really', …(5) } - expected "[object Object]" but got: "[object Object]" (1ms)
It would be great if instead of [object Object] there was a JSON.stringify done to output the actual contents so one could see what field(s) or value(s) caused the deep equal to fail (what the differences are)
Example test:
'Can do a partial booking update': async({
supertest,}: NightwatchBrowser)=>{awaitsupertest.request(baseUrl).patch(`/booking/${bookingId}`).set('Content-type','application/json').auth('admin','password123').accept('application/json').send({additionalneeds:
'Unreasonable demands',}).expect(200).then((response: any)=>{// This is the assertion I've setup to fail by modifying the additionalneeds field from the original record and asserting agains the original valuesexpect(response.body).eql(bookingData);});},
Suggested solution
Apply JSON.stringify or something similar to do a friendly print out of the object to allow people to see what the mismatch was or other functionality to help identify what is different when comparing objects.
Alternatives / Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Description
When using the @nightwatch/apitesting plugin sometimes I will use deep equal (
.eql
) to save time comparing properties and values in a response object to my expectation. This works great when everything passes, but when there is a equality mismatch failure the console output returns something likeIt would be great if instead of [object Object] there was a JSON.stringify done to output the actual contents so one could see what field(s) or value(s) caused the deep equal to fail (what the differences are)
Example test:
Suggested solution
Apply JSON.stringify or something similar to do a friendly print out of the object to allow people to see what the mismatch was or other functionality to help identify what is different when comparing objects.
Alternatives / Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: