skillbox/client/cypress/integration/frontend/spellcheck.spec.js

49 lines
1.0 KiB
JavaScript

import {mockUpdateLastModule} from '../../support/helpers';
const assignments = require('../../fixtures/assignments.json');
const module = require('../../fixtures/module.json');
const spellCheck = require('../../fixtures/spell-check.json');
const operations = {
MeQuery: {
me: {
permissions: [],
onboardingVisited: true,
},
},
AssignmentsQuery: {
assignments,
},
ModulesQuery: {
module,
},
SpellCheck: {
spellCheck,
},
...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);
});
});