Add new test for read only news

This commit is contained in:
Ramon Wenger 2021-08-03 23:20:18 +02:00
parent d495136b05
commit 69d83d2cb0
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
import {getMinimalMe} from '../../../support/helpers';
const getOperations = ({readOnly}) => ({
MeQuery: getMinimalMe({readOnly}),
NewsTeasers: {
newsTeasers: {
edges: [
{},
{},
{},
]
}
}
});
describe('Read Only News', () => {
beforeEach(() => {
cy.setup();
});
it('displays the news', () => {
cy.mockGraphqlOps({
operations: getOperations({readOnly: false}),
});
cy.visit('/');
cy.getByDataCy('news-navigation-link').should('exist');
cy.getByDataCy('news-teasers').should('exist');
cy.getByDataCy('news-teaser').should('have.length', 2);
});
it('does not display the news', () => {
cy.mockGraphqlOps({
operations: getOperations({readOnly: true}),
});
cy.visit('/');
cy.getByDataCy('news-navigation-link').should('not.exist');
cy.getByDataCy('news-teasers').should('not.exist');
});
});