diff --git a/client/cypress/integration/frontend/instruments/instruments-page.spec.js b/client/cypress/integration/frontend/instruments/instruments-page.spec.js index 8bb11746..0e36b2a0 100644 --- a/client/cypress/integration/frontend/instruments/instruments-page.spec.js +++ b/client/cypress/integration/frontend/instruments/instruments-page.spec.js @@ -1,22 +1,50 @@ +const LANGUAGE_COMMUNICATION = 'LANGUAGE_COMMUNICATION'; +const LANGUAGE_COMMUNICATION_VALUE = 'Sprache & Kommunikation'; +const SOCIETY = 'SOCIETY'; +const SOCIETY_VALUE = 'Gesellschaft'; +const INTERDISCIPLINARY = 'INTERDISCIPLINARY'; +const INTERDISCIPLINARY_VALUE = 'Überfachliche Instrumente'; + describe('Instruments Page', () => { beforeEach(() => { cy.setup(); + + + const languageCategory = { + name: LANGUAGE_COMMUNICATION_VALUE, + id: LANGUAGE_COMMUNICATION, + foreground: '#000000', + background: '#00ffff', + }; + const societyCategory = { + name: SOCIETY_VALUE, + id: SOCIETY, + foreground: '#ffffff', + background: '#000fff', + }; + const ANALYSE = 'analyse'; + const ARGUMENTATION = 'argumentation'; + const ETHIK = 'ethik'; + const analyse = { name: 'Analyse', - category: 'LANGUAGE_COMMUNICATION', - type: 'analyse', + category: languageCategory, + type: ANALYSE, + id: ANALYSE }; const argumentation = { name: 'Argumentation', - category: 'LANGUAGE_COMMUNICATION', - type: 'argumentation', + category: languageCategory, + type: ARGUMENTATION, + id: ARGUMENTATION }; const ethik = { name: 'Ethik', - category: 'SOCIETY', - type: 'ethik', + category: societyCategory, + type: ETHIK, + id: ETHIK }; cy.mockGraphqlOps({ @@ -38,23 +66,40 @@ describe('Instruments Page', () => { type: ethik, title: 'Instrument: Ethik', slug: 'ethik', - } + }, ], }, - InstrumentTypesQuery: { - instrumentTypes: [ - analyse, - argumentation, + InstrumentCategoriesQuery: { + instrumentCategories: [ { - name: 'Beschreibung', - category: 'LANGUAGE_COMMUNICATION', - type: 'beschreibung', + name: 'Sprache & Kommunikation', + id: LANGUAGE_COMMUNICATION, + types: [ + analyse, + argumentation, + { + name: 'Beschreibung', + category: languageCategory, + type: 'beschreibung', + }, + ], }, - ethik, { - name: 'Identität und Sozialisation', - category: 'SOCIETY', - type: 'identitt-und-sozialisation', + name: SOCIETY_VALUE, + id: SOCIETY, + types: [ + ethik, + { + name: 'Identität und Sozialisation', + category: societyCategory, + type: 'identitt-und-sozialisation', + }, + ], + }, + { + name: INTERDISCIPLINARY_VALUE, + id: INTERDISCIPLINARY, + types: [], }, ], }, @@ -67,19 +112,19 @@ describe('Instruments Page', () => { cy.getByDataCy('instrument').should('have.length', 3); - cy.getByDataCy('filter-language-communication').click(); + cy.contains(LANGUAGE_COMMUNICATION_VALUE).click(); cy.getByDataCy('instrument').should('have.length', 2); - cy.getByDataCy('filter-society').click(); + cy.contains(SOCIETY_VALUE).click(); cy.getByDataCy('instrument').should('have.length', 1); - cy.getByDataCy('filter-interdisciplinary').click(); + cy.contains(INTERDISCIPLINARY_VALUE).click(); cy.getByDataCy('instrument').should('have.length', 0); - cy.getByDataCy('filter-analyse').click(); + cy.contains('Analyse').click(); cy.getByDataCy('instrument').should('have.length', 1); - cy.getByDataCy('filter-ethik').click(); + cy.contains('Ethik').click(); cy.getByDataCy('instrument').should('have.length', 1); cy.getByDataCy('filter-all-instruments').click(); diff --git a/client/src/components/instruments/FilterEntry.vue b/client/src/components/instruments/FilterEntry.vue index 1226bb46..4d3ef067 100644 --- a/client/src/components/instruments/FilterEntry.vue +++ b/client/src/components/instruments/FilterEntry.vue @@ -12,7 +12,6 @@