Add prettier to project, format cypress folder

This commit is contained in:
Ramon Wenger 2023-01-12 15:52:02 +01:00
parent e4dded714c
commit 647e684469
60 changed files with 14395 additions and 855 deletions

1
client/.prettierignore Normal file
View File

@ -0,0 +1 @@
dist

View File

@ -1,5 +1,3 @@
module.exports = { module.exports = {
'extends': [ extends: ['plugin:cypress/recommended'],
'plugin:cypress/recommended',
],
}; };

View File

@ -42,19 +42,25 @@ describe('The Login Page', () => {
cy.viewport('macbook-15'); cy.viewport('macbook-15');
cy.apolloLogin(user, pw); cy.apolloLogin(user, pw);
cy.visit('/me/my-class'); cy.visit('/me/my-class');
cy.get('[data-cy=header-user-widget]').should('exist').within(() => { cy.get('[data-cy=header-user-widget]')
.should('exist')
.within(() => {
cy.get('[data-cy=user-widget-avatar]').should('exist').click(); cy.get('[data-cy=user-widget-avatar]').should('exist').click();
}); });
cy.get('[data-cy=logout]').click(); cy.get('[data-cy=logout]').click();
cy.get('[data-cy=oauth-login]').should('exist').within(() => { cy.get('[data-cy=oauth-login]')
.should('exist')
.within(() => {
cy.visit('/beta-login'); cy.visit('/beta-login');
}); });
cy.login(user, pw); cy.login(user, pw);
cy.get('[data-cy=header-user-widget]').should('exist').within(() => { cy.get('[data-cy=header-user-widget]')
.should('exist')
.within(() => {
cy.get('[data-cy=user-widget-avatar]').should('exist').click(); cy.get('[data-cy=user-widget-avatar]').should('exist').click();
}); });

View File

@ -3,7 +3,7 @@ import {assertStartPage} from '../../../support/helpers';
const schema = require('../../../fixtures/schema.json'); const schema = require('../../../fixtures/schema.json');
const redeemCoupon = coupon => { const redeemCoupon = (coupon) => {
if (coupon !== '') { if (coupon !== '') {
cy.get('[data-cy="coupon-input"]').type(coupon); cy.get('[data-cy="coupon-input"]').type(coupon);
} }
@ -22,10 +22,10 @@ describe('Email Verification', () => {
operations: { operations: {
Coupon: { Coupon: {
coupon: { coupon: {
success: true success: true,
} },
},
}, },
}
}); });
cy.apolloLogin('rachel.green', 'test'); cy.apolloLogin('rachel.green', 'test');
@ -48,8 +48,8 @@ describe('Email Verification', () => {
cy.mockGraphql({ cy.mockGraphql({
schema: schema, schema: schema,
operations: { operations: {
Coupon: new GraphQLError('invalid_coupon') Coupon: new GraphQLError('invalid_coupon'),
} },
}); });
cy.apolloLogin('rachel.green', 'test'); cy.apolloLogin('rachel.green', 'test');
@ -63,13 +63,15 @@ describe('Email Verification', () => {
cy.mockGraphql({ cy.mockGraphql({
schema: schema, schema: schema,
operations: { operations: {
Coupon: new GraphQLError('unknown_error') Coupon: new GraphQLError('unknown_error'),
} },
}); });
cy.apolloLogin('rachel.green', 'test'); cy.apolloLogin('rachel.green', 'test');
cy.visit('/license-activation'); cy.visit('/license-activation');
redeemCoupon('12345asfd'); redeemCoupon('12345asfd');
cy.get('[data-cy="coupon-remote-errors"]').contains('Es ist ein Fehler aufgetreten. Bitte versuchen Sie es nochmals oder kontaktieren Sie den Administrator.'); cy.get('[data-cy="coupon-remote-errors"]').contains(
'Es ist ein Fehler aufgetreten. Bitte versuchen Sie es nochmals oder kontaktieren Sie den Administrator.'
);
}); });
}); });

View File

@ -3,14 +3,13 @@ import minimalModule from '../../fixtures/module.minimal';
const { me: minimalMe } = getMinimalMe({}); const { me: minimalMe } = getMinimalMe({});
describe('Bookmarks', () => { describe('Bookmarks', () => {
beforeEach(() => { beforeEach(() => {
cy.setup(); cy.setup();
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: { operations: {
MeQuery: { MeQuery: {
me: minimalMe me: minimalMe,
}, },
ModuleDetailsQuery: { ModuleDetailsQuery: {
module: { module: {
@ -25,16 +24,16 @@ describe('Bookmarks', () => {
{ {
type: 'text_block', type: 'text_block',
value: { value: {
text: 'Das folgende Interview' text: 'Das folgende Interview',
},
id: 'df8212ee-3e82-49fa-977e-c4b60789163e',
},
],
},
],
},
],
}, },
id: "df8212ee-3e82-49fa-977e-c4b60789163e"
}
]
}
]
}
]
}
}, },
InstrumentQuery: { InstrumentQuery: {
instrument: { instrument: {
@ -42,45 +41,45 @@ describe('Bookmarks', () => {
{ {
type: 'text_block', type: 'text_block',
value: { value: {
text: 'Hallo Sam' text: 'Hallo Sam',
},
id: 'df8212ee-3e82-49fa-977e-c4b60789163e',
},
],
}, },
id: "df8212ee-3e82-49fa-977e-c4b60789163e"
}
]
}
}, },
UpdateLastModule: {}, UpdateLastModule: {},
UpdateContentBookmark: { UpdateContentBookmark: {
updateContentBookmark: { updateContentBookmark: {
success: true success: true,
} },
}, },
UpdateModuleBookmark: { UpdateModuleBookmark: {
updateModuleBookmark: { updateModuleBookmark: {
success: true success: true,
} },
}, },
UpdateInstrumentBookmark: { UpdateInstrumentBookmark: {
updateModuleBookmark: { updateModuleBookmark: {
success: true success: true,
} },
}, },
UpdateChapterBookmark: { UpdateChapterBookmark: {
updateChapterBookmark: { updateChapterBookmark: {
success: true success: true,
} },
}, },
AddNote: ({ input: { note } }) => ({ AddNote: ({ input: { note } }) => ({
addNote: { addNote: {
note note,
} },
}), }),
UpdateNote: ({ input: { note } }) => ({ UpdateNote: ({ input: { note } }) => ({
updateNote: { updateNote: {
note note,
} },
}) }),
} },
}); });
}); });
@ -109,7 +108,6 @@ describe('Bookmarks', () => {
}); });
cy.get('[data-cy=modal-save-button]').click(); cy.get('[data-cy=modal-save-button]').click();
}); });
it('should bookmark module', () => { it('should bookmark module', () => {

View File

@ -11,11 +11,11 @@ describe('Instruments Page', () => {
instrument: { instrument: {
title: 'A Guitar', title: 'A Guitar',
intro: 'Money for Nothing', intro: 'Money for Nothing',
contents: '' contents: '',
// id: ID! // id: ID!
// bookmarks: [InstrumentBookmarkNode] // bookmarks: [InstrumentBookmarkNode]
// type: InstrumentTypeNode // type: InstrumentTypeNode
} },
}, },
}, },
}); });

View File

@ -9,7 +9,6 @@ describe('Instruments Page', () => {
beforeEach(() => { beforeEach(() => {
cy.setup(); cy.setup();
const languageCategory = { const languageCategory = {
name: LANGUAGE_COMMUNICATION_VALUE, name: LANGUAGE_COMMUNICATION_VALUE,
id: LANGUAGE_COMMUNICATION, id: LANGUAGE_COMMUNICATION,
@ -30,21 +29,21 @@ describe('Instruments Page', () => {
name: 'Analyse', name: 'Analyse',
category: languageCategory, category: languageCategory,
type: ANALYSE, type: ANALYSE,
id: ANALYSE id: ANALYSE,
}; };
const argumentation = { const argumentation = {
name: 'Argumentation', name: 'Argumentation',
category: languageCategory, category: languageCategory,
type: ARGUMENTATION, type: ARGUMENTATION,
id: ARGUMENTATION id: ARGUMENTATION,
}; };
const ethik = { const ethik = {
name: 'Ethik', name: 'Ethik',
category: societyCategory, category: societyCategory,
type: ETHIK, type: ETHIK,
id: ETHIK id: ETHIK,
}; };
cy.mockGraphqlOps({ cy.mockGraphqlOps({
@ -133,7 +132,9 @@ describe('Instruments Page', () => {
it('shows the correct instrument label', () => { it('shows the correct instrument label', () => {
cy.visit('instruments/'); cy.visit('instruments/');
cy.getByDataCy('instrument').first().within(() => { cy.getByDataCy('instrument')
.first()
.within(() => {
cy.getByDataCy('instrument-subheader').should('contain', 'Instrumente - Sprache & Kommunikation'); cy.getByDataCy('instrument-subheader').should('contain', 'Instrumente - Sprache & Kommunikation');
}); });
}); });

View File

@ -26,34 +26,35 @@ describe('Instruments on Module page', () => {
title: 'Some Chapter', title: 'Some Chapter',
contentBlocks: [ contentBlocks: [
{ {
'type': 'instrument', type: 'instrument',
instrumentCategory: { instrumentCategory: {
id: 'category-id', id: 'category-id',
name: 'Sprache & Kommunikation' name: 'Sprache & Kommunikation',
}, },
'title': 'Das Interview', title: 'Das Interview',
'contents': [ contents: [
{ {
'type': 'basic_knowledge', type: 'basic_knowledge',
'value': { value: {
'description': '<p>Ein Interview dient dazu, durch Befragung Informationen zu ermitteln. Bei journalistischen Interviews werden oft Expertinnen und Experten befragt, aber auch Personen.</p>', description:
'<p>Ein Interview dient dazu, durch Befragung Informationen zu ermitteln. Bei journalistischen Interviews werden oft Expertinnen und Experten befragt, aber auch Personen.</p>',
}, },
}, },
], ],
}, },
{ {
'type': 'normal', type: 'normal',
'title': 'Normaler Block', title: 'Normaler Block',
instrumentCategory: null, instrumentCategory: null,
'contents': [ contents: [
{ {
type: 'text_block', type: 'text_block',
value: { value: {
text: 'Some text, not an instrument' text: 'Some text, not an instrument',
} },
} },
] ],
} },
], ],
}, },
], ],
@ -64,10 +65,14 @@ describe('Instruments on Module page', () => {
}); });
it('shows the correct instrument label', () => { it('shows the correct instrument label', () => {
cy.visit('module/module-with-instrument'); cy.visit('module/module-with-instrument');
cy.getByDataCy('content-block').first().within(() => { cy.getByDataCy('content-block')
.first()
.within(() => {
cy.getByDataCy('instrument-label').should('contain', 'Instrumente - Sprache & Kommunikation'); cy.getByDataCy('instrument-label').should('contain', 'Instrumente - Sprache & Kommunikation');
}); });
cy.getByDataCy('content-block').eq(1).within(() => { cy.getByDataCy('content-block')
.eq(1)
.within(() => {
cy.getByDataCy('instrument-label').should('not.exist'); cy.getByDataCy('instrument-label').should('not.exist');
}); });
// also check that other content blocks don't have the label // also check that other content blocks don't have the label

View File

@ -4,23 +4,23 @@ describe('Apply module visibility', () => {
const schoolClasses = [ const schoolClasses = [
{ {
name: 'FLID2018a', name: 'FLID2018a',
id: btoa('SchoolClassNode:1') id: btoa('SchoolClassNode:1'),
}, },
{ {
name: 'Andere Klasse', name: 'Andere Klasse',
id: btoa('SchoolClassNode:2') id: btoa('SchoolClassNode:2'),
}, },
]; ];
const { me: minimalMe } = getMinimalMe({}); const { me: minimalMe } = getMinimalMe({});
const me = { const me = {
...minimalMe, ...minimalMe,
schoolClasses schoolClasses,
}; };
// name: '[\'FLID2018a\', \'Andere Klasse\']' // name: '[\'FLID2018a\', \'Andere Klasse\']'
const operations = { const operations = {
MeQuery: { MeQuery: {
me me,
}, },
ModulesQuery: getModules, ModulesQuery: getModules,
UpdateSettings: { UpdateSettings: {
@ -43,9 +43,9 @@ describe('Apply module visibility', () => {
}, },
ModuleDetailsQuery: { ModuleDetailsQuery: {
module: { module: {
id: 'some-module-id' id: 'some-module-id',
} },
} },
}; };
beforeEach(() => { beforeEach(() => {
@ -54,7 +54,7 @@ describe('Apply module visibility', () => {
it('clicks through the UI', () => { it('clicks through the UI', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations operations,
}); });
// go to module // go to module

View File

@ -17,7 +17,8 @@ describe('Content Blocks', () => {
title: 'Hello world', title: 'Hello world',
slug, slug,
solutionsEnabled: false, solutionsEnabled: false,
chapters: [{ chapters: [
{
contentBlocks: [ contentBlocks: [
{ {
title: 'A content block', title: 'A content block',
@ -35,7 +36,8 @@ describe('Content Blocks', () => {
], ],
}, },
], ],
}], },
],
}; };
const operations = { const operations = {
ModuleDetailsQuery: { ModuleDetailsQuery: {
@ -56,7 +58,7 @@ describe('Content Blocks', () => {
UpdateAssignmentWithSuccess: { UpdateAssignmentWithSuccess: {
updateAssignment: { updateAssignment: {
successful: true, successful: true,
updatedAssignment: assignment updatedAssignment: assignment,
}, },
}, },
}; };

View File

@ -63,6 +63,5 @@ describe('Create Content Block', () => {
}); });
}); });
// todo: another test // todo: another test
// edit existing content block // edit existing content block

View File

@ -46,9 +46,9 @@ const modules = {
const slugs = { const slugs = {
'lohn-und-budget': getId(1), 'lohn-und-budget': getId(1),
'geld': getId(2), geld: getId(2),
'lerntipps': getId(3), lerntipps: getId(3),
'random': getId(4), random: getId(4),
}; };
const getModuleBySlug = (slug) => { const getModuleBySlug = (slug) => {
@ -58,7 +58,7 @@ const getModuleBySlug = (slug) => {
return modules[id]; return modules[id];
}; };
const moduleNodes = Object.values(modules).map(module => ({ const moduleNodes = Object.values(modules).map((module) => ({
node: module, node: module,
})); }));
console.log(moduleNodes); console.log(moduleNodes);
@ -73,7 +73,7 @@ const getTopic = () => {
modules: { modules: {
edges: moduleNodes, edges: moduleNodes,
}, },
} },
}; };
}; };
@ -116,15 +116,15 @@ describe('Current Module', () => {
AssignmentsQuery: { AssignmentsQuery: {
assignments: [], assignments: [],
}, },
ModuleDetailsQuery: variables => { ModuleDetailsQuery: (variables) => {
console.log('calling ModuleDetailsQuery', getModuleBySlug(variables.slug)); console.log('calling ModuleDetailsQuery', getModuleBySlug(variables.slug));
return { return {
module: getModuleBySlug(variables.slug) module: getModuleBySlug(variables.slug),
}; };
}, },
TopicsQuery: { TopicsQuery: {
topics: { topics: {
edges: topics.map(topic => ({node: topic})), edges: topics.map((topic) => ({ node: topic })),
}, },
}, },
Topic: getTopic(), Topic: getTopic(),
@ -165,7 +165,9 @@ describe('Current Module', () => {
// module list exists, but does not have anything in it // module list exists, but does not have anything in it
checkHome(0, true); checkHome(0, true);
cy.get('[data-cy=no-modules-yet]').should('exist').should('contain', 'Sie haben sich noch kein Modul angeschaut. Legen Sie jetzt los!'); cy.get('[data-cy=no-modules-yet]')
.should('exist')
.should('contain', 'Sie haben sich noch kein Modul angeschaut. Legen Sie jetzt los!');
goToModule('Geld und Kauf', 'Modul 2'); goToModule('Geld und Kauf', 'Modul 2');
cy.get('[data-cy=module-title]').should('contain', 'Geld'); cy.get('[data-cy=module-title]').should('contain', 'Geld');

View File

@ -1,7 +1,8 @@
import module from '../../../fixtures/module.minimal'; import module from '../../../fixtures/module.minimal';
import { getMinimalMe } from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
const chapters = [{ const chapters = [
{
title: 'ABC', title: 'ABC',
description: 'DEF', description: 'DEF',
contentBlocks: [ contentBlocks: [
@ -13,13 +14,14 @@ const chapters = [{
{ {
type: 'text_block', type: 'text_block',
value: { value: {
text: 'Hello World' text: 'Hello World',
} },
} },
], ],
}, },
], ],
}]; },
];
const operations = { const operations = {
MeQuery: getMinimalMe({ isTeacher: true }), MeQuery: getMinimalMe({ isTeacher: true }),
@ -31,12 +33,12 @@ const operations = {
ModuleEditModeQuery: { ModuleEditModeQuery: {
module: { module: {
slug: 'some-module', slug: 'some-module',
} },
}, },
DeleteContentBlock: { DeleteContentBlock: {
success: true, success: true,
}, },
UpdateLastModule: {} UpdateLastModule: {},
}; };
describe('Custom Content Block', () => { describe('Custom Content Block', () => {

View File

@ -11,14 +11,13 @@ describe('Duplicate Content Block', () => {
MeQuery: getMinimalMe({ isTeacher: true }), MeQuery: getMinimalMe({ isTeacher: true }),
UpdateLastModule: {}, UpdateLastModule: {},
ModuleEditModeQuery: { ModuleEditModeQuery: {
module: { module: {},
}
}, },
AssignmentQuery: { AssignmentQuery: {
assignment: { assignment: {
title: 'Ein Assignment', title: 'Ein Assignment',
assignment: 'Eine Beschreibung' assignment: 'Eine Beschreibung',
} },
}, },
ModuleDetailsQuery: { ModuleDetailsQuery: {
module: { module: {
@ -32,28 +31,27 @@ describe('Duplicate Content Block', () => {
{ {
type: 'text_block', type: 'text_block',
value: { value: {
text: '<p>Asdf</p>' text: '<p>Asdf</p>',
} },
}, },
{ {
type: 'assignment', type: 'assignment',
value: { value: {
title: 'Ein Auftrag', title: 'Ein Auftrag',
assignment: 'Eine Beschreibung', assignment: 'Eine Beschreibung',
id: 'abcd' id: 'abcd',
} },
} },
],
] },
} ],
] },
} ],
] },
} },
}
}; };
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations operations,
}); });
cy.visit('/module/some-module'); cy.visit('/module/some-module');

View File

@ -50,7 +50,6 @@ const mockDeleteSnapshot = (success) => {
}, },
}, },
}); });
} }
}); });
}; };
@ -80,7 +79,6 @@ const mockUpdateSnapshot = (title) => {
}); });
} }
}); });
}; };
// wait for the specified amount of requests in the test, so they don't spill over to the next test // wait for the specified amount of requests in the test, so they don't spill over to the next test
@ -90,9 +88,8 @@ const waitForNRequests = (n) => {
} }
}; };
describe('Snapshot', () => { describe('Snapshot', () => {
const operations = isTeacher => ({ const operations = (isTeacher) => ({
operations: { operations: {
UpdateSnapshot: { UpdateSnapshot: {
updateSnapshot: { updateSnapshot: {
@ -130,7 +127,6 @@ describe('Snapshot', () => {
}; };
} }
return result; return result;
}, },
}, },
}, },
@ -146,7 +142,7 @@ describe('Snapshot', () => {
created: '2022-01-01', created: '2022-01-01',
creator: 'me', creator: 'me',
shared: false, shared: false,
mine: true mine: true,
}, },
success: true, success: true,
}, },
@ -221,14 +217,18 @@ describe('Snapshot', () => {
it('Creates Snapshot', () => { it('Creates Snapshot', () => {
cy.mockGraphqlOps(operations(true)); cy.mockGraphqlOps(operations(true));
cy.visit('module/miteinander-reden/snapshots'); cy.visit('module/miteinander-reden/snapshots');
cy.getByDataCy('snapshot-list').should('exist').within(() => { cy.getByDataCy('snapshot-list')
.should('exist')
.within(() => {
cy.get('.snapshots__snapshot').should('have.length', 1); cy.get('.snapshots__snapshot').should('have.length', 1);
}); });
cy.getByDataCy('back-link').click(); cy.getByDataCy('back-link').click();
cy.getByDataCy('module-snapshots-button').click(); cy.getByDataCy('module-snapshots-button').click();
cy.getByDataCy('create-snapshot-button').click(); cy.getByDataCy('create-snapshot-button').click();
cy.getByDataCy('show-all-snapshots-button').click(); cy.getByDataCy('show-all-snapshots-button').click();
cy.getByDataCy('snapshot-list').should('exist').within(() => { cy.getByDataCy('snapshot-list')
.should('exist')
.within(() => {
cy.get('.snapshots__snapshot').should('have.length', 2); cy.get('.snapshots__snapshot').should('have.length', 2);
}); });
waitForNRequests(7); waitForNRequests(7);
@ -289,6 +289,5 @@ describe('Snapshot', () => {
waitForNRequests(5); waitForNRequests(5);
}); });
afterEach(() => { afterEach(() => {});
});
}); });

View File

@ -3,18 +3,18 @@ import mocks from '../../../fixtures/mocks';
const modules = { const modules = {
'lohn-und-budget': { 'lohn-und-budget': {
'objectiveGroups': { objectiveGroups: {
'edges': [ edges: [
{ {
'node': { node: {
'title': 'LANGUAGE_COMMUNICATION', title: 'LANGUAGE_COMMUNICATION',
'objectives': { objectives: {
'edges': [ edges: [
{ {
'node': { node: {
'text': 'i-am-an-objective', text: 'i-am-an-objective',
'hiddenFor': { hiddenFor: {
'edges': [], edges: [],
}, },
}, },
}, },
@ -69,7 +69,7 @@ const operations = {
describe('Objective Visibility', () => { describe('Objective Visibility', () => {
beforeEach(() => { beforeEach(() => {
cy.server(); cy.server();
cy.task('getSchema').then(schema => { cy.task('getSchema').then((schema) => {
cy.mockGraphql({ cy.mockGraphql({
schema, schema,
// endpoint: '/api/graphql' // endpoint: '/api/graphql'

View File

@ -27,7 +27,7 @@ describe('New project', () => {
], ],
}, },
MeQuery, MeQuery,
AddProject: variables => ({ AddProject: (variables) => ({
addProject: { addProject: {
project: Object.assign({}, variables.input.project, { schoolClass }), project: Object.assign({}, variables.input.project, { schoolClass }),
errors: null, errors: null,

View File

@ -69,7 +69,7 @@ describe('Project Page', () => {
success: true, success: true,
}, },
}, },
AddProjectEntry: variables => { AddProjectEntry: (variables) => {
const projectEntry = Object.assign({}, variables.input.projectEntry, { const projectEntry = Object.assign({}, variables.input.projectEntry, {
created: createdLater, created: createdLater,
}); });
@ -81,7 +81,7 @@ describe('Project Page', () => {
}, },
}; };
}, },
UpdateProjectEntry: variables => ({ UpdateProjectEntry: (variables) => ({
updateProjectEntry: { updateProjectEntry: {
projectEntry: variables.input.projectEntry, projectEntry: variables.input.projectEntry,
errors: null, errors: null,
@ -116,7 +116,9 @@ describe('Project Page', () => {
it('has the correct layout', () => { it('has the correct layout', () => {
cy.visit('/portfolio/groot'); cy.visit('/portfolio/groot');
cy.getByDataCy('project-entry').eq(0).within(() => { cy.getByDataCy('project-entry')
.eq(0)
.within(() => {
cy.getByDataCy('project-entry-date').should('contain', '1. Juni 2021'); cy.getByDataCy('project-entry-date').should('contain', '1. Juni 2021');
}); });
}); });
@ -255,5 +257,4 @@ describe('Project Page', () => {
cy.getByDataCy('project-actions').should('not.be.visible'); cy.getByDataCy('project-actions').should('not.be.visible');
}); });
}); });
}) });
;

View File

@ -43,7 +43,6 @@ describe('Projects page', () => {
entriesCount: 0, entriesCount: 0,
entries: { entries: {
nodes: [], nodes: [],
}, },
}, },
], ],
@ -82,8 +81,10 @@ describe('Projects page', () => {
}, },
], ],
}, },
AddProject: variables => { AddProject: (variables) => {
const {input: {project}} = variables; const {
input: { project },
} = variables;
return { return {
addProject: { addProject: {
errors: null, errors: null,

View File

@ -6,8 +6,8 @@ const getOperations = ({readOnly, classReadOnly = false}) => ({
readOnly, readOnly,
selectedClass: { selectedClass: {
id: 'selectedClassId', id: 'selectedClassId',
readOnly: classReadOnly readOnly: classReadOnly,
} },
}, },
}, },
StudentSubmissions: { StudentSubmissions: {

View File

@ -39,8 +39,8 @@ const getOperations = ({final, readOnly, classReadOnly = false}) => ({
readOnly, readOnly,
selectedClass: { selectedClass: {
id: 'selectedClassId', id: 'selectedClassId',
readOnly: classReadOnly readOnly: classReadOnly,
} },
}, },
}, },
ModuleDetailsQuery: { ModuleDetailsQuery: {
@ -53,7 +53,7 @@ const getOperations = ({final, readOnly, classReadOnly = false}) => ({
text: myText, text: myText,
final, final,
document: '', document: '',
submissionFeedback: null submissionFeedback: null,
}, },
}, },
}, },
@ -66,7 +66,7 @@ describe('Assignments read-only - Student', () => {
it('can edit and turn in', () => { it('can edit and turn in', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({final: false, readOnly: false}) operations: getOperations({ final: false, readOnly: false }),
}); });
cy.visit('module/module-with-assignment'); cy.visit('module/module-with-assignment');
@ -82,7 +82,7 @@ describe('Assignments read-only - Student', () => {
// todo: very flaky test, fix and re-enable // todo: very flaky test, fix and re-enable
it.skip('can not edit or turn in', () => { it.skip('can not edit or turn in', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({final: false, readOnly: true}) operations: getOperations({ final: false, readOnly: true }),
}); });
cy.visit('module/module-with-assignment'); cy.visit('module/module-with-assignment');
@ -92,7 +92,7 @@ describe('Assignments read-only - Student', () => {
it('can revoke turn in', () => { it('can revoke turn in', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({final: true, readOnly: false}) operations: getOperations({ final: true, readOnly: false }),
}); });
cy.visit('module/module-with-assignment'); cy.visit('module/module-with-assignment');
@ -102,7 +102,7 @@ describe('Assignments read-only - Student', () => {
it('can not revoke turn in', () => { it('can not revoke turn in', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({final: true, readOnly: true}) operations: getOperations({ final: true, readOnly: true }),
}); });
cy.visit('module/module-with-assignment'); cy.visit('module/module-with-assignment');
@ -112,7 +112,7 @@ describe('Assignments read-only - Student', () => {
it('can not edit or turn in in inactive class', () => { it('can not edit or turn in in inactive class', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({final: false, readOnly: false, classReadOnly: true}) operations: getOperations({ final: false, readOnly: false, classReadOnly: true }),
}); });
cy.visit('module/module-with-assignment'); cy.visit('module/module-with-assignment');

View File

@ -35,10 +35,7 @@ describe('Read Only Banner', () => {
cy.getByDataCy('start-page-heading').should('exist'); cy.getByDataCy('start-page-heading').should('exist');
cy.getByDataCy('read-only-banner').should('exist').should('contain', 'Lizenz'); cy.getByDataCy('read-only-banner').should('exist').should('contain', 'Lizenz');
cy.getByDataCy('license-activation-link') cy.getByDataCy('license-activation-link').should('exist').should('contain', 'Neuen Lizenzcode eingeben').click();
.should('exist')
.should('contain', 'Neuen Lizenzcode eingeben')
.click();
cy.url().should('contain', 'license-activation'); cy.url().should('contain', 'license-activation');
}); });

View File

@ -19,7 +19,7 @@ const getOperations = (readOnly = false, classReadOnly = false) => {
lastName: 'Schneider', lastName: 'Schneider',
isTeacher: true, isTeacher: true,
isMe: true, isMe: true,
active: true active: true,
}, },
{ {
id: 'notMeId', id: 'notMeId',
@ -27,7 +27,7 @@ const getOperations = (readOnly = false, classReadOnly = false) => {
lastName: 'Waalkes', lastName: 'Waalkes',
isTeacher: false, isTeacher: false,
isMe: false, isMe: false,
active: true active: true,
}, },
{ {
id: 'alsoNotMeId', id: 'alsoNotMeId',
@ -35,17 +35,17 @@ const getOperations = (readOnly = false, classReadOnly = false) => {
lastName: 'Yanar', lastName: 'Yanar',
isTeacher: false, isTeacher: false,
isMe: false, isMe: false,
active: false active: false,
} },
] ],
} },
}, },
}, },
AddRemoveMember: { AddRemoveMember: {
addRemoveMember: { addRemoveMember: {
success: true success: true,
} },
} },
}; };
}; };

View File

@ -8,7 +8,7 @@ const getOperations = ({readOnly, classReadOnly = false}) => ({
...minimalModule, ...minimalModule,
}, },
}, },
UpdateLastModule: {} UpdateLastModule: {},
}); });
const moduleNavigationTest = ({ readOnly, classReadOnly = false, displayMenu }) => { const moduleNavigationTest = ({ readOnly, classReadOnly = false, displayMenu }) => {

View File

@ -3,12 +3,8 @@ import {getMinimalMe} from '../../../support/helpers';
const getOperations = ({ readOnly }) => ({ const getOperations = ({ readOnly }) => ({
MeQuery: getMinimalMe({ readOnly }), MeQuery: getMinimalMe({ readOnly }),
NewsTeasers: { NewsTeasers: {
newsTeasers: [ newsTeasers: [{}, {}, {}],
{}, },
{},
{},
]
}
}); });
describe('Read Only News', () => { describe('Read Only News', () => {

View File

@ -11,9 +11,7 @@ const getOperations = ({readOnly = false, classReadOnly = false}) => ({
id: btoa('PrivateUserNode:1'), id: btoa('PrivateUserNode:1'),
}, },
entriesCount: 1, entriesCount: 1,
entries: [ entries: [{}],
{}
]
}, },
}, },
}); });

View File

@ -13,7 +13,8 @@ describe('Room Team Management - Read only', () => {
}, },
}, },
RoomsQuery: { RoomsQuery: {
rooms: [{ rooms: [
{
id: '', id: '',
slug: '', slug: '',
title: 'some room', title: 'some room',
@ -24,7 +25,8 @@ describe('Room Team Management - Read only', () => {
id: SELECTED_CLASS_ID, id: SELECTED_CLASS_ID,
name: 'bla', name: 'bla',
}, },
}], },
],
}, },
}); });

View File

@ -52,7 +52,7 @@ describe('School Class and Team Management - Read only', () => {
beforeEach(() => { beforeEach(() => {
cy.fakeLogin('rachel.green', 'test'); cy.fakeLogin('rachel.green', 'test');
cy.server(); cy.server();
cy.task('getSchema').then(schema => { cy.task('getSchema').then((schema) => {
cy.mockGraphql({ cy.mockGraphql({
schema, schema,
mocks, mocks,

View File

@ -7,17 +7,20 @@ describe('Article page', () => {
id: 'room-entry-id', id: 'room-entry-id',
title: 'Some Room Entry, yay!', title: 'Some Room Entry, yay!',
comments: [], comments: [],
contents: [{ contents: [
{
type: 'text_block', type: 'text_block',
value: { value: {
text: 'Ein Text', text: 'Ein Text',
}, },
}, { },
{
type: 'subtitle', type: 'subtitle',
value: { value: {
text: 'Ein Untertitel' text: 'Ein Untertitel',
} },
}], },
],
}; };
const operations = { const operations = {
@ -67,7 +70,9 @@ describe('Article page', () => {
cy.getByDataCy('comment-textarea').type(commentText); cy.getByDataCy('comment-textarea').type(commentText);
cy.getByDataCy('emoji-button').should('have.length', 9).first().click(); cy.getByDataCy('emoji-button').should('have.length', 9).first().click();
cy.getByDataCy('submit-comment').should('contain', 'Kommentar teilen').click(); cy.getByDataCy('submit-comment').should('contain', 'Kommentar teilen').click();
cy.getByDataCy('comment').first().should('contain', commentText + emoji); cy.getByDataCy('comment')
.first()
.should('contain', commentText + emoji);
}); });
it('does not show input field on mobile', () => { it('does not show input field on mobile', () => {

View File

@ -256,9 +256,11 @@ describe('The Room Page (student)', () => {
schoolClass: selectedClass, schoolClass: selectedClass,
restricted: false, restricted: false,
roomEntries: { roomEntries: {
edges: [{ edges: [
{
node: roomEntry, node: roomEntry,
}], },
],
}, },
}; };
@ -367,7 +369,6 @@ describe('The Room Page (student)', () => {
cy.getByDataCy('delete-room-entry').should('not.exist'); cy.getByDataCy('delete-room-entry').should('not.exist');
cy.getByDataCy('modal-save-button').click(); cy.getByDataCy('modal-save-button').click();
cy.getByDataCy('room-entry').should('have.length', 0); cy.getByDataCy('room-entry').should('have.length', 0);
}); });
it('shows room entries with comment count', () => { it('shows room entries with comment count', () => {
@ -380,7 +381,9 @@ describe('The Room Page (student)', () => {
}); });
cy.visit(`/room/${slug}`); cy.visit(`/room/${slug}`);
cy.getByDataCy('room-entry').should('have.length', 1).within(() => { cy.getByDataCy('room-entry')
.should('have.length', 1)
.within(() => {
cy.getByDataCy('entry-count').should('contain.text', '2'); cy.getByDataCy('entry-count').should('contain.text', '2');
}); });
}); });

View File

@ -5,11 +5,13 @@ describe('The Rooms Page', () => {
const getOperations = (isTeacher) => ({ const getOperations = (isTeacher) => ({
MeQuery: getMinimalMe({ isTeacher }), MeQuery: getMinimalMe({ isTeacher }),
RoomsQuery: { RoomsQuery: {
rooms: [{ rooms: [
{
schoolClass: { schoolClass: {
id: SELECTED_CLASS_ID_ENCODED, id: SELECTED_CLASS_ID_ENCODED,
}, },
}], },
],
}, },
}); });
@ -87,21 +89,23 @@ describe('The Rooms Page', () => {
entryCount: 3, entryCount: 3,
appearance: appearance, appearance: appearance,
description: description, description: description,
schoolClass: MeQuery.me.selectedClass schoolClass: MeQuery.me.selectedClass,
}; };
}; };
let rooms = [ let rooms = [getRoom('First Room', 'blue', 'Some description')];
getRoom('First Room', 'blue', 'Some description')
];
const operations = { const operations = {
MeQuery, MeQuery,
RoomsQuery() { RoomsQuery() {
return { return {
rooms rooms,
}; };
}, },
AddRoom({input: {room: {title, appearance, description}}}) { AddRoom({
input: {
room: { title, appearance, description },
},
}) {
const room = getRoom(title, appearance, description); const room = getRoom(title, appearance, description);
rooms.push(room); rooms.push(room);
return { return {

View File

@ -22,12 +22,12 @@ const operations = {
final: false, final: false,
document: '', document: '',
submissionFeedback: { submissionFeedback: {
'id': 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox', id: 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox',
'text': '\ud83d\ude42\ud83d\ude10\ud83e\udd2c\ud83d\udc4d\ud83e\udd22\ud83e\udd22\ud83e\udd22\ud83e\udd22\ud83d\ude2e\ud83e\udd17', text: '\ud83d\ude42\ud83d\ude10\ud83e\udd2c\ud83d\udc4d\ud83e\udd22\ud83e\udd22\ud83e\udd22\ud83e\udd22\ud83d\ude2e\ud83e\udd17',
'teacher': { teacher: {
'firstName': 'Nico', firstName: 'Nico',
'lastName': 'Zickgraf', lastName: 'Zickgraf',
'__typename': 'UserNode', __typename: 'UserNode',
}, },
}, },
}, },
@ -38,76 +38,76 @@ const operations = {
...module, ...module,
assignments: [ assignments: [
{ {
'id': 'QXNzaWdubWVudE5vZGU6MQ==', id: 'QXNzaWdubWVudE5vZGU6MQ==',
'title': 'Ein Auftragstitel', title: 'Ein Auftragstitel',
'assignment': 'Ein Auftrag', assignment: 'Ein Auftrag',
'solution': null, solution: null,
'submission': { submission: {
'id': 'U3R1ZGVudFN1Ym1pc3Npb25Ob2RlOjE=', id: 'U3R1ZGVudFN1Ym1pc3Npb25Ob2RlOjE=',
'text': userText, text: userText,
'final': false, final: false,
'document': '', document: '',
'submissionFeedback': { submissionFeedback: {
'id': 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox', id: 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox',
'text': '🙂😐🤬👍🤢🤢🤢🤢😮🤗', text: '🙂😐🤬👍🤢🤢🤢🤢😮🤗',
'teacher': { teacher: {
'firstName': 'Nico', firstName: 'Nico',
'lastName': 'Zickgraf', lastName: 'Zickgraf',
'__typename': 'UserNode', __typename: 'UserNode',
}, },
'__typename': 'SubmissionFeedbackNode', __typename: 'SubmissionFeedbackNode',
}, },
'__typename': 'StudentSubmissionNode', __typename: 'StudentSubmissionNode',
}, },
'__typename': 'AssignmentNode', __typename: 'AssignmentNode',
}, },
], ],
chapters: [ chapters: [
{ {
'id': 'Q2hhcHRlck5vZGU6MTg=', id: 'Q2hhcHRlck5vZGU6MTg=',
'title': '1.1 Lehrbeginn', title: '1.1 Lehrbeginn',
'description': 'Wie sieht Ihr Konsumverhalten aus?', description: 'Wie sieht Ihr Konsumverhalten aus?',
'bookmark': { bookmark: {
'note': { note: {
'id': 'Tm90ZU5vZGU6Mg==', id: 'Tm90ZU5vZGU6Mg==',
'text': 'Chapter Chapter', text: 'Chapter Chapter',
'__typename': 'NoteNode', __typename: 'NoteNode',
}, },
'__typename': 'ChapterBookmarkNode', __typename: 'ChapterBookmarkNode',
}, },
contentBlocks: [ contentBlocks: [
{ {
'id': 'Q29udGVudEJsb2NrTm9kZToxOQ==', id: 'Q29udGVudEJsb2NrTm9kZToxOQ==',
'slug': 'assignment', slug: 'assignment',
'title': 'Assignment', title: 'Assignment',
'type': 'NORMAL', type: 'NORMAL',
'contents': [ contents: [
{ {
'type': 'assignment', type: 'assignment',
'value': { value: {
'title': 'Ein Auftragstitel', title: 'Ein Auftragstitel',
'assignment': 'Ein Auftrag', assignment: 'Ein Auftrag',
'id': 'QXNzaWdubWVudE5vZGU6MQ==', id: 'QXNzaWdubWVudE5vZGU6MQ==',
}, },
'id': 'df8212ee-3e82-49fa-977e-c4b60789163e', id: 'df8212ee-3e82-49fa-977e-c4b60789163e',
}, },
], ],
'userCreated': false, userCreated: false,
'mine': false, mine: false,
'bookmarks': [ bookmarks: [
{ {
'uuid': 'df8212ee-3e82-49fa-977e-c4b60789163e', uuid: 'df8212ee-3e82-49fa-977e-c4b60789163e',
'note': { note: {
'id': 'Tm90ZU5vZGU6Mw==', id: 'Tm90ZU5vZGU6Mw==',
'text': 'Noch eine Notiz', text: 'Noch eine Notiz',
'__typename': 'NoteNode', __typename: 'NoteNode',
}, },
'__typename': 'ContentBlockBookmarkNode', __typename: 'ContentBlockBookmarkNode',
}, },
], ],
'hiddenFor': [], hiddenFor: [],
'visibleFor': [], visibleFor: [],
'__typename': 'ContentBlockNode', __typename: 'ContentBlockNode',
}, },
], ],
}, },

View File

@ -16,7 +16,7 @@ describe('Survey', () => {
permissions: [], permissions: [],
}, },
}, },
ModuleQuery: variables => ({module}), ModuleQuery: (variables) => ({ module }),
SurveyQuery: () => ({ SurveyQuery: () => ({
survey: { survey: {
id: 'U3VydmV5Tm9kZTox', id: 'U3VydmV5Tm9kZTox',
@ -29,9 +29,8 @@ describe('Survey', () => {
answer, answer,
__typename: 'SurveyNode', __typename: 'SurveyNode',
}, },
}), }),
UpdateAnswer: variables => { UpdateAnswer: (variables) => {
answer = variables.input.answer; answer = variables.input.answer;
return { return {
updateAnswer: { updateAnswer: {

View File

@ -1,5 +1,5 @@
describe('The Home Page', () => { describe('The Home Page', () => {
it('successfully loads', () => { it('successfully loads', () => {
cy.visit('/') cy.visit('/');
}) });
}) });

View File

@ -22,7 +22,7 @@ describe('Onboarding', () => {
}, },
}; };
}, },
NewsTeasers: {} NewsTeasers: {},
}, },
}); });
@ -65,8 +65,8 @@ describe('Onboarding', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: { operations: {
MeQuery: { MeQuery: {
me: {} me: {},
} },
}, },
}); });

View File

@ -100,8 +100,7 @@ describe('School Class Management', () => {
cy.get('[data-cy=class-selection]').click(); cy.get('[data-cy=class-selection]').click();
cy.get('[data-cy=class-selection-entry]').should('have.length', 2); cy.get('[data-cy=class-selection-entry]').should('have.length', 2);
}) });
;
it('should leave and re-join class', () => { it('should leave and re-join class', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
@ -204,10 +203,7 @@ describe('Teacher Class Management', () => {
it('removes student, then leaves class, then rejoins', () => { it('removes student, then leaves class, then rejoins', () => {
const myId = btoa('PrivateUserNode:1'); const myId = btoa('PrivateUserNode:1');
const memberId = btoa('GroupMemberNode:1'); const memberId = btoa('GroupMemberNode:1');
let classMembers = [ let classMembers = [{ ...teacher, id: myId, isMe: true, isTeacher: true }, ...members];
{...teacher, id: myId, isMe: true, isTeacher: true},
...members,
];
let me = () => ({ let me = () => ({
...teacher, ...teacher,
id: memberId, id: memberId,
@ -255,9 +251,7 @@ describe('Teacher Class Management', () => {
const name = 'Hill Valley'; const name = 'Hill Valley';
let selectedClass = teacher.selectedClass; let selectedClass = teacher.selectedClass;
const schoolClasses = [ const schoolClasses = [teacher.selectedClass];
teacher.selectedClass,
];
const me = () => ({ const me = () => ({
...teacher, ...teacher,
@ -265,7 +259,6 @@ describe('Teacher Class Management', () => {
schoolClasses, schoolClasses,
}); });
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: { operations: {
MeQuery: () => ({ MeQuery: () => ({
@ -290,14 +283,13 @@ describe('Teacher Class Management', () => {
req.reply({ req.reply({
data: { data: {
createSchoolClass: { createSchoolClass: {
result: schoolClass result: schoolClass,
} },
} },
}); });
} }
}); });
cy.visit('/me/my-class'); cy.visit('/me/my-class');
cy.get('h1').should('exist'); cy.get('h1').should('exist');
@ -332,9 +324,7 @@ describe('Teacher Class Management', () => {
let selectedClass = teacher.selectedClass; let selectedClass = teacher.selectedClass;
selectedClass.name = 'Some stupid class'; selectedClass.name = 'Some stupid class';
const schoolClasses = [ const schoolClasses = [teacher.selectedClass];
teacher.selectedClass,
];
const me = () => ({ const me = () => ({
...teacher, ...teacher,
@ -365,10 +355,10 @@ describe('Teacher Class Management', () => {
createSchoolClass: { createSchoolClass: {
result: { result: {
__typename: 'DuplicateName', __typename: 'DuplicateName',
reason: 'Dieser Name wird bereits verwendet.' reason: 'Dieser Name wird bereits verwendet.',
} },
} },
} },
}); });
} }
}); });
@ -391,6 +381,5 @@ describe('Teacher Class Management', () => {
cy.get('[data-cy=join-form-confirm]').click(); cy.get('[data-cy=join-form-confirm]').click();
cy.getByDataCy('join-form-input-error').should('contain', 'Dieser Name wird bereits verwendet.'); cy.getByDataCy('join-form-input-error').should('contain', 'Dieser Name wird bereits verwendet.');
}); });
}); });

View File

@ -18,7 +18,7 @@ const mockCreateTeamCall = (name) => {
} else { } else {
result = { result = {
__typename: 'DuplicateName', __typename: 'DuplicateName',
reason: 'Dieser Name wird bereits verwendet.' reason: 'Dieser Name wird bereits verwendet.',
}; };
} }
req.reply({ req.reply({
@ -30,7 +30,6 @@ const mockCreateTeamCall = (name) => {
}); });
} }
}); });
}; };
describe('Team', () => { describe('Team', () => {
@ -63,7 +62,7 @@ describe('Team', () => {
}); });
it('tries to create team but fails due to duplicate name', () => { it('tries to create team but fails due to duplicate name', () => {
const name = 'Gibt\'s schon'; const name = "Gibt's schon";
mockCreateTeamCall(false); mockCreateTeamCall(false);
cy.visit('/me/team'); cy.visit('/me/team');

View File

@ -78,8 +78,7 @@
], ],
"userCreated": false, "userCreated": false,
"mine": false, "mine": false,
"bookmarks": [ "bookmarks": [],
],
"hiddenFor": { "hiddenFor": {
"edges": [], "edges": [],
"__typename": "SchoolClassNodeConnection" "__typename": "SchoolClassNodeConnection"
@ -151,8 +150,7 @@
], ],
"userCreated": false, "userCreated": false,
"mine": false, "mine": false,
"bookmarks": [ "bookmarks": [],
],
"hiddenFor": { "hiddenFor": {
"edges": [], "edges": [],
"__typename": "SchoolClassNodeConnection" "__typename": "SchoolClassNodeConnection"

View File

@ -95,4 +95,3 @@
"__typename": "TopicNode" "__typename": "TopicNode"
} }
} }

View File

@ -24,11 +24,13 @@
"slug": "geld-und-kauf", "slug": "geld-und-kauf",
"__typename": "TopicNode" "__typename": "TopicNode"
}, },
"schoolClasses": [{ "schoolClasses": [
{
"id": "U2Nob29sQ2xhc3NOb2RlOjE=", "id": "U2Nob29sQ2xhc3NOb2RlOjE=",
"name": "FLID2018a", "name": "FLID2018a",
"__typename": "SchoolClassNode" "__typename": "SchoolClassNode"
}], }
],
"__typename": "UserNode", "__typename": "UserNode",
"onboardingVisited": true, "onboardingVisited": true,
"permissions": [] "permissions": []

View File

@ -9,7 +9,7 @@ const minimalMe = {
readOnly: false, readOnly: false,
}; };
export const getMe = isTeacher => ({ export const getMe = (isTeacher) => ({
...minimalMe, ...minimalMe,
isTeacher, isTeacher,
}); });

View File

@ -44,7 +44,7 @@ export default {
id: getChapterId(), id: getChapterId(),
title: 'chapter-title', title: 'chapter-title',
description: 'chapter-description', description: 'chapter-description',
bookmark: null bookmark: null,
}), }),
ContentBlockNode: () => ({ ContentBlockNode: () => ({
contents: [], contents: [],
@ -90,7 +90,7 @@ export default {
assignments: [], assignments: [],
objectiveGroups: [], objectiveGroups: [],
id: getModuleId(), id: getModuleId(),
bookmark: null bookmark: null,
}), }),
TopicNode: () => ({ TopicNode: () => ({
modules: [], modules: [],
@ -113,6 +113,6 @@ export default {
title: 'instrument-title', title: 'instrument-title',
slug: 'instrument-slug', slug: 'instrument-slug',
id: getInstrumentId(), id: getInstrumentId(),
bookmarks: null bookmarks: null,
}) }),
}; };

View File

@ -11,10 +11,10 @@ export default {
topic: { topic: {
title: 'A Topic Mock Title', title: 'A Topic Mock Title',
description: 'A Topic Mock Description', description: 'A Topic Mock Description',
slug: 'a-topic-slug' slug: 'a-topic-slug',
}, },
slug: 'a-module-slug', slug: 'a-module-slug',
solutionsEnabled: false, solutionsEnabled: false,
bookmark: null, bookmark: null,
__typename: 'ModuleNode' __typename: 'ModuleNode',
}; };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@
// This function is called when a project is opened or re-opened (e.g. due to // This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing) // the project's config changing)
require("tsconfig-paths").register(); require('tsconfig-paths').register();
const { readFileSync } = require('fs'); const { readFileSync } = require('fs');
const { resolve } = require('path'); const { resolve } = require('path');
@ -21,10 +21,7 @@ module.exports = (on) => {
// `config` is the resolved Cypress config // `config` is the resolved Cypress config
on('task', { on('task', {
getSchema() { getSchema() {
return readFileSync( return readFileSync(resolve(__dirname, '../../../server/schema.graphql'), 'utf8');
resolve(__dirname, '../../../server/schema.graphql'), },
'utf8'
);
}
}); });
}; };

View File

@ -25,7 +25,7 @@
// -- This will overwrite an existing command -- // -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
// //
import {makeExecutableSchema} from "@graphql-tools/schema"; import { makeExecutableSchema } from '@graphql-tools/schema';
declare global { declare global {
namespace Cypress { namespace Cypress {
@ -37,7 +37,7 @@ declare global {
* @example * @example
* cy.apolloLogin('ross.geller', 'test') * cy.apolloLogin('ross.geller', 'test')
*/ */
apolloLogin(username: string, password: string): Chainable<any> apolloLogin(username: string, password: string): Chainable<any>;
/** /**
* Selects an element based on the `data-cy=xxx` attribute * Selects an element based on the `data-cy=xxx` attribute
@ -45,19 +45,19 @@ declare global {
* @example * @example
* cy.getByDataCy('my-new-button') * cy.getByDataCy('my-new-button')
*/ */
getByDataCy(selector: string): Chainable<Element> getByDataCy(selector: string): Chainable<Element>;
selectClass(schoolClass: string): void selectClass(schoolClass: string): void;
login(username: string, password: string, visitLogin?: boolean): void login(username: string, password: string, visitLogin?: boolean): void;
fakeLogin(username: string, password: string): void fakeLogin(username: string, password: string): void;
isSubmissionReadOnly(myText: string): void isSubmissionReadOnly(myText: string): void;
openSidebar(): void openSidebar(): void;
setup(): void setup(): void;
} }
} }
} }
@ -66,19 +66,20 @@ declare global {
// todo: once above issue is fixed, go back to the original repo -> npm install cypress-graphql-mock // todo: once above issue is fixed, go back to the original repo -> npm install cypress-graphql-mock
// import 'cypress-graphql-mock'; // import 'cypress-graphql-mock';
import mocks from '../fixtures/mocks'; import mocks from '../fixtures/mocks';
import {addMocksToSchema} from "@graphql-tools/mock"; import { addMocksToSchema } from '@graphql-tools/mock';
import {graphql, GraphQLError} from "graphql"; import { graphql, GraphQLError } from 'graphql';
Cypress.Commands.add('apolloLogin', (username, password) => { Cypress.Commands.add('apolloLogin', (username, password) => {
const payload = { const payload = {
'operationName': 'BetaLogin', operationName: 'BetaLogin',
'variables': { variables: {
'input': { input: {
'usernameInput': username, usernameInput: username,
'passwordInput': password, passwordInput: password,
}, },
}, },
'query': 'mutation BetaLogin($input: BetaLoginInput!) {\n betaLogin(input: $input) {\n success\n __typename\n }\n}\n', query:
'mutation BetaLogin($input: BetaLoginInput!) {\n betaLogin(input: $input) {\n success\n __typename\n }\n}\n',
}; };
cy.request({ cy.request({
@ -104,7 +105,6 @@ Cypress.Commands.add('login', (username, password, visitLogin = false) => {
cy.get('[data-cy=login-button]').click(); cy.get('[data-cy=login-button]').click();
}); });
Cypress.Commands.add('getByDataCy', (selector: string) => { Cypress.Commands.add('getByDataCy', (selector: string) => {
return cy.get(`[data-cy=${selector}]`); return cy.get(`[data-cy=${selector}]`);
}); });
@ -141,24 +141,24 @@ Cypress.Commands.add('setup', () => {
const typenameResolver = { const typenameResolver = {
__resolveType(obj, context, info) { __resolveType(obj, context, info) {
return obj.__typename; return obj.__typename;
} },
}; };
Cypress.Commands.add('mockGraphql', (options?: any) => { Cypress.Commands.add('mockGraphql', (options?: any) => {
cy.task('getSchema').then((schemaString: string) => { cy.task('getSchema').then((schemaString: string) => {
const resolverMap = { const resolverMap = {
DeleteSnapshotResult: typenameResolver, DeleteSnapshotResult: typenameResolver,
UpdateSnapshotResult: typenameResolver UpdateSnapshotResult: typenameResolver,
}; };
const schema = makeExecutableSchema({ const schema = makeExecutableSchema({
typeDefs: schemaString, typeDefs: schemaString,
resolvers: resolverMap resolvers: resolverMap,
}); });
const schemaWithMocks = addMocksToSchema({ const schemaWithMocks = addMocksToSchema({
schema, schema,
mocks, mocks,
preserveResolvers: true preserveResolvers: true,
}); });
let currentOperations = options && options.operations ? options.operations : {}; let currentOperations = options && options.operations ? options.operations : {};
@ -177,16 +177,14 @@ Cypress.Commands.add('mockGraphql', (options?: any) => {
// We will lose instanceof if we are not using specific babel plugin, or using pure TS to compile front-end // We will lose instanceof if we are not using specific babel plugin, or using pure TS to compile front-end
rootValue instanceof GraphQLError || rootValue instanceof GraphQLError ||
rootValue.constructor === GraphQLError || rootValue.constructor === GraphQLError ||
rootValue.constructor.name === "GraphQLError" rootValue.constructor.name === 'GraphQLError'
) { ) {
return req.reply( return req.reply({
{
body: { body: {
data: {}, data: {},
errors: [rootValue] errors: [rootValue],
} },
} });
);
} }
graphql({ graphql({
@ -194,26 +192,28 @@ Cypress.Commands.add('mockGraphql', (options?: any) => {
source: query, source: query,
variableValues: variables, variableValues: variables,
operationName, operationName,
rootValue rootValue,
}).then(result => { }).then(
(result) => {
req.reply({ req.reply({
...result, ...result,
}); });
}, e => { },
(e) => {
console.error(e); console.error(e);
}); }
);
}).as('graphqlRequest'); }).as('graphqlRequest');
cy.wrap({ cy.wrap({
setOperations: (options: any) => { setOperations: (options: any) => {
currentOperations = { currentOperations = {
...currentOperations, ...currentOperations,
...options.operations ...options.operations,
}; };
} },
}).as('mockGraphqlOps'); }).as('mockGraphqlOps');
}); });
}); });
Cypress.Commands.add('mockGraphqlOps', (options) => { Cypress.Commands.add('mockGraphqlOps', (options) => {

View File

@ -5,7 +5,7 @@
// const schemaString = ''; // const schemaString = '';
interface GraphQLBody { interface GraphQLBody {
operationName: string operationName: string;
} }
interface CypressAliasRequest extends Request { interface CypressAliasRequest extends Request {

View File

@ -18,9 +18,9 @@ export const getMinimalMe = ({readOnly = false, classReadOnly = false, isTeacher
}; };
const getSchoolClassNode = (id, schoolClassName) => ({ const getSchoolClassNode = (id, schoolClassName) => ({
'id': btoa(`SchoolClassNode:${id}`), id: btoa(`SchoolClassNode:${id}`),
'name': schoolClassName, name: schoolClassName,
'__typename': 'SchoolClassNode', __typename: 'SchoolClassNode',
}); });
export const assertStartPage = (onboarding) => { export const assertStartPage = (onboarding) => {
@ -40,35 +40,35 @@ export const getMe = ({schoolClasses, teacher}) => {
} }
return { return {
'me': { me: {
'id': 'VXNlck5vZGU6NQ==', id: 'VXNlck5vZGU6NQ==',
'pk': 5, pk: 5,
'username': 'rachel.green', username: 'rachel.green',
'email': 'rachel.green@skillbox.example', email: 'rachel.green@skillbox.example',
'expiryDate': '3596153600', expiryDate: '3596153600',
'firstName': 'Rachel', firstName: 'Rachel',
'lastName': 'Green', lastName: 'Green',
'avatarUrl': '', avatarUrl: '',
'isTeacher': teacher, isTeacher: teacher,
readOnly: false, readOnly: false,
'lastModule': { lastModule: {
'id': 'TW9kdWxlTm9kZToxNw==', id: 'TW9kdWxlTm9kZToxNw==',
'slug': 'lohn-und-budget', slug: 'lohn-und-budget',
'__typename': 'ModuleNode', __typename: 'ModuleNode',
}, },
'selectedClass': { selectedClass: {
'id': 'U2Nob29sQ2xhc3NOb2RlOjI=', id: 'U2Nob29sQ2xhc3NOb2RlOjI=',
'__typename': 'SchoolClassNode', __typename: 'SchoolClassNode',
}, },
'lastTopic': { lastTopic: {
'id': 'VG9waWNOb2RlOjU=', id: 'VG9waWNOb2RlOjU=',
'slug': 'geld-und-kauf', slug: 'geld-und-kauf',
'__typename': 'TopicNode', __typename: 'TopicNode',
}, },
'schoolClasses': schoolClassNodes, schoolClasses: schoolClassNodes,
'__typename': 'UserNode', __typename: 'UserNode',
'onboardingVisited': true, onboardingVisited: true,
'permissions': teacher ? ['users.can_manage_school_class_content'] : [], permissions: teacher ? ['users.can_manage_school_class_content'] : [],
}, },
}; };
}; };
@ -76,262 +76,270 @@ export const getMe = ({schoolClasses, teacher}) => {
export const getModules = () => { export const getModules = () => {
return { return {
'lohn-und-budget': { 'lohn-und-budget': {
'id': 'TW9kdWxlTm9kZToyOA==', id: 'TW9kdWxlTm9kZToyOA==',
'title': 'Lohn und Budget', title: 'Lohn und Budget',
'metaTitle': 'Modul 1', metaTitle: 'Modul 1',
'teaser': 'Die Berufsbildung ist ein neuer Lebensabschnit', teaser: 'Die Berufsbildung ist ein neuer Lebensabschnit',
'intro': '\n <p>Sie stehen am Anfang eines neuen Lebensabschnitts. In Ihrer Rolle als Berufslernende oder Berufslernender haben Sie Verantwortung übernommen.</p>\n <p>Wie erging es Ihnen am ersten Arbeits- und Schultag?</p>\n ', intro:
'slug': 'lohn-und-budget', '\n <p>Sie stehen am Anfang eines neuen Lebensabschnitts. In Ihrer Rolle als Berufslernende oder Berufslernender haben Sie Verantwortung übernommen.</p>\n <p>Wie erging es Ihnen am ersten Arbeits- und Schultag?</p>\n ',
'heroImage': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==', slug: 'lohn-und-budget',
'solutionsEnabled': false, heroImage:
'bookmark': { 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
'note': null, solutionsEnabled: false,
'__typename': 'ModuleBookmarkNode', bookmark: {
note: null,
__typename: 'ModuleBookmarkNode',
}, },
'__typename': 'ModuleNode', __typename: 'ModuleNode',
'assignments': { assignments: {
'edges': [ edges: [
{ {
'node': { node: {
'id': 'QXNzaWdubWVudE5vZGU6MQ==', id: 'QXNzaWdubWVudE5vZGU6MQ==',
'title': 'Ein Auftragstitel', title: 'Ein Auftragstitel',
'assignment': 'Ein Auftrag', assignment: 'Ein Auftrag',
'solution': null, solution: null,
'submission': { submission: {
'id': 'U3R1ZGVudFN1Ym1pc3Npb25Ob2RlOjE=', id: 'U3R1ZGVudFN1Ym1pc3Npb25Ob2RlOjE=',
'text': 'Hir ist ein Feler gewesen', text: 'Hir ist ein Feler gewesen',
'final': false, final: false,
'document': '', document: '',
'submissionFeedback': { submissionFeedback: {
'id': 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox', id: 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox',
'text': '🙂😐🤬👍🤢🤢🤢🤢😮🤗', text: '🙂😐🤬👍🤢🤢🤢🤢😮🤗',
'teacher': { teacher: {
'firstName': 'Nico', firstName: 'Nico',
'lastName': 'Zickgraf', lastName: 'Zickgraf',
'__typename': 'UserNode', __typename: 'UserNode',
}, },
'__typename': 'SubmissionFeedbackNode', __typename: 'SubmissionFeedbackNode',
}, },
'__typename': 'StudentSubmissionNode', __typename: 'StudentSubmissionNode',
}, },
'__typename': 'AssignmentNode', __typename: 'AssignmentNode',
}, },
'__typename': 'AssignmentNodeEdge', __typename: 'AssignmentNodeEdge',
}, },
], ],
'__typename': 'AssignmentNodeConnection', __typename: 'AssignmentNodeConnection',
}, },
'objectiveGroups': { objectiveGroups: {
'edges': [], edges: [],
'__typename': 'ObjectiveGroupNodeConnection', __typename: 'ObjectiveGroupNodeConnection',
}, },
'chapters': { chapters: {
'edges': [ edges: [
{ {
'node': { node: {
'id': 'Q2hhcHRlck5vZGU6MTg=', id: 'Q2hhcHRlck5vZGU6MTg=',
'title': '1.1 Lehrbeginn', title: '1.1 Lehrbeginn',
'description': 'Wie sieht Ihr Konsumverhalten aus?', description: 'Wie sieht Ihr Konsumverhalten aus?',
'bookmark': null, bookmark: null,
'contentBlocks': { contentBlocks: {
'edges': [ edges: [
{ {
'node': { node: {
'id': 'Q29udGVudEJsb2NrTm9kZToxOQ==', id: 'Q29udGVudEJsb2NrTm9kZToxOQ==',
'slug': 'assignment', slug: 'assignment',
'title': 'Assignment', title: 'Assignment',
'type': 'NORMAL', type: 'NORMAL',
'contents': [ contents: [
{ {
'type': 'assignment', type: 'assignment',
'value': { value: {
'title': 'Ein Auftragstitel', title: 'Ein Auftragstitel',
'assignment': 'Ein Auftrag', assignment: 'Ein Auftrag',
'id': 'QXNzaWdubWVudE5vZGU6MQ==', id: 'QXNzaWdubWVudE5vZGU6MQ==',
}, },
'id': 'df8212ee-3e82-49fa-977e-c4b60789163e', id: 'df8212ee-3e82-49fa-977e-c4b60789163e',
}, },
], ],
'userCreated': false, userCreated: false,
'mine': false, mine: false,
'bookmarks': [], bookmarks: [],
'hiddenFor': { hiddenFor: {
'edges': [], edges: [],
'__typename': 'SchoolClassNodeConnection', __typename: 'SchoolClassNodeConnection',
}, },
'visibleFor': { visibleFor: {
'edges': [], edges: [],
'__typename': 'SchoolClassNodeConnection', __typename: 'SchoolClassNodeConnection',
}, },
'__typename': 'ContentBlockNode', __typename: 'ContentBlockNode',
}, },
'__typename': 'ContentBlockNodeEdge', __typename: 'ContentBlockNodeEdge',
}, },
], ],
'__typename': 'ContentBlockNodeConnection', __typename: 'ContentBlockNodeConnection',
}, },
'__typename': 'ChapterNode', __typename: 'ChapterNode',
}, },
'__typename': 'ChapterNodeEdge', __typename: 'ChapterNodeEdge',
}, },
], ],
'__typename': 'ChapterNodeConnection', __typename: 'ChapterNodeConnection',
}, },
}, },
'geld': { geld: {
'id': 'TW9kdWxlTm9kZTo0Mg==', id: 'TW9kdWxlTm9kZTo0Mg==',
'title': 'Geld', title: 'Geld',
'metaTitle': 'Modul 2', metaTitle: 'Modul 2',
'teaser': ' Geld braucht jeder von uns im t\u00e4glichen Leben.', teaser: ' Geld braucht jeder von uns im t\u00e4glichen Leben.',
'intro': '\n <p>Jeder B\u00fcrger nutzt es. Nahezu jeden Tag. Kaum ein Tag vergeht, an dem wir nicht mit M\u00fcnzen oder Geldscheinen bezahlen, bargeldlose \u00dcberweisungen t\u00e4tigen oder andere Zahlungsmethoden verwenden. Doch was genau befindet sich da eigentlich in unserem Geldbeutel? Was ist das, was auf unseren Konten liegt und die Bezeichnung Geld tr\u00e4gt?</p>\n ', intro:
'slug': 'geld', '\n <p>Jeder B\u00fcrger nutzt es. Nahezu jeden Tag. Kaum ein Tag vergeht, an dem wir nicht mit M\u00fcnzen oder Geldscheinen bezahlen, bargeldlose \u00dcberweisungen t\u00e4tigen oder andere Zahlungsmethoden verwenden. Doch was genau befindet sich da eigentlich in unserem Geldbeutel? Was ist das, was auf unseren Konten liegt und die Bezeichnung Geld tr\u00e4gt?</p>\n ',
'heroImage': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==', slug: 'geld',
'solutionsEnabled': false, heroImage:
'bookmark': null, 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
'__typename': 'ModuleNode', solutionsEnabled: false,
'assignments': { bookmark: null,
'edges': [], __typename: 'ModuleNode',
'__typename': 'AssignmentNodeConnection', assignments: {
edges: [],
__typename: 'AssignmentNodeConnection',
}, },
'objectiveGroups': { objectiveGroups: {
'edges': [], edges: [],
'__typename': 'ObjectiveGroupNodeConnection', __typename: 'ObjectiveGroupNodeConnection',
}, },
'chapters': { chapters: {
'edges': [ edges: [
{ {
'node': { node: {
'id': 'Q2hhcHRlck5vZGU6MzI=', id: 'Q2hhcHRlck5vZGU6MzI=',
'title': '2.1 Eine Welt ohne Geld?', title: '2.1 Eine Welt ohne Geld?',
'description': '', description: '',
'bookmark': null, bookmark: null,
'contentBlocks': { contentBlocks: {
'edges': [ edges: [
{ {
'node': { node: {
'id': 'Q29udGVudEJsb2NrTm9kZToxOQ==', id: 'Q29udGVudEJsb2NrTm9kZToxOQ==',
'slug': 'assignment', slug: 'assignment',
'title': 'Assignment', title: 'Assignment',
'type': 'NORMAL', type: 'NORMAL',
'contents': [ contents: [
{ {
'type': 'assignment', type: 'assignment',
'value': { value: {
'title': 'Ein Auftragstitel', title: 'Ein Auftragstitel',
'assignment': 'Ein Auftrag', assignment: 'Ein Auftrag',
'id': 'QXNzaWdubWVudE5vZGU6MQ==', id: 'QXNzaWdubWVudE5vZGU6MQ==',
}, },
'id': 'df8212ee-3e82-49fa-977e-c4b60789163e', id: 'df8212ee-3e82-49fa-977e-c4b60789163e',
}, },
], ],
'userCreated': false, userCreated: false,
'mine': false, mine: false,
'bookmarks': [], bookmarks: [],
'hiddenFor': { hiddenFor: {
'edges': [], edges: [],
'__typename': 'SchoolClassNodeConnection', __typename: 'SchoolClassNodeConnection',
}, },
'visibleFor': { visibleFor: {
'edges': [], edges: [],
'__typename': 'SchoolClassNodeConnection', __typename: 'SchoolClassNodeConnection',
}, },
'__typename': 'ContentBlockNode', __typename: 'ContentBlockNode',
}, },
'__typename': 'ContentBlockNodeEdge', __typename: 'ContentBlockNodeEdge',
}, },
], ],
'__typename': 'ContentBlockNodeConnection', __typename: 'ContentBlockNodeConnection',
}, },
'__typename': 'ChapterNode', __typename: 'ChapterNode',
}, },
'__typename': 'ChapterNodeEdge', __typename: 'ChapterNodeEdge',
}, },
], ],
'__typename': 'ChapterNodeConnection', __typename: 'ChapterNodeConnection',
}, },
}, },
'lerntipps': { lerntipps: {
'id': 'TW9kdWxlTm9kZTo3MA==', id: 'TW9kdWxlTm9kZTo3MA==',
'title': 'Lerntipps', title: 'Lerntipps',
'metaTitle': 'Modul 4', metaTitle: 'Modul 4',
'teaser': 'Lerntipps', teaser: 'Lerntipps',
'intro': '\n <p>Sie stehen am Anfang eines neuen Lebensabschnitts. In Ihrer Rolle als Berufslernende oder Berufslernender haben Sie Verantwortung übernommen.</p>\n <p>Wie erging es Ihnen am ersten Arbeits- und Schultag?</p>\n ', intro:
'slug': 'lerntipps', '\n <p>Sie stehen am Anfang eines neuen Lebensabschnitts. In Ihrer Rolle als Berufslernende oder Berufslernender haben Sie Verantwortung übernommen.</p>\n <p>Wie erging es Ihnen am ersten Arbeits- und Schultag?</p>\n ',
'heroImage': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==', slug: 'lerntipps',
'solutionsEnabled': false, heroImage:
'bookmark': { 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
'note': null, solutionsEnabled: false,
'__typename': 'ModuleBookmarkNode', bookmark: {
note: null,
__typename: 'ModuleBookmarkNode',
}, },
'__typename': 'ModuleNode', __typename: 'ModuleNode',
'assignments': { assignments: {
'edges': [], edges: [],
'__typename': 'AssignmentNodeConnection', __typename: 'AssignmentNodeConnection',
}, },
'objectiveGroups': { objectiveGroups: {
'edges': [], edges: [],
'__typename': 'ObjectiveGroupNodeConnection', __typename: 'ObjectiveGroupNodeConnection',
}, },
'chapters': { chapters: {
'edges': [ edges: [
{ {
'node': { node: {
'id': 'Q2hhcHRlck5vZGU6MTg=', id: 'Q2hhcHRlck5vZGU6MTg=',
'title': '1.1 Lehrbeginn', title: '1.1 Lehrbeginn',
'description': 'Wie sieht Ihr Konsumverhalten aus?', description: 'Wie sieht Ihr Konsumverhalten aus?',
'bookmark': null, bookmark: null,
'contentBlocks': { contentBlocks: {
'edges': [], edges: [],
'__typename': 'ContentBlockNodeConnection', __typename: 'ContentBlockNodeConnection',
}, },
'__typename': 'ChapterNode', __typename: 'ChapterNode',
}, },
'__typename': 'ChapterNodeEdge', __typename: 'ChapterNodeEdge',
}, },
], ],
'__typename': 'ChapterNodeConnection', __typename: 'ChapterNodeConnection',
}, },
}, },
'random': { random: {
'id': 'TW9kdWxlTm9kZTo1NA==', id: 'TW9kdWxlTm9kZTo1NA==',
'title': 'Random', title: 'Random',
'metaTitle': 'Modul 5', metaTitle: 'Modul 5',
'teaser': 'Random', teaser: 'Random',
'intro': '\n <p>Sie stehen am Anfang eines neuen Lebensabschnitts. In Ihrer Rolle als Berufslernende oder Berufslernender haben Sie Verantwortung übernommen.</p>\n <p>Wie erging es Ihnen am ersten Arbeits- und Schultag?</p>\n ', intro:
'slug': 'random', '\n <p>Sie stehen am Anfang eines neuen Lebensabschnitts. In Ihrer Rolle als Berufslernende oder Berufslernender haben Sie Verantwortung übernommen.</p>\n <p>Wie erging es Ihnen am ersten Arbeits- und Schultag?</p>\n ',
'heroImage': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==', slug: 'random',
'solutionsEnabled': false, heroImage:
'bookmark': { 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
'note': null, solutionsEnabled: false,
'__typename': 'ModuleBookmarkNode', bookmark: {
note: null,
__typename: 'ModuleBookmarkNode',
}, },
'__typename': 'ModuleNode', __typename: 'ModuleNode',
'assignments': { assignments: {
'edges': [], edges: [],
'__typename': 'AssignmentNodeConnection', __typename: 'AssignmentNodeConnection',
}, },
'objectiveGroups': { objectiveGroups: {
'edges': [], edges: [],
'__typename': 'ObjectiveGroupNodeConnection', __typename: 'ObjectiveGroupNodeConnection',
}, },
'chapters': { chapters: {
'edges': [ edges: [
{ {
'node': { node: {
'id': 'Q2hhcHRlck5vZGU6MTg=', id: 'Q2hhcHRlck5vZGU6MTg=',
'title': '1.1 Lehrbeginn', title: '1.1 Lehrbeginn',
'description': 'Wie sieht Ihr Konsumverhalten aus?', description: 'Wie sieht Ihr Konsumverhalten aus?',
'bookmark': null, bookmark: null,
'contentBlocks': { contentBlocks: {
'edges': [], edges: [],
'__typename': 'ContentBlockNodeConnection', __typename: 'ContentBlockNodeConnection',
}, },
'__typename': 'ChapterNode', __typename: 'ChapterNode',
}, },
'__typename': 'ChapterNodeEdge', __typename: 'ChapterNodeEdge',
}, },
], ],
'__typename': 'ChapterNodeConnection', __typename: 'ChapterNodeConnection',
}, },
}, },
}; };

View File

@ -1,9 +1,4 @@
// Intellisense for custom Commands: https://github.com/cypress-io/cypress-example-todomvc#cypress-intellisense // Intellisense for custom Commands: https://github.com/cypress-io/cypress-example-todomvc#cypress-intellisense
declare namespace Cypress { declare namespace Cypress {
interface Chainable<Subject> { interface Chainable<Subject> {}
}
} }

View File

@ -94,6 +94,10 @@
"webpack-dev-server": "^4.6.0", "webpack-dev-server": "^4.6.0",
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0"
}, },
"devDependencies": {
"eslint-config-prettier": "^8.6.0",
"prettier": "2.8.2"
},
"engines": { "engines": {
"node": ">= 14.x", "node": ">= 14.x",
"npm": ">= 8.x" "npm": ">= 8.x"
@ -7885,6 +7889,18 @@
"url": "https://opencollective.com/eslint" "url": "https://opencollective.com/eslint"
} }
}, },
"node_modules/eslint-config-prettier": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz",
"integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==",
"dev": true,
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
"peerDependencies": {
"eslint": ">=7.0.0"
}
},
"node_modules/eslint-formatter-friendly": { "node_modules/eslint-formatter-friendly": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/eslint-formatter-friendly/-/eslint-formatter-friendly-7.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-formatter-friendly/-/eslint-formatter-friendly-7.0.0.tgz",
@ -15719,10 +15735,10 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "2.7.1", "version": "2.8.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.2.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", "integrity": "sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==",
"optional": true, "devOptional": true,
"bin": { "bin": {
"prettier": "bin-prettier.js" "prettier": "bin-prettier.js"
}, },
@ -25115,6 +25131,13 @@
} }
} }
}, },
"eslint-config-prettier": {
"version": "8.6.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz",
"integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==",
"dev": true,
"requires": {}
},
"eslint-formatter-friendly": { "eslint-formatter-friendly": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/eslint-formatter-friendly/-/eslint-formatter-friendly-7.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-formatter-friendly/-/eslint-formatter-friendly-7.0.0.tgz",
@ -30673,10 +30696,10 @@
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="
}, },
"prettier": { "prettier": {
"version": "2.7.1", "version": "2.8.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.2.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", "integrity": "sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==",
"optional": true "devOptional": true
}, },
"pretty": { "pretty": {
"version": "2.0.0", "version": "2.0.0",

View File

@ -4,6 +4,9 @@
"description": "skillbox vue client", "description": "skillbox vue client",
"author": "ramon / chrigu", "author": "ramon / chrigu",
"private": true, "private": true,
"prettier": {
"singleQuote": true
},
"scripts": { "scripts": {
"dev": "webpack serve --progress --config build/webpack.dev.conf.js", "dev": "webpack serve --progress --config build/webpack.dev.conf.js",
"analyze": "webpack --profile --json --config build/webpack.dev.conf.js > dist/stats.json && webpack-bundle-analyzer dist/stats.json", "analyze": "webpack --profile --json --config build/webpack.dev.conf.js > dist/stats.json && webpack-bundle-analyzer dist/stats.json",
@ -125,5 +128,9 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"fsevents": "^2.3.2" "fsevents": "^2.3.2"
},
"devDependencies": {
"eslint-config-prettier": "^8.6.0",
"prettier": "2.8.2"
} }
} }