69 lines
1.5 KiB
JavaScript
69 lines
1.5 KiB
JavaScript
import mocks from '../../../fixtures/mocks';
|
|
|
|
const myText = 'Mein Feedback';
|
|
|
|
const getOperations = ({readOnly}) => ({
|
|
MeQuery: {
|
|
me: {
|
|
onboardingVisited: true,
|
|
readOnly,
|
|
},
|
|
},
|
|
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.fakeLogin('nico.teacher', 'test');
|
|
cy.server();
|
|
cy.task('getSchema').then(schema => {
|
|
cy.mockGraphql({
|
|
schema,
|
|
mocks,
|
|
});
|
|
});
|
|
});
|
|
|
|
it('can not edit', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({readOnly: true}),
|
|
});
|
|
|
|
cy.visit('submission/submission-id');
|
|
// cy.get('.submission-form__textarea--readonly').as('textarea');
|
|
//
|
|
// cy.get('@textarea').invoke('val').should('contain', myText);
|
|
// cy.get('@textarea').should('have.attr', 'readonly');
|
|
|
|
cy.isSubmissionReadOnly(myText);
|
|
cy.canReopen(false);
|
|
});
|
|
it('can edit', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: getOperations({readOnly: false}),
|
|
});
|
|
|
|
cy.visit('submission/submission-id');
|
|
cy.canReopen(false);
|
|
});
|
|
});
|