72 lines
1.5 KiB
JavaScript
72 lines
1.5 KiB
JavaScript
const myText = 'Mein Feedback';
|
|
|
|
const getOperations = ({ readOnly, classReadOnly = false }) => ({
|
|
MeQuery: {
|
|
me: {
|
|
readOnly,
|
|
selectedClass: {
|
|
id: 'selectedClassId',
|
|
readOnly: classReadOnly,
|
|
},
|
|
},
|
|
},
|
|
StudentSubmissions: {
|
|
studentSubmission: {
|
|
id: 'id',
|
|
text: 'Submission Text',
|
|
document: '',
|
|
student: {
|
|
firstName: 'Peter',
|
|
lastName: 'Student',
|
|
},
|
|
assignment: {
|
|
title: 'Assignment Title',
|
|
assignment: 'Assignment Text',
|
|
},
|
|
submissionFeedback: {
|
|
id: 'feedback-id',
|
|
text: myText,
|
|
final: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
describe('Assignment feedback read-only - Teacher', () => {
|
|
beforeEach(() => {
|
|
cy.setup();
|
|
});
|
|
|
|
it('can not edit', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({ readOnly: true }),
|
|
});
|
|
|
|
cy.visit('submission/submission-id');
|
|
|
|
cy.isSubmissionReadOnly(myText);
|
|
cy.getByDataCy('final-submission-reopen').should('not.exist');
|
|
});
|
|
|
|
it('can edit', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({ readOnly: false }),
|
|
});
|
|
|
|
cy.visit('submission/submission-id');
|
|
|
|
cy.getByDataCy('final-submission-reopen').should('exist');
|
|
});
|
|
|
|
it('can not edit for inactive class', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({ readOnly: false, classReadOnly: true }),
|
|
});
|
|
|
|
cy.visit('submission/submission-id');
|
|
|
|
cy.isSubmissionReadOnly(myText);
|
|
cy.getByDataCy('final-submission-reopen').should('not.exist');
|
|
});
|
|
});
|