142 lines
3.9 KiB
JavaScript
142 lines
3.9 KiB
JavaScript
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: languageCategory,
|
|
type: ANALYSE,
|
|
id: ANALYSE,
|
|
};
|
|
|
|
const argumentation = {
|
|
name: 'Argumentation',
|
|
category: languageCategory,
|
|
type: ARGUMENTATION,
|
|
id: ARGUMENTATION,
|
|
};
|
|
|
|
const ethik = {
|
|
name: 'Ethik',
|
|
category: societyCategory,
|
|
type: ETHIK,
|
|
id: 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',
|
|
},
|
|
],
|
|
},
|
|
InstrumentCategoriesQuery: {
|
|
instrumentCategories: [
|
|
{
|
|
name: 'Sprache & Kommunikation',
|
|
id: LANGUAGE_COMMUNICATION,
|
|
types: [
|
|
analyse,
|
|
argumentation,
|
|
{
|
|
name: 'Beschreibung',
|
|
category: languageCategory,
|
|
type: 'beschreibung',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: SOCIETY_VALUE,
|
|
id: SOCIETY,
|
|
types: [
|
|
ethik,
|
|
{
|
|
name: 'Identität und Sozialisation',
|
|
category: societyCategory,
|
|
type: 'identitt-und-sozialisation',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: INTERDISCIPLINARY_VALUE,
|
|
id: INTERDISCIPLINARY,
|
|
types: [],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
it('opens the instruments page', () => {
|
|
cy.visit('instruments/');
|
|
|
|
cy.getByDataCy('instrument').should('have.length', 3);
|
|
|
|
cy.getByDataCy('filter-entry').filter(`:contains("${LANGUAGE_COMMUNICATION_VALUE}")`).click();
|
|
cy.getByDataCy('instrument').should('have.length', 2);
|
|
|
|
cy.getByDataCy('filter-entry').filter(`:contains("${SOCIETY_VALUE}")`).click();
|
|
cy.getByDataCy('instrument').should('have.length', 1);
|
|
|
|
cy.getByDataCy('filter-entry').filter(`:contains("${INTERDISCIPLINARY_VALUE}")`).click();
|
|
cy.getByDataCy('instrument').should('have.length', 0);
|
|
|
|
cy.get('.filter-entry').filter(`:contains("Analyse")`).click();
|
|
cy.getByDataCy('instrument').should('have.length', 1);
|
|
|
|
cy.get('.filter-entry').filter(`:contains("Ethik")`).click();
|
|
cy.getByDataCy('instrument').should('have.length', 1);
|
|
|
|
cy.getByDataCy('filter-all-instruments').click();
|
|
cy.getByDataCy('instrument').should('have.length', 3);
|
|
});
|
|
|
|
it('shows the correct instrument label', () => {
|
|
cy.visit('instruments/');
|
|
cy.getByDataCy('instrument')
|
|
.first()
|
|
.within(() => {
|
|
cy.getByDataCy('instrument-subheader').should('contain', 'Instrumente - Sprache & Kommunikation');
|
|
});
|
|
});
|
|
});
|