diff --git a/client/cypress/e2e/analysis/filters-map.cy.ts b/client/cypress/e2e/analysis/filters-map.cy.ts index 0873fff80..51ef44e25 100644 --- a/client/cypress/e2e/analysis/filters-map.cy.ts +++ b/client/cypress/e2e/analysis/filters-map.cy.ts @@ -1,8 +1,15 @@ describe('Analysis filters', () => { beforeEach(() => { - cy.intercept('GET', '/api/v1/indicators?sort=name').as('fetchIndicators'); - cy.intercept('GET', '/api/v1/indicators?filter[status]=active').as('fetchActiveIndicators'); - cy.intercept('GET', '/api/v1/h3/years*').as('fetchYears'); + cy.intercept('GET', '/api/v1/indicators?sort=name', { + fixture: 'indicators/index', + }).as('fetchIndicators'); + cy.intercept('GET', '/api/v1/indicators?filter[status]=active', { + fixture: 'indicators/index', + }).as('fetchActiveIndicators'); + cy.intercept('GET', '/api/v1/h3/years*', { + statusCode: 200, + fixture: 'years/index', + }).as('fetchYears'); cy.intercept('GET', '/api/v1/materials/trees*').as('fetchMaterialsTrees'); cy.intercept('GET', '/api/v1/admin-regions/trees*').as('fetchOriginsTrees'); cy.intercept('GET', '/api/v1/suppliers/types?type=t1supplier').as('fetchT1Suppliers'); @@ -22,6 +29,7 @@ describe('Analysis filters', () => { // Indicators it('not to filter by a disabled indicator', () => { cy.intercept('GET', '/api/v1/indicators*', { + statusCode: 200, fixture: 'indicators/index', }).as('fetchIndicators'); @@ -42,6 +50,11 @@ describe('Analysis filters', () => { }); it('filter by an active indicator', () => { + cy.intercept('GET', '/api/v1/indicators*', { + statusCode: 200, + fixture: 'indicators/index', + }).as('fetchIndicators'); + cy.wait('@fetchIndicators').then((interception) => { const activeIndicators = interception.response.body?.data.filter( ({ attributes }) => attributes.status === 'active', diff --git a/client/cypress/e2e/analysis/filters-table.cy.ts b/client/cypress/e2e/analysis/filters-table.cy.ts index 37b527dec..4fb423f95 100644 --- a/client/cypress/e2e/analysis/filters-table.cy.ts +++ b/client/cypress/e2e/analysis/filters-table.cy.ts @@ -2,7 +2,10 @@ describe('Analysis filters', () => { beforeEach(() => { cy.intercept('GET', '/api/v1/indicators?sort=name').as('fetchIndicators'); cy.intercept('GET', '/api/v1/indicators?filter[status]=active').as('fetchActiveIndicators'); - cy.intercept('GET', '/api/v1/h3/years*').as('fetchYears'); + cy.intercept('GET', '/api/v1/h3/years*', { + statusCode: 200, + fixture: 'years/index', + }).as('fetchYears'); cy.intercept('GET', '/api/v1/materials/trees*').as('fetchMaterialsTrees'); cy.login(); @@ -44,6 +47,10 @@ describe('Analysis filters', () => { }); it('filter by an active indicator', () => { + cy.intercept('GET', '/api/v1/indicators*', { + fixture: 'indicators/index', + }).as('fetchIndicators'); + cy.wait('@fetchIndicators').then((interception) => { const firstActiveIndicator = interception.response.body?.data.find( ({ attributes }) => attributes.status === 'active',