import {mockUpdateLastModule} from '../../support/helpers'; import module from '../../fixtures/module.minimal'; const spellCheck = require('../../fixtures/spell-check.json'); const operations = { MeQuery: { me: { permissions: [], onboardingVisited: true, }, }, AssignmentQuery: { assignment: { id: '', title: 'Ein Auftragstitel', assignment: 'Ein Auftrag', submission: { id: 'U3R1ZGVudFN1Ym1pc3Npb25Ob2RlOjE=', text: 'Hir ist ein Feler gewesen', final: false, document: '', submissionFeedback: { 'id': 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox', 'text': '\ud83d\ude42\ud83d\ude10\ud83e\udd2c\ud83d\udc4d\ud83e\udd22\ud83e\udd22\ud83e\udd22\ud83e\udd22\ud83d\ude2e\ud83e\udd17', 'teacher': { 'firstName': 'Nico', 'lastName': 'Zickgraf', '__typename': 'UserNode', }, }, }, }, }, ModuleDetailsQuery: { module: { ...module, assignments: [ { 'id': 'QXNzaWdubWVudE5vZGU6MQ==', 'title': 'Ein Auftragstitel', 'assignment': 'Ein Auftrag', 'solution': null, 'submission': { 'id': 'U3R1ZGVudFN1Ym1pc3Npb25Ob2RlOjE=', 'text': 'Hir ist ein Feler gewesen', 'final': false, 'document': '', 'submissionFeedback': { 'id': 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox', 'text': '🙂😐🤬👍🤢🤢🤢🤢😮🤗', 'teacher': { 'firstName': 'Nico', 'lastName': 'Zickgraf', '__typename': 'UserNode', }, '__typename': 'SubmissionFeedbackNode', }, '__typename': 'StudentSubmissionNode', }, '__typename': 'AssignmentNode', }, ], chapters: [ { 'id': 'Q2hhcHRlck5vZGU6MTg=', 'title': '1.1 Lehrbeginn', 'description': 'Wie sieht Ihr Konsumverhalten aus?', 'bookmark': { 'note': { 'id': 'Tm90ZU5vZGU6Mg==', 'text': 'Chapter Chapter', '__typename': 'NoteNode', }, '__typename': 'ChapterBookmarkNode', }, contentBlocks: [ { 'id': 'Q29udGVudEJsb2NrTm9kZToxOQ==', 'slug': 'assignment', 'title': 'Assignment', 'type': 'NORMAL', 'contents': [ { 'type': 'assignment', 'value': { 'title': 'Ein Auftragstitel', 'assignment': 'Ein Auftrag', 'id': 'QXNzaWdubWVudE5vZGU6MQ==', }, 'id': 'df8212ee-3e82-49fa-977e-c4b60789163e', }, ], 'userCreated': false, 'mine': false, 'bookmarks': [ { 'uuid': 'df8212ee-3e82-49fa-977e-c4b60789163e', 'note': { 'id': 'Tm90ZU5vZGU6Mw==', 'text': 'Noch eine Notiz', '__typename': 'NoteNode', }, '__typename': 'ContentBlockBookmarkNode', }, ], 'hiddenFor': [], 'visibleFor': [], '__typename': 'ContentBlockNode', }, ], }, ], }, }, SpellCheck: { spellCheck, }, UpdateAssignment: { updateAssignment: { assignment: { id: '', title: 'title', assignment: '', solution: '', }, }, }, ...mockUpdateLastModule(), }; describe('Spellcheck', () => { before(() => { cy.server(); cy.task('getSchema').then(schema => { cy.mockGraphql({ schema, operations, }); }); }); it('should highlight three errors', () => { cy.fakeLogin('rahel.cueni', 'test'); cy.visit('/module/lohn-und-budget/'); cy.get('.spellcheck__correction').should('have.length', 0); cy.get('.submission-form-container__spellcheck').click(); cy.get('.spellcheck__correction').should('have.length', 3); }); });