let say I have this setting.json
{ data: { isDark: false } }
and I intercept it like so
cy.intercept("api/setting", {
fixture: `setting.json`,
})
it worked.
But there's no way I want to create one file for one new property in the setting.json or when isDark is true. So how can I change the property values of the setting.json in my test?
I tried
cy.intercept("api/setting", (req) => {
const settingFixture = await cy.fixture('setting.json')
req.continue((res) => {
res.send(settingFixture.map((object)=>({...object, isDark: true}))
})
cy.visit('some where')
})
but it doesn't work.