Fix cypress test

This commit is contained in:
Ramon Wenger 2022-09-14 11:53:16 +02:00
parent 8d40c558f0
commit bd2acdc7c6
2 changed files with 60 additions and 27 deletions

View File

@ -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();

View File

@ -1,4 +1,4 @@
query InstrumentTypesQuery {
query InstrumentCategoriesQuery {
instrumentCategories {
name
id