import module from '../../fixtures/module.minimal'; const spellCheck = require('../../fixtures/spell-check.json'); const userText = 'Hir ist ein Feler gewesen'; const operations = { MeQuery: { me: { permissions: [], readOnly: false, }, }, 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: userText, 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: '', }, }, }, UpdateLastModule: { updateLastModule: { lastModule: {}, }, }, }; describe('Spellcheck', () => { beforeEach(() => { cy.setup(); cy.mockGraphqlOps({ operations, }); }); // todo: unskip me it('should highlight three errors', () => { cy.visit('/module/lohn-und-budget/'); cy.getByDataCy('submission-textarea').should('have.value', userText); cy.getByDataCy('spellcheck-correction').should('have.length', 0); cy.getByDataCy('spellcheck-button').click(); cy.getByDataCy('spellcheck-correction').should('have.length', 3); }); });