skillbox/client/cypress/e2e/frontend/modules/assignment-in-module.spec.js

80 lines
1.7 KiB
JavaScript

import { getMinimalMe } from '../../../support/helpers';
// const operations = {
// MeQuery: getMinimalMe({isTeacher: false}),
// };
const MeQuery = getMinimalMe();
describe('Content Blocks', () => {
const slug = 'some-module';
const assignment = {
id: 'abc',
title: 'Some assignment',
assignment: 'Please write down your thoughts',
submission: null,
};
const module = {
title: 'Hello world',
slug,
solutionsEnabled: false,
chapters: [
{
contentBlocks: [
{
title: 'A content block',
contents: [
{
type: 'text_block',
value: {
text: 'Ein Text',
},
},
{
type: 'assignment',
value: assignment,
},
],
},
],
},
],
};
const operations = {
ModuleDetailsQuery: {
module,
},
MeQuery,
ModuleEditModeQuery: {
module: {
slug,
},
},
UpdateLastModule: {
module,
},
AssignmentQuery: {
assignment,
},
UpdateAssignmentWithSuccess: {
updateAssignment: {
successful: true,
updatedAssignment: assignment,
},
},
};
beforeEach(() => {
cy.setup();
cy.mockGraphqlOps({ operations });
cy.visit(`module/${slug}`);
});
it('types into the assignment input', () => {
cy.getByDataCy('submission-textarea').should('exist').type('My Solution');
});
it('does not see assignment input on mobile', () => {
cy.viewport('iphone-8');
cy.getByDataCy('submission-textarea').should('not.be.visible');
});
});