After making an API call, I have received an array response that includes the following information:
[
{
"IsDatalakeEnabled": true,
"RecoveryHr": {
"IsRecoveryHREnabled": false,
"RecoveryHeartRateInterval": 120,
"RecoveryHeartRateSessionTime": 300
}
}
]
My task is to extract each key:value pair and verify that they exist in another API call response body with the following structure:
...
"StudioAddress": null,
"StudioProfileLanguage": {
"LanguageName": "English",
"LanguageCode": "en"
},
"IsDiversityChannel": true,
"TotalDiversityRadios": 2,
"IsDatalakeEnabled": false,
"IsNetpulse": false,
"RecoveryHeartRateInterval": 120,
"RecoveryHeartRateSessionTime": 300,
"IsRecoveryHREnabled": false,
"StudioPhysicalLocationId": null,
"StudioLocation": null,
"IsIntroCapacityEnabled": false,
"Status": null,
"IsWeb": false,
"OrangeBook": null,
"IsFeReservationEnabled": true,
"TimeZone": "America/New_York",
"IsModifyMaxHr": false,
"IsRunRowEnabled": false,
"WeightMeasure": "LB",
...
I attempted to use cy.each(), but it treats the data as a single object:
{
"TotalDiversityRadios": "0",
"IsDatalakeEnabled": true
}
Any suggestions or hints on how to approach this would be greatly appreciated. Thank you!
I tried converting the response body object into an array using _.castArray(). I also experimented with Object.entries()
Update 01/14/2023 @adoff This is what my test code looks like:
validateStudioSettings() {
// Code provided for testing purposes...
}
While running this code in Cypress, I encountered an error: Cypress Error Console