diff --git a/client/cypress/integration/frontend/instruments-page.spec.js b/client/cypress/integration/frontend/instruments-page.spec.js index 66e15e2b..81362bb4 100644 --- a/client/cypress/integration/frontend/instruments-page.spec.js +++ b/client/cypress/integration/frontend/instruments-page.spec.js @@ -4,24 +4,85 @@ describe('Instruments Page', () => { }); it('opens the instruments page', () => { + const analyse = { + name: 'Analyse', + category: 'LANGUAGE_COMMUNICATION', + type: 'analyse', + }; + + const argumentation = { + name: 'Argumentation', + category: 'LANGUAGE_COMMUNICATION', + type: 'argumentation', + }; + + const ethik = { + name: 'Ethik', + category: 'SOCIETY', + type: 'ethik', + }; + cy.mockGraphqlOps({ operations: { MeQuery: {}, InstrumentsQuery: { instruments: [ - {}, - {} - ] - } - } + { + type: analyse, + title: 'Instrument: Analyse', + slug: 'analyse', + }, + { + type: argumentation, + title: 'Instrument: Argumentation', + slug: 'argumentation', + }, + { + type: ethik, + title: 'Instrument: Ethik', + slug: 'ethik', + } + ], + }, + InstrumentTypesQuery: { + instrumentTypes: [ + analyse, + argumentation, + { + name: 'Beschreibung', + category: 'LANGUAGE_COMMUNICATION', + type: 'beschreibung', + }, + ethik, + { + name: 'Identität und Sozialisation', + category: 'SOCIETY', + type: 'identitt-und-sozialisation', + }, + ], + }, + }, }); cy.visit('instruments/'); - cy.getByDataCy('filter-all-instruments').should('exist'); - cy.getByDataCy('filter-language-communication').should('exist'); - cy.getByDataCy('filter-society').should('exist'); - cy.getByDataCy('filter-interdisciplinary').should('exist'); - cy.getByDataCy('filter-analysis').should('exist'); - cy.getByDataCy('filter-ethics').should('exist'); + cy.getByDataCy('instrument').should('have.length', 3); + + cy.getByDataCy('filter-language-communication').click(); + cy.getByDataCy('instrument').should('have.length', 2); + + cy.getByDataCy('filter-society').click(); + cy.getByDataCy('instrument').should('have.length', 1); + + cy.getByDataCy('filter-interdisciplinary').click(); + cy.getByDataCy('instrument').should('have.length', 0); + + cy.getByDataCy('filter-analyse').click(); + cy.getByDataCy('instrument').should('have.length', 1); + + cy.getByDataCy('filter-ethik').click(); + cy.getByDataCy('instrument').should('have.length', 1); + + cy.getByDataCy('filter-all-instruments').click(); + cy.getByDataCy('instrument').should('have.length', 3); }); });