89 lines
2.2 KiB
JavaScript
89 lines
2.2 KiB
JavaScript
describe('Instruments Page', () => {
|
|
beforeEach(() => {
|
|
cy.setup();
|
|
});
|
|
|
|
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('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);
|
|
});
|
|
});
|