65 lines
1.7 KiB
JavaScript
65 lines
1.7 KiB
JavaScript
describe('Assignments', () => {
|
|
const studentSubmission = {
|
|
id: 'submission-id',
|
|
text: '',
|
|
document: '',
|
|
assignment: {},
|
|
submissionFeedback: {
|
|
id: 'feedback-id',
|
|
text: '',
|
|
final: false,
|
|
},
|
|
};
|
|
|
|
const operations = {
|
|
ModulesQuery: {},
|
|
AssignmentWithSubmissions: {
|
|
assignment: {
|
|
title: 'Ein Auftragstitel',
|
|
solution: '<p>Eine Lösung</p>',
|
|
assignment: '<p>Ein <b>Auftrag</b></p>',
|
|
submissions: [studentSubmission],
|
|
},
|
|
},
|
|
MeQuery: {
|
|
me: {},
|
|
},
|
|
ModuleDetailsQuery: {},
|
|
StudentSubmissions: {
|
|
studentSubmission,
|
|
},
|
|
UpdateSubmissionFeedbackWithText({ input: { submissionFeedback } }) {
|
|
return {
|
|
updateSubmissionFeedback: {
|
|
successful: true,
|
|
updatedSubmissionFeedback: submissionFeedback,
|
|
},
|
|
};
|
|
},
|
|
};
|
|
|
|
beforeEach(() => {
|
|
cy.setup();
|
|
|
|
cy.mockGraphqlOps({
|
|
operations,
|
|
});
|
|
});
|
|
|
|
it('it does not display HTML tags', () => {
|
|
cy.visit('/module/lohn-und-budget/submissions/QXNzaWdubWVudE5vZGU6MQ==');
|
|
cy.getByDataCy('assignment-main-text').should('have.text', 'Ein Auftrag');
|
|
cy.getByDataCy('assignment-solution').should('have.text', 'Eine Lösung');
|
|
});
|
|
|
|
it('gives feedback as teacher (with Emojis 🧐)', () => {
|
|
const finalText = 'This is a feedback 🖐️';
|
|
cy.visit('/submission/submission-id');
|
|
cy.getByDataCy('submission-textarea').type('This is a feedback ');
|
|
cy.getByDataCy('emoji-button').should('have.length', 9).first().click();
|
|
cy.getByDataCy('submission-textarea').should('have.value', finalText);
|
|
cy.getByDataCy('submission-form-submit').click();
|
|
cy.getByDataCy('submission-form-submit').should('not.exist');
|
|
});
|
|
});
|