I think I'm missing the point here. The fixture can't be used outside a test but I want to use the 'it' function to test each fixture in a JSON file.
I'm not sure if I understand fixtures correctly or use them correctly at the moment. Here is my Cypress TypeScript code:
let row: string;
let stream: string;
cy.fixture('AllNotificationStates').then((notifications) => {
for (let notification in notifications) {
row = notifications[notification].rowId;
stream = notifications[notification].streamId;
it(`${row}`, () => {
cy.intercept('GET', '**/api/', (req) => {
req.reply((req) => {
req.statusCode = 200;
req.body = [notifications[notification]];
});
});
cy.visit('/notification/dashboard');
co.setTestId(row);
co.assertRowIDandStreamID(row, stream);
});
}
});