60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
import {getMinimalMe} from '../../../support/helpers';
|
|
|
|
const getOperations = ({readOnly, classReadOnly = false}) => ({
|
|
MeQuery: getMinimalMe({readOnly, classReadOnly}),
|
|
NewsTeasers: {
|
|
newsTeasers: {
|
|
edges: []
|
|
}
|
|
}
|
|
});
|
|
|
|
const checkReadOnly = (shouldBannerExist, text) => {
|
|
cy.visit('/');
|
|
|
|
cy.getByDataCy('start-page-heading').should('exist');
|
|
if (shouldBannerExist) {
|
|
cy.getByDataCy('read-only-banner').should('exist').should('contain', text);
|
|
} else {
|
|
cy.getByDataCy('read-only-banner').should('not.exist');
|
|
}
|
|
};
|
|
|
|
describe('Read Only Banner', () => {
|
|
beforeEach(() => {
|
|
cy.setup();
|
|
});
|
|
|
|
it('is not shown', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({readOnly: false}),
|
|
});
|
|
checkReadOnly(false);
|
|
});
|
|
|
|
it('is shown for expired license', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({readOnly: true}),
|
|
});
|
|
checkReadOnly(true, 'Lizenz');
|
|
|
|
// cy.visit('/');
|
|
//
|
|
// cy.getByDataCy('start-page-heading').should('exist');
|
|
// cy.getByDataCy('read-only-banner').should('exist').should('contain', 'nicht mehr aktiv');
|
|
});
|
|
|
|
it('is shown for inactive school class', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({readOnly: false, classReadOnly: true}),
|
|
});
|
|
|
|
checkReadOnly(true, 'Klasse');
|
|
//
|
|
// cy.visit('/');
|
|
|
|
// cy.getByDataCy('start-page-heading').should('exist');
|
|
// cy.getByDataCy('read-only-banner').should('exist').should('contain', 'nicht mehr aktiv');
|
|
});
|
|
});
|