Update and rename test, hide assignment input on mobile
Relates to MS-534
This commit is contained in:
parent
5ae7dcbf21
commit
193614872d
|
|
@ -0,0 +1,113 @@
|
|||
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');
|
||||
});
|
||||
});
|
||||
/*
|
||||
cy.task('getSchema').then(schemaString => {
|
||||
cy.intercept('POST', '/api/graphql', (req) => {
|
||||
// if (hasOperationName('MeQuery')) {
|
||||
// graphql()
|
||||
const schema = makeExecutableSchema({
|
||||
typeDefs: schemaString,
|
||||
});
|
||||
const preserveResolvers = true;
|
||||
const mocks = {
|
||||
...defaultMocks,
|
||||
module: {
|
||||
title: 'I am a custom Title!'
|
||||
}
|
||||
};
|
||||
const schemaWithMocks = addMocksToSchema({
|
||||
schema,
|
||||
preserveResolvers,
|
||||
mocks,
|
||||
});
|
||||
|
||||
const {query} = req.body;
|
||||
console.log(req.body);
|
||||
|
||||
graphql({
|
||||
schema: schemaWithMocks,
|
||||
source: query,
|
||||
}).then(result => {
|
||||
console.log(result);
|
||||
req.reply(result);
|
||||
});
|
||||
|
||||
// }
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
import {graphql} from 'graphql';
|
||||
import {makeExecutableSchema} from '@graphql-tools/schema';
|
||||
import {addMocksToSchema} from '@graphql-tools/mock';
|
||||
import {addResolversToSchema} from '@graphql-tools/schema';
|
||||
import defaultMocks from '../../../fixtures/mocks';
|
||||
|
||||
// const operations = {
|
||||
// MeQuery: getMinimalMe({isTeacher: false}),
|
||||
// };
|
||||
|
||||
describe('Content Blocks', () => {
|
||||
beforeEach(() => {
|
||||
cy.fakeLogin('nino.teacher', 'test');
|
||||
cy.viewport('macbook-15');
|
||||
cy.task('getSchema').then(schemaString => {
|
||||
cy.intercept('POST', '/api/graphql', (req) => {
|
||||
// if (hasOperationName('MeQuery')) {
|
||||
// graphql()
|
||||
const schema = makeExecutableSchema({
|
||||
typeDefs: schemaString,
|
||||
});
|
||||
const preserveResolvers = true;
|
||||
const mocks = {
|
||||
...defaultMocks,
|
||||
module: {
|
||||
title: 'I am a custom Title!'
|
||||
}
|
||||
};
|
||||
const schemaWithMocks = addMocksToSchema({
|
||||
schema,
|
||||
preserveResolvers,
|
||||
mocks,
|
||||
});
|
||||
|
||||
const {query} = req.body;
|
||||
console.log(req.body);
|
||||
|
||||
graphql({
|
||||
schema: schemaWithMocks,
|
||||
source: query,
|
||||
}).then(result => {
|
||||
console.log(result);
|
||||
req.reply(result);
|
||||
});
|
||||
|
||||
// }
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('opens the module', () => {
|
||||
cy.visit('module/some-module');
|
||||
});
|
||||
});
|
||||
|
|
@ -127,6 +127,11 @@
|
|||
|
||||
margin-bottom: $medium-spacing;
|
||||
|
||||
display: none;
|
||||
@include desktop {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&__inputs {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue