Update frontend test

This commit is contained in:
Ramon Wenger 2021-10-31 21:46:18 +01:00
parent 08c4a6f7e1
commit 4ba009fbb6
1 changed files with 72 additions and 11 deletions

View File

@ -4,24 +4,85 @@ describe('Instruments Page', () => {
});
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('filter-all-instruments').should('exist');
cy.getByDataCy('filter-language-communication').should('exist');
cy.getByDataCy('filter-society').should('exist');
cy.getByDataCy('filter-interdisciplinary').should('exist');
cy.getByDataCy('filter-analysis').should('exist');
cy.getByDataCy('filter-ethics').should('exist');
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);
});
});