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

@ -3,13 +3,13 @@ describe('Solutions', () => {
// todo: mock all the graphql queries and mutations // todo: mock all the graphql queries and mutations
// todo: enable again // todo: enable again
// // it('does not display the solution at first, then displays them after clicking', () => { // // it('does not display the solution at first, then displays them after clicking', () => {
// // cy.viewport('macbook-15'); // // cy.viewport('macbook-15');
// // cy.login('ross.geller', 'test'); // // cy.login('ross.geller', 'test');
// // // //
// // cy.visit('/module/lohn-und-budget'); // // cy.visit('/module/lohn-und-budget');
// // }); // // });
// //
it('toggles the solution as teacher, then the student can display it', () => { it('toggles the solution as teacher, then the student can display it', () => {
// cy.exec("python ../server/manage.py hidesolutions"); // cy.exec("python ../server/manage.py hidesolutions");
// cy.startGraphQLCapture(); // cy.startGraphQLCapture();

View File

@ -42,21 +42,27 @@ 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]')
cy.get('[data-cy=user-widget-avatar]').should('exist').click(); .should('exist')
}); .within(() => {
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]')
cy.visit('/beta-login'); .should('exist')
}); .within(() => {
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]')
cy.get('[data-cy=user-widget-avatar]').should('exist').click(); .should('exist')
}); .within(() => {
cy.get('[data-cy=user-widget-avatar]').should('exist').click();
});
cy.get('.profile-sidebar').should('be.visible'); cy.get('.profile-sidebar').should('be.visible');
}); });

View File

@ -1,9 +1,9 @@
import { GraphQLError } from 'graphql'; import { GraphQLError } from 'graphql';
import {assertStartPage} from '../../../support/helpers'; 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

@ -28,7 +28,7 @@ describe('Assignments', () => {
StudentSubmissions: { StudentSubmissions: {
studentSubmission, studentSubmission,
}, },
UpdateSubmissionFeedback({input: {submissionFeedback}}) { UpdateSubmissionFeedback({ input: { submissionFeedback } }) {
return { return {
updateSubmissionFeedback: { updateSubmissionFeedback: {
successful: true, successful: true,

View File

@ -1,8 +1,7 @@
import {getMinimalMe} from '../../support/helpers'; import { getMinimalMe } from '../../support/helpers';
import minimalModule from '../../fixtures/module.minimal'; import minimalModule from '../../fixtures/module.minimal';
const {me: minimalMe} = getMinimalMe({}); const { me: minimalMe } = getMinimalMe({});
describe('Bookmarks', () => { describe('Bookmarks', () => {
beforeEach(() => { beforeEach(() => {
@ -10,7 +9,7 @@ describe('Bookmarks', () => {
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

@ -10,12 +10,12 @@ describe('Instruments Page', () => {
InstrumentQuery: { InstrumentQuery: {
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,8 +132,10 @@ 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')
cy.getByDataCy('instrument-subheader').should('contain', 'Instrumente - Sprache & Kommunikation'); .first()
}); .within(() => {
cy.getByDataCy('instrument-subheader').should('contain', 'Instrumente - Sprache & Kommunikation');
});
}); });
}); });

View File

@ -1,7 +1,7 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
import minimalModule from '../../../fixtures/module.minimal'; import minimalModule from '../../../fixtures/module.minimal';
const {me: minimalMe} = getMinimalMe({}); const { me: minimalMe } = getMinimalMe({});
describe('Instruments on Module page', () => { describe('Instruments on Module page', () => {
beforeEach(() => { beforeEach(() => {
@ -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,12 +65,16 @@ 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')
cy.getByDataCy('instrument-label').should('contain', 'Instrumente - Sprache & Kommunikation'); .first()
}); .within(() => {
cy.getByDataCy('content-block').eq(1).within(() => { cy.getByDataCy('instrument-label').should('contain', 'Instrumente - Sprache & Kommunikation');
cy.getByDataCy('instrument-label').should('not.exist'); });
}); cy.getByDataCy('content-block')
.eq(1)
.within(() => {
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

@ -1,26 +1,26 @@
import {getModules, getMinimalMe} from '../../../support/helpers'; import { getModules, getMinimalMe } from '../../../support/helpers';
describe('Apply module visibility', () => { 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

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
// const operations = { // const operations = {
// MeQuery: getMinimalMe({isTeacher: false}), // MeQuery: getMinimalMe({isTeacher: false}),
@ -17,25 +17,27 @@ describe('Content Blocks', () => {
title: 'Hello world', title: 'Hello world',
slug, slug,
solutionsEnabled: false, solutionsEnabled: false,
chapters: [{ chapters: [
contentBlocks: [ {
{ contentBlocks: [
title: 'A content block', {
contents: [ title: 'A content block',
{ contents: [
type: 'text_block', {
value: { type: 'text_block',
text: 'Ein Text', value: {
text: 'Ein Text',
},
}, },
}, {
{ type: 'assignment',
type: 'assignment', value: assignment,
value: assignment, },
}, ],
], },
}, ],
], },
}], ],
}; };
const operations = { const operations = {
ModuleDetailsQuery: { ModuleDetailsQuery: {
@ -56,13 +58,13 @@ describe('Content Blocks', () => {
UpdateAssignmentWithSuccess: { UpdateAssignmentWithSuccess: {
updateAssignment: { updateAssignment: {
successful: true, successful: true,
updatedAssignment: assignment updatedAssignment: assignment,
}, },
}, },
}; };
beforeEach(() => { beforeEach(() => {
cy.setup(); cy.setup();
cy.mockGraphqlOps({operations}); cy.mockGraphqlOps({ operations });
cy.visit(`module/${slug}`); cy.visit(`module/${slug}`);
}); });

View File

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
const MeQuery = getMinimalMe(); const MeQuery = getMinimalMe();
@ -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(),
@ -142,7 +142,7 @@ describe('Current Module', () => {
edges: [], edges: [],
}, },
}, },
UpdateLastModule: ({input: {id}}) => { UpdateLastModule: ({ input: { id } }) => {
const lastModule = modules[id]; const lastModule = modules[id];
return { return {
updateLastModule: { updateLastModule: {
@ -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,28 +1,30 @@
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', {
description: 'DEF', title: 'ABC',
contentBlocks: [ description: 'DEF',
{ contentBlocks: [
title: 'A ContentBlock', {
userCreated: true, title: 'A ContentBlock',
mine: true, userCreated: true,
contents: [ mine: true,
{ contents: [
type: 'text_block', {
value: { type: 'text_block',
text: 'Hello World' value: {
} text: 'Hello World',
} },
], },
}, ],
], },
}]; ],
},
];
const operations = { const operations = {
MeQuery: getMinimalMe({isTeacher: true}), MeQuery: getMinimalMe({ isTeacher: true }),
ModuleDetailsQuery: { ModuleDetailsQuery: {
module: { module: {
chapters, chapters,
@ -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

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
describe('Duplicate Content Block', () => { describe('Duplicate Content Block', () => {
beforeEach(() => { beforeEach(() => {
@ -8,17 +8,16 @@ describe('Duplicate Content Block', () => {
// todo: does not work right now, as the cache does not seem to update for the 'inEditMode' local query. Need to // todo: does not work right now, as the cache does not seem to update for the 'inEditMode' local query. Need to
// make this work for the test to work right. // make this work for the test to work right.
const operations = { const operations = {
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

@ -1,6 +1,6 @@
import module from '../../../fixtures/module.minimal'; import module from '../../../fixtures/module.minimal';
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
import {hasOperationName} from '../../../support/graphql'; import { hasOperationName } from '../../../support/graphql';
let snapshotTitle; let snapshotTitle;
let deleteSuccess; let deleteSuccess;
@ -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,11 +127,10 @@ describe('Snapshot', () => {
}; };
} }
return result; return result;
}, },
}, },
}, },
MeQuery: getMinimalMe({isTeacher}), MeQuery: getMinimalMe({ isTeacher }),
ModuleDetailsQuery: { ModuleDetailsQuery: {
module, module,
}, },
@ -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,16 +217,20 @@ 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')
cy.get('.snapshots__snapshot').should('have.length', 1); .should('exist')
}); .within(() => {
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')
cy.get('.snapshots__snapshot').should('have.length', 2); .should('exist')
}); .within(() => {
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

@ -1,20 +1,20 @@
import {getMe} from '../../../support/helpers'; import { getMe } from '../../../support/helpers';
import mocks from '../../../fixtures/mocks'; 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

@ -1,7 +1,7 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
describe('New project', () => { describe('New project', () => {
const MeQuery = getMinimalMe({isTeacher: false}); const MeQuery = getMinimalMe({ isTeacher: false });
const schoolClass = MeQuery.me.selectedClass; const schoolClass = MeQuery.me.selectedClass;
const operations = { const operations = {
@ -27,9 +27,9 @@ 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,
__typename: 'AddProjectPayload', __typename: 'AddProjectPayload',
}, },

View File

@ -1,4 +1,4 @@
import {PROJECT_ENTRY_TEMPLATE} from '../../../../src/consts/strings.consts'; import { PROJECT_ENTRY_TEMPLATE } from '../../../../src/consts/strings.consts';
const created = '2021-06-01T11:49:00+00:00'; const created = '2021-06-01T11:49:00+00:00';
const createdLater = '2021-06-01T12:49:00+00:00'; const createdLater = '2021-06-01T12:49:00+00:00';
@ -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,9 +116,11 @@ 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')
cy.getByDataCy('project-entry-date').should('contain', '1. Juni 2021'); .eq(0)
}); .within(() => {
cy.getByDataCy('project-entry-date').should('contain', '1. Juni 2021');
});
}); });
it('uses the menu', () => { it('uses the menu', () => {
@ -248,12 +250,11 @@ describe('Project Page', () => {
}); });
it('should not display the entry actions on mobile', () => { it('should not display the entry actions on mobile', () => {
cy.viewport('iphone-8') ; cy.viewport('iphone-8');
cy.visit('/portfolio/groot'); cy.visit('/portfolio/groot');
cy.getByDataCy('project-entry').should('exist'); cy.getByDataCy('project-entry').should('exist');
cy.getByDataCy('project-entry-more').should('not.be.visible'); cy.getByDataCy('project-entry-more').should('not.be.visible');
cy.getByDataCy('project-actions').should('not.be.visible'); cy.getByDataCy('project-actions').should('not.be.visible');
}); });
}); });
}) });
;

View File

@ -1,10 +1,10 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
describe('Projects page', () => { describe('Projects page', () => {
const MeQuery = getMinimalMe({}); const MeQuery = getMinimalMe({});
beforeEach(() => { beforeEach(() => {
cy.setup(); cy.setup();
cy.intercept('GET', '/avatars/**', {fixture: 'maxim.png'}); cy.intercept('GET', '/avatars/**', { fixture: 'maxim.png' });
}); });
it('displays portfolio onboarding', () => { it('displays portfolio onboarding', () => {
@ -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

@ -1,13 +1,13 @@
const myText = 'Mein Feedback'; const myText = 'Mein Feedback';
const getOperations = ({readOnly, classReadOnly = false}) => ({ const getOperations = ({ readOnly, classReadOnly = false }) => ({
MeQuery: { MeQuery: {
me: { me: {
readOnly, readOnly,
selectedClass: { selectedClass: {
id: 'selectedClassId', id: 'selectedClassId',
readOnly: classReadOnly readOnly: classReadOnly,
} },
}, },
}, },
StudentSubmissions: { StudentSubmissions: {
@ -39,7 +39,7 @@ describe('Assignment feedback read-only - Teacher', () => {
it('can not edit', () => { it('can not edit', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly: true}), operations: getOperations({ readOnly: true }),
}); });
cy.visit('submission/submission-id'); cy.visit('submission/submission-id');
@ -50,7 +50,7 @@ describe('Assignment feedback read-only - Teacher', () => {
it('can edit', () => { it('can edit', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly: false}), operations: getOperations({ readOnly: false }),
}); });
cy.visit('submission/submission-id'); cy.visit('submission/submission-id');
@ -60,7 +60,7 @@ describe('Assignment feedback read-only - Teacher', () => {
it('can not edit for inactive class', () => { it('can not edit for inactive class', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly: false, classReadOnly: true}), operations: getOperations({ readOnly: false, classReadOnly: true }),
}); });
cy.visit('submission/submission-id'); cy.visit('submission/submission-id');

View File

@ -33,14 +33,14 @@ const module = {
const myText = 'submission text'; const myText = 'submission text';
const getOperations = ({final, readOnly, classReadOnly = false}) => ({ const getOperations = ({ final, readOnly, classReadOnly = false }) => ({
MeQuery: { MeQuery: {
me: { me: {
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,
}, },
}, },
}, },
@ -62,11 +62,11 @@ const getOperations = ({final, readOnly, classReadOnly = false}) => ({
describe('Assignments read-only - Student', () => { describe('Assignments read-only - Student', () => {
beforeEach(() => { beforeEach(() => {
cy.setup(); cy.setup();
}); });
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

@ -1,7 +1,7 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
const getOperations = ({readOnly, classReadOnly = false}) => ({ const getOperations = ({ readOnly, classReadOnly = false }) => ({
MeQuery: getMinimalMe({readOnly, classReadOnly}), MeQuery: getMinimalMe({ readOnly, classReadOnly }),
NewsTeasers: { NewsTeasers: {
newsTeasers: { newsTeasers: {
edges: [], edges: [],
@ -16,7 +16,7 @@ describe('Read Only Banner', () => {
it('is not shown', () => { it('is not shown', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly: false}), operations: getOperations({ readOnly: false }),
}); });
cy.visit('/'); cy.visit('/');
@ -27,7 +27,7 @@ describe('Read Only Banner', () => {
it('is shown for expired license', () => { it('is shown for expired license', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly: true}), operations: getOperations({ readOnly: true }),
}); });
cy.visit('/'); cy.visit('/');
@ -35,16 +35,13 @@ 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');
}); });
it('is shown for inactive school class', () => { it('is shown for inactive school class', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly: false, classReadOnly: true}), operations: getOperations({ readOnly: false, classReadOnly: true }),
}); });
cy.visit('/'); cy.visit('/');

View File

@ -1,52 +1,52 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
const getOperations = (readOnly = false, classReadOnly = false) => { const getOperations = (readOnly = false, classReadOnly = false) => {
const MeQuery = getMinimalMe({readOnly, classReadOnly}); const MeQuery = getMinimalMe({ readOnly, classReadOnly });
const me = MeQuery.me; const me = MeQuery.me;
return { return {
MeQuery, MeQuery,
MySchoolClassQuery: { MySchoolClassQuery: {
me: { me: {
...me, ...me,
id: 'meId', id: 'meId',
selectedClass: { selectedClass: {
...me.selectedClass, ...me.selectedClass,
members: [ members: [
{ {
id: 'meId', id: 'meId',
firstName: 'Helge', firstName: 'Helge',
lastName: 'Schneider', lastName: 'Schneider',
isTeacher: true, isTeacher: true,
isMe: true, isMe: true,
active: true active: true,
}, },
{ {
id: 'notMeId', id: 'notMeId',
firstName: 'Otto', firstName: 'Otto',
lastName: 'Waalkes', lastName: 'Waalkes',
isTeacher: false, isTeacher: false,
isMe: false, isMe: false,
active: true active: true,
}, },
{ {
id: 'alsoNotMeId', id: 'alsoNotMeId',
firstName: 'Kaya', firstName: 'Kaya',
lastName: 'Yanar', lastName: 'Yanar',
isTeacher: false, isTeacher: false,
isMe: false, isMe: false,
active: false active: false,
} },
] ],
} },
},
}, },
}, AddRemoveMember: {
AddRemoveMember: { addRemoveMember: {
addRemoveMember: { success: true,
success: true },
} },
} };
};
}; };
describe('Leave School Class', () => { describe('Leave School Class', () => {

View File

@ -1,27 +1,27 @@
import minimalModule from '../../../fixtures/module.minimal'; import minimalModule from '../../../fixtures/module.minimal';
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
const getOperations = ({readOnly, classReadOnly = false}) => ({ const getOperations = ({ readOnly, classReadOnly = false }) => ({
MeQuery: getMinimalMe({readOnly, classReadOnly}), MeQuery: getMinimalMe({ readOnly, classReadOnly }),
ModuleDetailsQuery: { ModuleDetailsQuery: {
module: { module: {
...minimalModule, ...minimalModule,
}, },
}, },
UpdateLastModule: {} UpdateLastModule: {},
}); });
const moduleNavigationTest = ({readOnly, classReadOnly = false, displayMenu}) => { const moduleNavigationTest = ({ readOnly, classReadOnly = false, displayMenu }) => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly, classReadOnly}), operations: getOperations({ readOnly, classReadOnly }),
}); });
const shouldMenuExist = displayMenu ? 'exist' : 'not.exist'; const shouldMenuExist = displayMenu ? 'exist' : 'not.exist';
cy.visit('module/module-slug'); cy.visit('module/module-slug');
cy.getByDataCy('module-navigation').should('exist'); cy.getByDataCy('module-navigation').should('exist');
cy.getByDataCy('module-teacher-menu').should(shouldMenuExist); cy.getByDataCy('module-teacher-menu').should(shouldMenuExist);
}; };
describe('Module Navigation - read only', () => { describe('Module Navigation - read only', () => {
@ -30,14 +30,14 @@ describe('Module Navigation - read only', () => {
}); });
it('is shown', () => { it('is shown', () => {
moduleNavigationTest({readOnly: false, displayMenu: true}); moduleNavigationTest({ readOnly: false, displayMenu: true });
}); });
it('is not shown when no valid license', () => { it('is not shown when no valid license', () => {
moduleNavigationTest({readOnly: true, displayMenu: false}); moduleNavigationTest({ readOnly: true, displayMenu: false });
}); });
it('is not shown when inactive school class', () => { it('is not shown when inactive school class', () => {
moduleNavigationTest({readOnly: false, classReadOnly: true, displayMenu: false}); moduleNavigationTest({ readOnly: false, classReadOnly: true, displayMenu: false });
}); });
}); });

View File

@ -1,14 +1,10 @@
import {getMinimalMe} from '../../../support/helpers'; 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', () => {
@ -18,7 +14,7 @@ describe('Read Only News', () => {
it('displays the news', () => { it('displays the news', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly: false}), operations: getOperations({ readOnly: false }),
}); });
cy.visit('/'); cy.visit('/');
@ -30,7 +26,7 @@ describe('Read Only News', () => {
}); });
it('does not display the news', () => { it('does not display the news', () => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly: true}), operations: getOperations({ readOnly: true }),
}); });
cy.visit('/'); cy.visit('/');

View File

@ -1,7 +1,7 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
const getOperations = ({readOnly = false, classReadOnly = false}) => ({ const getOperations = ({ readOnly = false, classReadOnly = false }) => ({
MeQuery: getMinimalMe({readOnly, classReadOnly}), MeQuery: getMinimalMe({ readOnly, classReadOnly }),
ProjectsQuery: { ProjectsQuery: {
projects: [ projects: [
{ {
@ -22,7 +22,7 @@ describe('Read Only Portfolio', () => {
}); });
it('Can create and edit project', () => { it('Can create and edit project', () => {
cy.mockGraphqlOps({operations: getOperations({readOnly: false})}); cy.mockGraphqlOps({ operations: getOperations({ readOnly: false }) });
cy.visit('/portfolio'); cy.visit('/portfolio');
cy.getByDataCy('project-list').should('exist'); cy.getByDataCy('project-list').should('exist');
@ -32,7 +32,7 @@ describe('Read Only Portfolio', () => {
}); });
it('Can not create and edit project when license invalid', () => { it('Can not create and edit project when license invalid', () => {
cy.mockGraphqlOps({operations: getOperations({readOnly: true})}); cy.mockGraphqlOps({ operations: getOperations({ readOnly: true }) });
cy.visit('/portfolio'); cy.visit('/portfolio');
cy.getByDataCy('project-list').should('exist'); cy.getByDataCy('project-list').should('exist');
@ -42,7 +42,7 @@ describe('Read Only Portfolio', () => {
}); });
it('Can not create and edit project when class inactive', () => { it('Can not create and edit project when class inactive', () => {
cy.mockGraphqlOps({operations: getOperations({readOnly: false, classReadOnly: true})}); cy.mockGraphqlOps({ operations: getOperations({ readOnly: false, classReadOnly: true }) });
cy.visit('/portfolio'); cy.visit('/portfolio');
cy.getByDataCy('project-list').should('exist'); cy.getByDataCy('project-list').should('exist');

View File

@ -1,7 +1,7 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
const getOperations = ({readOnly = false, classReadOnly = false}) => ({ const getOperations = ({ readOnly = false, classReadOnly = false }) => ({
MeQuery: getMinimalMe({readOnly, classReadOnly}), MeQuery: getMinimalMe({ readOnly, classReadOnly }),
ProjectQuery: { ProjectQuery: {
project: { project: {
id: 'projectId', id: 'projectId',
@ -11,15 +11,13 @@ const getOperations = ({readOnly = false, classReadOnly = false}) => ({
id: btoa('PrivateUserNode:1'), id: btoa('PrivateUserNode:1'),
}, },
entriesCount: 1, entriesCount: 1,
entries: [ entries: [{}],
{}
]
}, },
}, },
}); });
const testProject = (readOnly, shouldActionsExist, classReadOnly = false) => { const testProject = (readOnly, shouldActionsExist, classReadOnly = false) => {
cy.mockGraphqlOps({operations: getOperations({readOnly, classReadOnly})}); cy.mockGraphqlOps({ operations: getOperations({ readOnly, classReadOnly }) });
const exist = shouldActionsExist ? 'exist' : 'not.exist'; const exist = shouldActionsExist ? 'exist' : 'not.exist';

View File

@ -1,10 +1,10 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
const SELECTED_CLASS_ID = 'selectedClassId'; const SELECTED_CLASS_ID = 'selectedClassId';
const slug = 'some-room'; const slug = 'some-room';
const getOperations = ({readOnly, classReadOnly}) => { const getOperations = ({ readOnly, classReadOnly }) => {
const {me} = getMinimalMe({readOnly, classReadOnly, isTeacher: true}); const { me } = getMinimalMe({ readOnly, classReadOnly, isTeacher: true });
return { return {
MeQuery: { MeQuery: {
me: { me: {
@ -51,8 +51,8 @@ const getOperations = ({readOnly, classReadOnly}) => {
}; };
}; };
const checkRoomReadOnly = ({editable, readOnly, classReadOnly = false}) => { const checkRoomReadOnly = ({ editable, readOnly, classReadOnly = false }) => {
const operations = getOperations({readOnly, classReadOnly}); const operations = getOperations({ readOnly, classReadOnly });
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations, operations,
@ -71,14 +71,14 @@ describe('Room Team Management - Read only', () => {
}); });
it('can edit room', () => { it('can edit room', () => {
checkRoomReadOnly({editable: true, readOnly: false}); checkRoomReadOnly({ editable: true, readOnly: false });
}); });
it('can not edit room', () => { it('can not edit room', () => {
checkRoomReadOnly({editable: false, readOnly: true}); checkRoomReadOnly({ editable: false, readOnly: true });
}); });
it('can not edit room of inactive class', () => { it('can not edit room of inactive class', () => {
checkRoomReadOnly({editable: false, readOnly: false, classReadOnly: true}); checkRoomReadOnly({ editable: false, readOnly: false, classReadOnly: true });
}); });
}); });

View File

@ -1,7 +1,7 @@
describe('Room Team Management - Read only', () => { describe('Room Team Management - Read only', () => {
const SELECTED_CLASS_ID = 'selectedClassId'; const SELECTED_CLASS_ID = 'selectedClassId';
const getOperations = ({readOnly, classReadOnly}) => ({ const getOperations = ({ readOnly, classReadOnly }) => ({
MeQuery: { MeQuery: {
me: { me: {
readOnly, readOnly,
@ -13,23 +13,25 @@ describe('Room Team Management - Read only', () => {
}, },
}, },
RoomsQuery: { RoomsQuery: {
rooms: [{ rooms: [
id: '', {
slug: '', id: '',
title: 'some room', slug: '',
entryCount: 3, title: 'some room',
appearance: 'red', entryCount: 3,
description: 'some description', appearance: 'red',
schoolClass: { description: 'some description',
id: SELECTED_CLASS_ID, schoolClass: {
name: 'bla', id: SELECTED_CLASS_ID,
name: 'bla',
},
}, },
}], ],
}, },
}); });
const checkRoomsReadOnly = ({editable, readOnly, classReadOnly = false}) => { const checkRoomsReadOnly = ({ editable, readOnly, classReadOnly = false }) => {
const operations = getOperations({readOnly, classReadOnly}); const operations = getOperations({ readOnly, classReadOnly });
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations, operations,
@ -48,14 +50,14 @@ describe('Room Team Management - Read only', () => {
}); });
it('can edit room', () => { it('can edit room', () => {
checkRoomsReadOnly({editable: true, readOnly: false}); checkRoomsReadOnly({ editable: true, readOnly: false });
}); });
it('can not edit room', () => { it('can not edit room', () => {
checkRoomsReadOnly({editable: false, readOnly: true}); checkRoomsReadOnly({ editable: false, readOnly: true });
}); });
it('can not edit room of inactive class', () => { it('can not edit room of inactive class', () => {
checkRoomsReadOnly({editable: false, readOnly: false, classReadOnly: true}); checkRoomsReadOnly({ editable: false, readOnly: false, classReadOnly: true });
}); });
}); });

View File

@ -2,7 +2,7 @@ import mocks from '../../../fixtures/mocks';
const selectedClassName = 'My Class'; const selectedClassName = 'My Class';
const getOperations = ({readOnly}) => ({ const getOperations = ({ readOnly }) => ({
MeQuery: { MeQuery: {
me: { me: {
readOnly, readOnly,
@ -33,7 +33,7 @@ const getOperations = ({readOnly}) => ({
const checkSchoolClassTeamReadOnly = (readOnly) => { const checkSchoolClassTeamReadOnly = (readOnly) => {
cy.mockGraphqlOps({ cy.mockGraphqlOps({
operations: getOperations({readOnly}), operations: getOperations({ readOnly }),
}); });
const exist = readOnly ? 'not.exist' : 'exist'; const exist = readOnly ? 'not.exist' : 'exist';
@ -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

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
describe('Article page', () => { describe('Article page', () => {
const slug = 'this-article-has-a-slug'; const slug = 'this-article-has-a-slug';
@ -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', {
value: { type: 'text_block',
text: 'Ein Text', value: {
text: 'Ein Text',
},
}, },
}, { {
type: 'subtitle', type: 'subtitle',
value: { value: {
text: 'Ein Untertitel' text: 'Ein Untertitel',
} },
}], },
],
}; };
const operations = { const operations = {
@ -25,7 +28,7 @@ describe('Article page', () => {
RoomEntryQuery: { RoomEntryQuery: {
roomEntry, roomEntry,
}, },
AddComment({input}) { AddComment({ input }) {
return { return {
addComment: { addComment: {
success: true, success: true,
@ -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

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
describe('The Room Page (Teacher)', () => { describe('The Room Page (Teacher)', () => {
const MeQuery = getMinimalMe(); const MeQuery = getMinimalMe();
@ -171,7 +171,7 @@ describe('The Room Page (Teacher)', () => {
}); });
it('changes class while on room page', () => { it('changes class while on room page', () => {
const {me} = MeQuery; const { me } = MeQuery;
const otherClass = { const otherClass = {
id: btoa('SchoolClassNode:34'), id: btoa('SchoolClassNode:34'),
name: 'Other Class', name: 'Other Class',
@ -223,12 +223,12 @@ describe('The Room Page (Teacher)', () => {
describe('The Room Page (student)', () => { describe('The Room Page (student)', () => {
const slug = 'ein-historisches-festival'; const slug = 'ein-historisches-festival';
const MeQuery = getMinimalMe({isTeacher: false}); const MeQuery = getMinimalMe({ isTeacher: false });
const {me} = MeQuery; const { me } = MeQuery;
const id = atob(me.id).split(':')[1]; const id = atob(me.id).split(':')[1];
const authorId = btoa(`PublicUserNode:${id}`); const authorId = btoa(`PublicUserNode:${id}`);
const entrySlug = 'entry-slug'; const entrySlug = 'entry-slug';
const {selectedClass} = me; const { selectedClass } = me;
const roomEntry = { const roomEntry = {
id: 'entry-id', id: 'entry-id',
slug: entrySlug, slug: entrySlug,
@ -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,
},
],
}, },
}; };
@ -272,7 +274,7 @@ describe('The Room Page (student)', () => {
it('room actions should not exist for student', () => { it('room actions should not exist for student', () => {
const operations = { const operations = {
MeQuery: getMinimalMe({isTeacher: false}), MeQuery: getMinimalMe({ isTeacher: false }),
RoomEntriesQuery, RoomEntriesQuery,
}; };
@ -286,7 +288,7 @@ describe('The Room Page (student)', () => {
}); });
it('creates a room entry', () => { it('creates a room entry', () => {
const MeQuery = getMinimalMe({isTeacher: false}); const MeQuery = getMinimalMe({ isTeacher: false });
const room = { const room = {
id: 'some-room', id: 'some-room',
roomEntries: { roomEntries: {
@ -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,9 +381,11 @@ 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')
cy.getByDataCy('entry-count').should('contain.text', '2'); .should('have.length', 1)
}); .within(() => {
cy.getByDataCy('entry-count').should('contain.text', '2');
});
}); });
it('does not show actions on mobile', () => { it('does not show actions on mobile', () => {

View File

@ -1,15 +1,17 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
import {SELECTED_CLASS_ID_ENCODED} from '../../../fixtures/mocks'; import { SELECTED_CLASS_ID_ENCODED } from '../../../fixtures/mocks';
describe('The Rooms Page', () => { describe('The Rooms Page', () => {
const getOperations = (isTeacher) => ({ const getOperations = (isTeacher) => ({
MeQuery: getMinimalMe({isTeacher}), MeQuery: getMinimalMe({ isTeacher }),
RoomsQuery: { RoomsQuery: {
rooms: [{ rooms: [
schoolClass: { {
id: SELECTED_CLASS_ID_ENCODED, schoolClass: {
id: SELECTED_CLASS_ID_ENCODED,
},
}, },
}], ],
}, },
}); });
@ -77,7 +79,7 @@ describe('The Rooms Page', () => {
}); });
it('adds a room as teacher', () => { it('adds a room as teacher', () => {
const MeQuery = getMinimalMe({isTeacher: true}); const MeQuery = getMinimalMe({ isTeacher: true });
const getRoom = (title, appearance, description) => { const getRoom = (title, appearance, description) => {
let id = title.toLowerCase().replace(' ', '-'); let id = title.toLowerCase().replace(' ', '-');
return { return {
@ -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

@ -1,4 +1,4 @@
import {assertStartPage} from '../../../support/helpers'; import { assertStartPage } from '../../../support/helpers';
describe('Onboarding', () => { describe('Onboarding', () => {
beforeEach(() => { beforeEach(() => {
@ -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

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
describe('Sidebar', () => { describe('Sidebar', () => {
beforeEach(() => { beforeEach(() => {
@ -6,7 +6,7 @@ describe('Sidebar', () => {
}); });
it('should open sidebar and stay open', () => { it('should open sidebar and stay open', () => {
const {me} = getMinimalMe({}); const { me } = getMinimalMe({});
const operations = { const operations = {
MeQuery: { MeQuery: {
me: { me: {

View File

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
// const me = require('../../fixtures/me.new-student.json'); // const me = require('../../fixtures/me.new-student.json');
@ -9,7 +9,7 @@ describe('New student', () => {
// todo: unskip me // todo: unskip me
it.skip('shows "Enter Code" page and adds the user to a class', () => { it.skip('shows "Enter Code" page and adds the user to a class', () => {
const {me} = getMinimalMe({isTeacher: false}); const { me } = getMinimalMe({ isTeacher: false });
let onboardingVisited = false; let onboardingVisited = false;
let selectedClass; let selectedClass;

View File

@ -1,10 +1,10 @@
import {hasOperationName} from '../../../support/graphql'; import { hasOperationName } from '../../../support/graphql';
const me = require('../../../fixtures/me.join-class.json'); const me = require('../../../fixtures/me.join-class.json');
const {getMinimalMe} = require('../../../support/helpers'); const { getMinimalMe } = require('../../../support/helpers');
const MeQuery = getMinimalMe({}); const MeQuery = getMinimalMe({});
const {me: teacher} = MeQuery; const { me: teacher } = MeQuery;
const members = [ const members = [
{ {
@ -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({
@ -168,7 +167,7 @@ describe('Teacher Class Management', () => {
it('changes class name', () => { it('changes class name', () => {
let className = 'Gotta have class'; let className = 'Gotta have class';
const {me: teacher} = getMinimalMe({}); const { me: teacher } = getMinimalMe({});
let localMe = { let localMe = {
me: teacher, me: teacher,
@ -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

@ -1,5 +1,5 @@
import {getMinimalMe} from '../../../support/helpers'; import { getMinimalMe } from '../../../support/helpers';
import {hasOperationName} from '../../../support/graphql'; import { hasOperationName } from '../../../support/graphql';
const teacher = getMinimalMe(); const teacher = getMinimalMe();
@ -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

@ -2,4 +2,4 @@
"name": "Using fixtures to represent data", "name": "Using fixtures to represent data",
"email": "hello@cypress.io", "email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes" "body": "Fixtures are a great way to mock data for responses to routes"
} }

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=", {
"name": "FLID2018a", "id": "U2Nob29sQ2xhc3NOb2RlOjE=",
"__typename": "SchoolClassNode" "name": "FLID2018a",
}], "__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

@ -32,7 +32,7 @@ const getInstrumentId = () => instrumentIdGenerator.next().value;
export default { export default {
UUID: () => '123-456-789', UUID: () => '123-456-789',
GenericStreamFieldType: () => ({type: 'text_block', value: 'Generic Stream Field Type'}), GenericStreamFieldType: () => ({ type: 'text_block', value: 'Generic Stream Field Type' }),
DateTime: () => '2021-01-01Z10:01:23', DateTime: () => '2021-01-01Z10:01:23',
SnapshotNode: () => ({ SnapshotNode: () => ({
chapters: [], chapters: [],
@ -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

@ -1,31 +1,31 @@
{ {
"id": "TW9kdWxlTm9kZTozMQ==", "id": "TW9kdWxlTm9kZTozMQ==",
"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": "\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 ",
"slug": "geld", "slug": "geld",
"heroImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==", "heroImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==",
"solutionsEnabled": false, "solutionsEnabled": false,
"bookmark": null, "bookmark": null,
"__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": "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": {
@ -72,11 +72,11 @@
], ],
"__typename": "ContentBlockNodeConnection" "__typename": "ContentBlockNodeConnection"
}, },
"__typename": "ChapterNode" "__typename": "ChapterNode"
}, },
"__typename": "ChapterNodeEdge" "__typename": "ChapterNodeEdge"
} }
], ],
"__typename": "ChapterNodeConnection" "__typename": "ChapterNodeConnection"
}
} }
}

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,10 +10,10 @@
// 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');
// import webpackPreprocessor from '@cypress/webpack-preprocessor'; // import webpackPreprocessor from '@cypress/webpack-preprocessor';
module.exports = (on) => { module.exports = (on) => {
@ -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,31 +141,31 @@ 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 : {};
// rebuilding what was in cypress-graphql-mock package here, because now we can just intercept the graphql call instead of messing with fetch // rebuilding what was in cypress-graphql-mock package here, because now we can just intercept the graphql call instead of messing with fetch
cy.intercept('POST', '/api/graphql', (req) => { cy.intercept('POST', '/api/graphql', (req) => {
const {operationName, query, variables} = req.body; const { operationName, query, variables } = req.body;
const rootValue = getRootValue(currentOperations, operationName, variables); const rootValue = getRootValue(currentOperations, operationName, variables);
if (!rootValue) { if (!rootValue) {
@ -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(
req.reply({ (result) => {
...result, req.reply({
}); ...result,
}, e => { });
console.error(e); },
}); (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 {
@ -23,7 +23,7 @@ const isGraphQLBody = (body: any): body is GraphQLBody => {
}; };
export const hasOperationName = (req: Request, operationName: string) => { export const hasOperationName = (req: Request, operationName: string) => {
const {body} = req; const { body } = req;
return isGraphQLBody(body) && body.operationName === operationName; return isGraphQLBody(body) && body.operationName === operationName;
}; };

View File

@ -1,6 +1,6 @@
// todo: clean up this file // todo: clean up this file
export const getMinimalMe = ({readOnly = false, classReadOnly = false, isTeacher = true} = {}) => { export const getMinimalMe = ({ readOnly = false, classReadOnly = false, isTeacher = true } = {}) => {
const selectedClass = { const selectedClass = {
name: 'Selected Class', name: 'Selected Class',
id: btoa('SchoolClassNode:987'), id: btoa('SchoolClassNode:987'),
@ -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) => {
@ -31,7 +31,7 @@ export const assertStartPage = (onboarding) => {
} }
}; };
export const getMe = ({schoolClasses, teacher}) => { export const getMe = ({ schoolClasses, teacher }) => {
let schoolClassNodes; let schoolClassNodes;
if (schoolClasses) { if (schoolClasses) {
schoolClassNodes = schoolClasses.map((schoolClass, i) => getSchoolClassNode(i, schoolClass)); schoolClassNodes = schoolClasses.map((schoolClass, i) => getSchoolClassNode(i, schoolClass));
@ -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"
} }
} }