diff --git a/client/cypress/integration/frontend/instruments/instruments-page.spec.js b/client/cypress/integration/frontend/instruments/instruments-page.spec.js index fb8db3ee..0e36b2a0 100644 --- a/client/cypress/integration/frontend/instruments/instruments-page.spec.js +++ b/client/cypress/integration/frontend/instruments/instruments-page.spec.js @@ -1,34 +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: 'Sprache & Kommunikation', - id: 'LANGUAGE_COMMUNICATION', + name: LANGUAGE_COMMUNICATION_VALUE, + id: LANGUAGE_COMMUNICATION, foreground: '#000000', - background: '#00ffff' + background: '#00ffff', }; const societyCategory = { - name: 'Gesellschaft', - id: 'SOCIETY', + name: SOCIETY_VALUE, + id: SOCIETY, foreground: '#ffffff', - background: '#000fff' + background: '#000fff', }; + const ANALYSE = 'analyse'; + const ARGUMENTATION = 'argumentation'; + const ETHIK = 'ethik'; + const analyse = { name: 'Analyse', category: languageCategory, - type: 'analyse', + type: ANALYSE, + id: ANALYSE }; const argumentation = { name: 'Argumentation', category: languageCategory, - type: 'argumentation', + type: ARGUMENTATION, + id: ARGUMENTATION }; const ethik = { name: 'Ethik', category: societyCategory, - type: 'ethik', + type: ETHIK, + id: ETHIK }; cy.mockGraphqlOps({ @@ -50,23 +66,40 @@ describe('Instruments Page', () => { type: ethik, title: 'Instrument: Ethik', slug: 'ethik', - } + }, ], }, - InstrumentTypesQuery: { - instrumentTypes: [ - analyse, - argumentation, + InstrumentCategoriesQuery: { + instrumentCategories: [ { - name: 'Beschreibung', - category: languageCategory, - type: 'beschreibung', + name: 'Sprache & Kommunikation', + id: LANGUAGE_COMMUNICATION, + types: [ + analyse, + argumentation, + { + name: 'Beschreibung', + category: languageCategory, + type: 'beschreibung', + }, + ], }, - ethik, { - name: 'Identität und Sozialisation', - category: societyCategory, - 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: [], }, ], }, @@ -79,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/graphql/gql/queries/instrumentCategoriesQuery.gql b/client/src/graphql/gql/queries/instrumentCategoriesQuery.gql index 99a1225f..0d565b1f 100644 --- a/client/src/graphql/gql/queries/instrumentCategoriesQuery.gql +++ b/client/src/graphql/gql/queries/instrumentCategoriesQuery.gql @@ -1,4 +1,4 @@ -query InstrumentTypesQuery { +query InstrumentCategoriesQuery { instrumentCategories { name id