import { getMinimalMe } from '../../../support/helpers'; const getOperations = ({ readOnly, classReadOnly = false }) => ({ MeQuery: getMinimalMe({ readOnly, classReadOnly }), NewsTeasers: { newsTeasers: { edges: [], }, }, }); describe('Read Only Banner', () => { beforeEach(() => { cy.setup(); }); it('is not shown', () => { cy.mockGraphqlOps({ operations: getOperations({ readOnly: false }), }); cy.visit('/'); cy.getByDataCy('start-page-heading').should('exist'); cy.getByDataCy('read-only-banner').should('not.exist'); }); it('is shown for expired license', () => { cy.mockGraphqlOps({ operations: getOperations({ readOnly: true }), }); cy.visit('/'); cy.getByDataCy('start-page-heading').should('exist'); cy.getByDataCy('read-only-banner').should('exist').should('contain', 'Lizenz'); cy.getByDataCy('license-activation-link').should('exist').should('contain', 'Neuen Lizenzcode eingeben').click(); cy.url().should('contain', 'license-activation'); }); it('is shown for inactive school class', () => { cy.mockGraphqlOps({ operations: getOperations({ readOnly: false, classReadOnly: true }), }); cy.visit('/'); cy.getByDataCy('start-page-heading').should('exist'); cy.getByDataCy('read-only-banner').should('exist').should('contain', 'Klasse'); cy.getByDataCy('license-activation-link').should('not.exist'); }); });