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 = {
'extends': [
'plugin:cypress/recommended',
],
extends: ['plugin:cypress/recommended'],
};

View File

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

View File

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

View File

@ -1,9 +1,9 @@
import { GraphQLError } from 'graphql';
import {assertStartPage} from '../../../support/helpers';
import { assertStartPage } from '../../../support/helpers';
const schema = require('../../../fixtures/schema.json');
const redeemCoupon = coupon => {
const redeemCoupon = (coupon) => {
if (coupon !== '') {
cy.get('[data-cy="coupon-input"]').type(coupon);
}
@ -22,10 +22,10 @@ describe('Email Verification', () => {
operations: {
Coupon: {
coupon: {
success: true
}
success: true,
},
},
}
},
});
cy.apolloLogin('rachel.green', 'test');
@ -48,8 +48,8 @@ describe('Email Verification', () => {
cy.mockGraphql({
schema: schema,
operations: {
Coupon: new GraphQLError('invalid_coupon')
}
Coupon: new GraphQLError('invalid_coupon'),
},
});
cy.apolloLogin('rachel.green', 'test');
@ -63,13 +63,15 @@ describe('Email Verification', () => {
cy.mockGraphql({
schema: schema,
operations: {
Coupon: new GraphQLError('unknown_error')
}
Coupon: new GraphQLError('unknown_error'),
},
});
cy.apolloLogin('rachel.green', 'test');
cy.visit('/license-activation');
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: {
studentSubmission,
},
UpdateSubmissionFeedback({input: {submissionFeedback}}) {
UpdateSubmissionFeedback({ input: { submissionFeedback } }) {
return {
updateSubmissionFeedback: {
successful: true,

View File

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

View File

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

View File

@ -9,7 +9,6 @@ describe('Instruments Page', () => {
beforeEach(() => {
cy.setup();
const languageCategory = {
name: LANGUAGE_COMMUNICATION_VALUE,
id: LANGUAGE_COMMUNICATION,
@ -30,21 +29,21 @@ describe('Instruments Page', () => {
name: 'Analyse',
category: languageCategory,
type: ANALYSE,
id: ANALYSE
id: ANALYSE,
};
const argumentation = {
name: 'Argumentation',
category: languageCategory,
type: ARGUMENTATION,
id: ARGUMENTATION
id: ARGUMENTATION,
};
const ethik = {
name: 'Ethik',
category: societyCategory,
type: ETHIK,
id: ETHIK
id: ETHIK,
};
cy.mockGraphqlOps({
@ -133,8 +132,10 @@ describe('Instruments Page', () => {
it('shows the correct instrument label', () => {
cy.visit('instruments/');
cy.getByDataCy('instrument').first().within(() => {
cy.getByDataCy('instrument-subheader').should('contain', 'Instrumente - Sprache & Kommunikation');
});
cy.getByDataCy('instrument')
.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';
const {me: minimalMe} = getMinimalMe({});
const { me: minimalMe } = getMinimalMe({});
describe('Instruments on Module page', () => {
beforeEach(() => {
@ -26,34 +26,35 @@ describe('Instruments on Module page', () => {
title: 'Some Chapter',
contentBlocks: [
{
'type': 'instrument',
type: 'instrument',
instrumentCategory: {
id: 'category-id',
name: 'Sprache & Kommunikation'
name: 'Sprache & Kommunikation',
},
'title': 'Das Interview',
'contents': [
title: 'Das Interview',
contents: [
{
'type': 'basic_knowledge',
'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>',
type: 'basic_knowledge',
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>',
},
},
],
},
{
'type': 'normal',
'title': 'Normaler Block',
type: 'normal',
title: 'Normaler Block',
instrumentCategory: null,
'contents': [
contents: [
{
type: 'text_block',
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', () => {
cy.visit('module/module-with-instrument');
cy.getByDataCy('content-block').first().within(() => {
cy.getByDataCy('instrument-label').should('contain', 'Instrumente - Sprache & Kommunikation');
});
cy.getByDataCy('content-block').eq(1).within(() => {
cy.getByDataCy('instrument-label').should('not.exist');
});
cy.getByDataCy('content-block')
.first()
.within(() => {
cy.getByDataCy('instrument-label').should('contain', 'Instrumente - Sprache & Kommunikation');
});
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
});
});

View File

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

View File

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

View File

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers';
import { getMinimalMe } from '../../../support/helpers';
const MeQuery = getMinimalMe();
@ -63,6 +63,5 @@ describe('Create Content Block', () => {
});
});
// todo: another test
// edit existing content block

View File

@ -46,9 +46,9 @@ const modules = {
const slugs = {
'lohn-und-budget': getId(1),
'geld': getId(2),
'lerntipps': getId(3),
'random': getId(4),
geld: getId(2),
lerntipps: getId(3),
random: getId(4),
};
const getModuleBySlug = (slug) => {
@ -58,7 +58,7 @@ const getModuleBySlug = (slug) => {
return modules[id];
};
const moduleNodes = Object.values(modules).map(module => ({
const moduleNodes = Object.values(modules).map((module) => ({
node: module,
}));
console.log(moduleNodes);
@ -73,7 +73,7 @@ const getTopic = () => {
modules: {
edges: moduleNodes,
},
}
},
};
};
@ -116,15 +116,15 @@ describe('Current Module', () => {
AssignmentsQuery: {
assignments: [],
},
ModuleDetailsQuery: variables => {
ModuleDetailsQuery: (variables) => {
console.log('calling ModuleDetailsQuery', getModuleBySlug(variables.slug));
return {
module: getModuleBySlug(variables.slug)
module: getModuleBySlug(variables.slug),
};
},
TopicsQuery: {
topics: {
edges: topics.map(topic => ({node: topic})),
edges: topics.map((topic) => ({ node: topic })),
},
},
Topic: getTopic(),
@ -142,7 +142,7 @@ describe('Current Module', () => {
edges: [],
},
},
UpdateLastModule: ({input: {id}}) => {
UpdateLastModule: ({ input: { id } }) => {
const lastModule = modules[id];
return {
updateLastModule: {
@ -165,7 +165,9 @@ describe('Current Module', () => {
// module list exists, but does not have anything in it
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');
cy.get('[data-cy=module-title]').should('contain', 'Geld');

View File

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

View File

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers';
import { getMinimalMe } from '../../../support/helpers';
describe('Duplicate Content Block', () => {
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
// make this work for the test to work right.
const operations = {
MeQuery: getMinimalMe({isTeacher: true}),
MeQuery: getMinimalMe({ isTeacher: true }),
UpdateLastModule: {},
ModuleEditModeQuery: {
module: {
}
module: {},
},
AssignmentQuery: {
assignment: {
title: 'Ein Assignment',
assignment: 'Eine Beschreibung'
}
assignment: 'Eine Beschreibung',
},
},
ModuleDetailsQuery: {
module: {
@ -32,28 +31,27 @@ describe('Duplicate Content Block', () => {
{
type: 'text_block',
value: {
text: '<p>Asdf</p>'
}
text: '<p>Asdf</p>',
},
},
{
type: 'assignment',
value: {
title: 'Ein Auftrag',
assignment: 'Eine Beschreibung',
id: 'abcd'
}
}
]
}
]
}
]
}
}
id: 'abcd',
},
},
],
},
],
},
],
},
},
};
cy.mockGraphqlOps({
operations
operations,
});
cy.visit('/module/some-module');

View File

@ -1,6 +1,6 @@
import module from '../../../fixtures/module.minimal';
import {getMinimalMe} from '../../../support/helpers';
import {hasOperationName} from '../../../support/graphql';
import { getMinimalMe } from '../../../support/helpers';
import { hasOperationName } from '../../../support/graphql';
let snapshotTitle;
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
@ -90,9 +88,8 @@ const waitForNRequests = (n) => {
}
};
describe('Snapshot', () => {
const operations = isTeacher => ({
const operations = (isTeacher) => ({
operations: {
UpdateSnapshot: {
updateSnapshot: {
@ -130,11 +127,10 @@ describe('Snapshot', () => {
};
}
return result;
},
},
},
MeQuery: getMinimalMe({isTeacher}),
MeQuery: getMinimalMe({ isTeacher }),
ModuleDetailsQuery: {
module,
},
@ -146,7 +142,7 @@ describe('Snapshot', () => {
created: '2022-01-01',
creator: 'me',
shared: false,
mine: true
mine: true,
},
success: true,
},
@ -221,16 +217,20 @@ describe('Snapshot', () => {
it('Creates Snapshot', () => {
cy.mockGraphqlOps(operations(true));
cy.visit('module/miteinander-reden/snapshots');
cy.getByDataCy('snapshot-list').should('exist').within(() => {
cy.get('.snapshots__snapshot').should('have.length', 1);
});
cy.getByDataCy('snapshot-list')
.should('exist')
.within(() => {
cy.get('.snapshots__snapshot').should('have.length', 1);
});
cy.getByDataCy('back-link').click();
cy.getByDataCy('module-snapshots-button').click();
cy.getByDataCy('create-snapshot-button').click();
cy.getByDataCy('show-all-snapshots-button').click();
cy.getByDataCy('snapshot-list').should('exist').within(() => {
cy.get('.snapshots__snapshot').should('have.length', 2);
});
cy.getByDataCy('snapshot-list')
.should('exist')
.within(() => {
cy.get('.snapshots__snapshot').should('have.length', 2);
});
waitForNRequests(7);
});
@ -289,6 +289,5 @@ describe('Snapshot', () => {
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';
const modules = {
'lohn-und-budget': {
'objectiveGroups': {
'edges': [
objectiveGroups: {
edges: [
{
'node': {
'title': 'LANGUAGE_COMMUNICATION',
'objectives': {
'edges': [
node: {
title: 'LANGUAGE_COMMUNICATION',
objectives: {
edges: [
{
'node': {
'text': 'i-am-an-objective',
'hiddenFor': {
'edges': [],
node: {
text: 'i-am-an-objective',
hiddenFor: {
edges: [],
},
},
},
@ -69,7 +69,7 @@ const operations = {
describe('Objective Visibility', () => {
beforeEach(() => {
cy.server();
cy.task('getSchema').then(schema => {
cy.task('getSchema').then((schema) => {
cy.mockGraphql({
schema,
// endpoint: '/api/graphql'

View File

@ -1,7 +1,7 @@
import {getMinimalMe} from '../../../support/helpers';
import { getMinimalMe } from '../../../support/helpers';
describe('New project', () => {
const MeQuery = getMinimalMe({isTeacher: false});
const MeQuery = getMinimalMe({ isTeacher: false });
const schoolClass = MeQuery.me.selectedClass;
const operations = {
@ -27,9 +27,9 @@ describe('New project', () => {
],
},
MeQuery,
AddProject: variables => ({
AddProject: (variables) => ({
addProject: {
project: Object.assign({}, variables.input.project, {schoolClass}),
project: Object.assign({}, variables.input.project, { schoolClass }),
errors: null,
__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 createdLater = '2021-06-01T12:49:00+00:00';
@ -69,7 +69,7 @@ describe('Project Page', () => {
success: true,
},
},
AddProjectEntry: variables => {
AddProjectEntry: (variables) => {
const projectEntry = Object.assign({}, variables.input.projectEntry, {
created: createdLater,
});
@ -81,7 +81,7 @@ describe('Project Page', () => {
},
};
},
UpdateProjectEntry: variables => ({
UpdateProjectEntry: (variables) => ({
updateProjectEntry: {
projectEntry: variables.input.projectEntry,
errors: null,
@ -116,9 +116,11 @@ describe('Project Page', () => {
it('has the correct layout', () => {
cy.visit('/portfolio/groot');
cy.getByDataCy('project-entry').eq(0).within(() => {
cy.getByDataCy('project-entry-date').should('contain', '1. Juni 2021');
});
cy.getByDataCy('project-entry')
.eq(0)
.within(() => {
cy.getByDataCy('project-entry-date').should('contain', '1. Juni 2021');
});
});
it('uses the menu', () => {
@ -248,12 +250,11 @@ describe('Project Page', () => {
});
it('should not display the entry actions on mobile', () => {
cy.viewport('iphone-8') ;
cy.viewport('iphone-8');
cy.visit('/portfolio/groot');
cy.getByDataCy('project-entry').should('exist');
cy.getByDataCy('project-entry-more').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', () => {
const MeQuery = getMinimalMe({});
beforeEach(() => {
cy.setup();
cy.intercept('GET', '/avatars/**', {fixture: 'maxim.png'});
cy.intercept('GET', '/avatars/**', { fixture: 'maxim.png' });
});
it('displays portfolio onboarding', () => {
@ -43,7 +43,6 @@ describe('Projects page', () => {
entriesCount: 0,
entries: {
nodes: [],
},
},
],
@ -82,8 +81,10 @@ describe('Projects page', () => {
},
],
},
AddProject: variables => {
const {input: {project}} = variables;
AddProject: (variables) => {
const {
input: { project },
} = variables;
return {
addProject: {
errors: null,

View File

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

View File

@ -33,14 +33,14 @@ const module = {
const myText = 'submission text';
const getOperations = ({final, readOnly, classReadOnly = false}) => ({
const getOperations = ({ final, readOnly, classReadOnly = false }) => ({
MeQuery: {
me: {
readOnly,
selectedClass: {
id: 'selectedClassId',
readOnly: classReadOnly
}
readOnly: classReadOnly,
},
},
},
ModuleDetailsQuery: {
@ -53,7 +53,7 @@ const getOperations = ({final, readOnly, classReadOnly = false}) => ({
text: myText,
final,
document: '',
submissionFeedback: null
submissionFeedback: null,
},
},
},
@ -62,11 +62,11 @@ const getOperations = ({final, readOnly, classReadOnly = false}) => ({
describe('Assignments read-only - Student', () => {
beforeEach(() => {
cy.setup();
});
});
it('can edit and turn in', () => {
cy.mockGraphqlOps({
operations: getOperations({final: false, readOnly: false})
operations: getOperations({ final: false, readOnly: false }),
});
cy.visit('module/module-with-assignment');
@ -82,7 +82,7 @@ describe('Assignments read-only - Student', () => {
// todo: very flaky test, fix and re-enable
it.skip('can not edit or turn in', () => {
cy.mockGraphqlOps({
operations: getOperations({final: false, readOnly: true})
operations: getOperations({ final: false, readOnly: true }),
});
cy.visit('module/module-with-assignment');
@ -92,7 +92,7 @@ describe('Assignments read-only - Student', () => {
it('can revoke turn in', () => {
cy.mockGraphqlOps({
operations: getOperations({final: true, readOnly: false})
operations: getOperations({ final: true, readOnly: false }),
});
cy.visit('module/module-with-assignment');
@ -102,7 +102,7 @@ describe('Assignments read-only - Student', () => {
it('can not revoke turn in', () => {
cy.mockGraphqlOps({
operations: getOperations({final: true, readOnly: true})
operations: getOperations({ final: true, readOnly: true }),
});
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', () => {
cy.mockGraphqlOps({
operations: getOperations({final: false, readOnly: false, classReadOnly: true})
operations: getOperations({ final: false, readOnly: false, classReadOnly: true }),
});
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}) => ({
MeQuery: getMinimalMe({readOnly, classReadOnly}),
const getOperations = ({ readOnly, classReadOnly = false }) => ({
MeQuery: getMinimalMe({ readOnly, classReadOnly }),
NewsTeasers: {
newsTeasers: {
edges: [],
@ -16,7 +16,7 @@ describe('Read Only Banner', () => {
it('is not shown', () => {
cy.mockGraphqlOps({
operations: getOperations({readOnly: false}),
operations: getOperations({ readOnly: false }),
});
cy.visit('/');
@ -27,7 +27,7 @@ describe('Read Only Banner', () => {
it('is shown for expired license', () => {
cy.mockGraphqlOps({
operations: getOperations({readOnly: true}),
operations: getOperations({ readOnly: true }),
});
cy.visit('/');
@ -35,16 +35,13 @@ describe('Read Only Banner', () => {
cy.getByDataCy('start-page-heading').should('exist');
cy.getByDataCy('read-only-banner').should('exist').should('contain', 'Lizenz');
cy.getByDataCy('license-activation-link')
.should('exist')
.should('contain', 'Neuen Lizenzcode eingeben')
.click();
cy.getByDataCy('license-activation-link').should('exist').should('contain', 'Neuen Lizenzcode eingeben').click();
cy.url().should('contain', 'license-activation');
});
it('is shown for inactive school class', () => {
cy.mockGraphqlOps({
operations: getOperations({readOnly: false, classReadOnly: true}),
operations: getOperations({ readOnly: false, classReadOnly: true }),
});
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 MeQuery = getMinimalMe({readOnly, classReadOnly});
const MeQuery = getMinimalMe({ readOnly, classReadOnly });
const me = MeQuery.me;
return {
MeQuery,
MySchoolClassQuery: {
me: {
...me,
id: 'meId',
selectedClass: {
...me.selectedClass,
members: [
{
id: 'meId',
firstName: 'Helge',
lastName: 'Schneider',
isTeacher: true,
isMe: true,
active: true
},
{
id: 'notMeId',
firstName: 'Otto',
lastName: 'Waalkes',
isTeacher: false,
isMe: false,
active: true
},
{
id: 'alsoNotMeId',
firstName: 'Kaya',
lastName: 'Yanar',
isTeacher: false,
isMe: false,
active: false
}
]
}
MeQuery,
MySchoolClassQuery: {
me: {
...me,
id: 'meId',
selectedClass: {
...me.selectedClass,
members: [
{
id: 'meId',
firstName: 'Helge',
lastName: 'Schneider',
isTeacher: true,
isMe: true,
active: true,
},
{
id: 'notMeId',
firstName: 'Otto',
lastName: 'Waalkes',
isTeacher: false,
isMe: false,
active: true,
},
{
id: 'alsoNotMeId',
firstName: 'Kaya',
lastName: 'Yanar',
isTeacher: false,
isMe: false,
active: false,
},
],
},
},
},
},
AddRemoveMember: {
addRemoveMember: {
success: true
}
}
};
AddRemoveMember: {
addRemoveMember: {
success: true,
},
},
};
};
describe('Leave School Class', () => {

View File

@ -1,27 +1,27 @@
import minimalModule from '../../../fixtures/module.minimal';
import {getMinimalMe} from '../../../support/helpers';
import { getMinimalMe } from '../../../support/helpers';
const getOperations = ({readOnly, classReadOnly = false}) => ({
MeQuery: getMinimalMe({readOnly, classReadOnly}),
const getOperations = ({ readOnly, classReadOnly = false }) => ({
MeQuery: getMinimalMe({ readOnly, classReadOnly }),
ModuleDetailsQuery: {
module: {
...minimalModule,
},
},
UpdateLastModule: {}
UpdateLastModule: {},
});
const moduleNavigationTest = ({readOnly, classReadOnly = false, displayMenu}) => {
const moduleNavigationTest = ({ readOnly, classReadOnly = false, displayMenu }) => {
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-teacher-menu').should(shouldMenuExist);
cy.getByDataCy('module-navigation').should('exist');
cy.getByDataCy('module-teacher-menu').should(shouldMenuExist);
};
describe('Module Navigation - read only', () => {
@ -30,14 +30,14 @@ describe('Module Navigation - read only', () => {
});
it('is shown', () => {
moduleNavigationTest({readOnly: false, displayMenu: true});
moduleNavigationTest({ readOnly: false, displayMenu: true });
});
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', () => {
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}) => ({
MeQuery: getMinimalMe({readOnly}),
const getOperations = ({ readOnly }) => ({
MeQuery: getMinimalMe({ readOnly }),
NewsTeasers: {
newsTeasers: [
{},
{},
{},
]
}
newsTeasers: [{}, {}, {}],
},
});
describe('Read Only News', () => {
@ -18,7 +14,7 @@ describe('Read Only News', () => {
it('displays the news', () => {
cy.mockGraphqlOps({
operations: getOperations({readOnly: false}),
operations: getOperations({ readOnly: false }),
});
cy.visit('/');
@ -30,7 +26,7 @@ describe('Read Only News', () => {
});
it('does not display the news', () => {
cy.mockGraphqlOps({
operations: getOperations({readOnly: true}),
operations: getOperations({ readOnly: true }),
});
cy.visit('/');

View File

@ -1,7 +1,7 @@
import {getMinimalMe} from '../../../support/helpers';
import { getMinimalMe } from '../../../support/helpers';
const getOperations = ({readOnly = false, classReadOnly = false}) => ({
MeQuery: getMinimalMe({readOnly, classReadOnly}),
const getOperations = ({ readOnly = false, classReadOnly = false }) => ({
MeQuery: getMinimalMe({ readOnly, classReadOnly }),
ProjectsQuery: {
projects: [
{
@ -22,7 +22,7 @@ describe('Read Only Portfolio', () => {
});
it('Can create and edit project', () => {
cy.mockGraphqlOps({operations: getOperations({readOnly: false})});
cy.mockGraphqlOps({ operations: getOperations({ readOnly: false }) });
cy.visit('/portfolio');
cy.getByDataCy('project-list').should('exist');
@ -32,7 +32,7 @@ describe('Read Only Portfolio', () => {
});
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.getByDataCy('project-list').should('exist');
@ -42,7 +42,7 @@ describe('Read Only Portfolio', () => {
});
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.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}) => ({
MeQuery: getMinimalMe({readOnly, classReadOnly}),
const getOperations = ({ readOnly = false, classReadOnly = false }) => ({
MeQuery: getMinimalMe({ readOnly, classReadOnly }),
ProjectQuery: {
project: {
id: 'projectId',
@ -11,15 +11,13 @@ const getOperations = ({readOnly = false, classReadOnly = false}) => ({
id: btoa('PrivateUserNode:1'),
},
entriesCount: 1,
entries: [
{}
]
entries: [{}],
},
},
});
const testProject = (readOnly, shouldActionsExist, classReadOnly = false) => {
cy.mockGraphqlOps({operations: getOperations({readOnly, classReadOnly})});
cy.mockGraphqlOps({ operations: getOperations({ readOnly, classReadOnly }) });
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 slug = 'some-room';
const getOperations = ({readOnly, classReadOnly}) => {
const {me} = getMinimalMe({readOnly, classReadOnly, isTeacher: true});
const getOperations = ({ readOnly, classReadOnly }) => {
const { me } = getMinimalMe({ readOnly, classReadOnly, isTeacher: true });
return {
MeQuery: {
me: {
@ -51,8 +51,8 @@ const getOperations = ({readOnly, classReadOnly}) => {
};
};
const checkRoomReadOnly = ({editable, readOnly, classReadOnly = false}) => {
const operations = getOperations({readOnly, classReadOnly});
const checkRoomReadOnly = ({ editable, readOnly, classReadOnly = false }) => {
const operations = getOperations({ readOnly, classReadOnly });
cy.mockGraphqlOps({
operations,
@ -71,14 +71,14 @@ describe('Room Team Management - Read only', () => {
});
it('can edit room', () => {
checkRoomReadOnly({editable: true, readOnly: false});
checkRoomReadOnly({ editable: true, readOnly: false });
});
it('can not edit room', () => {
checkRoomReadOnly({editable: false, readOnly: true});
checkRoomReadOnly({ editable: false, readOnly: true });
});
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', () => {
const SELECTED_CLASS_ID = 'selectedClassId';
const getOperations = ({readOnly, classReadOnly}) => ({
const getOperations = ({ readOnly, classReadOnly }) => ({
MeQuery: {
me: {
readOnly,
@ -13,23 +13,25 @@ describe('Room Team Management - Read only', () => {
},
},
RoomsQuery: {
rooms: [{
id: '',
slug: '',
title: 'some room',
entryCount: 3,
appearance: 'red',
description: 'some description',
schoolClass: {
id: SELECTED_CLASS_ID,
name: 'bla',
rooms: [
{
id: '',
slug: '',
title: 'some room',
entryCount: 3,
appearance: 'red',
description: 'some description',
schoolClass: {
id: SELECTED_CLASS_ID,
name: 'bla',
},
},
}],
],
},
});
const checkRoomsReadOnly = ({editable, readOnly, classReadOnly = false}) => {
const operations = getOperations({readOnly, classReadOnly});
const checkRoomsReadOnly = ({ editable, readOnly, classReadOnly = false }) => {
const operations = getOperations({ readOnly, classReadOnly });
cy.mockGraphqlOps({
operations,
@ -48,14 +50,14 @@ describe('Room Team Management - Read only', () => {
});
it('can edit room', () => {
checkRoomsReadOnly({editable: true, readOnly: false});
checkRoomsReadOnly({ editable: true, readOnly: false });
});
it('can not edit room', () => {
checkRoomsReadOnly({editable: false, readOnly: true});
checkRoomsReadOnly({ editable: false, readOnly: true });
});
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 getOperations = ({readOnly}) => ({
const getOperations = ({ readOnly }) => ({
MeQuery: {
me: {
readOnly,
@ -33,7 +33,7 @@ const getOperations = ({readOnly}) => ({
const checkSchoolClassTeamReadOnly = (readOnly) => {
cy.mockGraphqlOps({
operations: getOperations({readOnly}),
operations: getOperations({ readOnly }),
});
const exist = readOnly ? 'not.exist' : 'exist';
@ -52,7 +52,7 @@ describe('School Class and Team Management - Read only', () => {
beforeEach(() => {
cy.fakeLogin('rachel.green', 'test');
cy.server();
cy.task('getSchema').then(schema => {
cy.task('getSchema').then((schema) => {
cy.mockGraphql({
schema,
mocks,

View File

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers';
import { getMinimalMe } from '../../../support/helpers';
describe('Article page', () => {
const slug = 'this-article-has-a-slug';
@ -7,17 +7,20 @@ describe('Article page', () => {
id: 'room-entry-id',
title: 'Some Room Entry, yay!',
comments: [],
contents: [{
type: 'text_block',
value: {
text: 'Ein Text',
contents: [
{
type: 'text_block',
value: {
text: 'Ein Text',
},
},
}, {
type: 'subtitle',
value: {
text: 'Ein Untertitel'
}
}],
{
type: 'subtitle',
value: {
text: 'Ein Untertitel',
},
},
],
};
const operations = {
@ -25,7 +28,7 @@ describe('Article page', () => {
RoomEntryQuery: {
roomEntry,
},
AddComment({input}) {
AddComment({ input }) {
return {
addComment: {
success: true,
@ -67,7 +70,9 @@ describe('Article page', () => {
cy.getByDataCy('comment-textarea').type(commentText);
cy.getByDataCy('emoji-button').should('have.length', 9).first().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', () => {

View File

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers';
import { getMinimalMe } from '../../../support/helpers';
describe('The Room Page (Teacher)', () => {
const MeQuery = getMinimalMe();
@ -171,7 +171,7 @@ describe('The Room Page (Teacher)', () => {
});
it('changes class while on room page', () => {
const {me} = MeQuery;
const { me } = MeQuery;
const otherClass = {
id: btoa('SchoolClassNode:34'),
name: 'Other Class',
@ -223,12 +223,12 @@ describe('The Room Page (Teacher)', () => {
describe('The Room Page (student)', () => {
const slug = 'ein-historisches-festival';
const MeQuery = getMinimalMe({isTeacher: false});
const {me} = MeQuery;
const MeQuery = getMinimalMe({ isTeacher: false });
const { me } = MeQuery;
const id = atob(me.id).split(':')[1];
const authorId = btoa(`PublicUserNode:${id}`);
const entrySlug = 'entry-slug';
const {selectedClass} = me;
const { selectedClass } = me;
const roomEntry = {
id: 'entry-id',
slug: entrySlug,
@ -256,9 +256,11 @@ describe('The Room Page (student)', () => {
schoolClass: selectedClass,
restricted: false,
roomEntries: {
edges: [{
node: roomEntry,
}],
edges: [
{
node: roomEntry,
},
],
},
};
@ -272,7 +274,7 @@ describe('The Room Page (student)', () => {
it('room actions should not exist for student', () => {
const operations = {
MeQuery: getMinimalMe({isTeacher: false}),
MeQuery: getMinimalMe({ isTeacher: false }),
RoomEntriesQuery,
};
@ -286,7 +288,7 @@ describe('The Room Page (student)', () => {
});
it('creates a room entry', () => {
const MeQuery = getMinimalMe({isTeacher: false});
const MeQuery = getMinimalMe({ isTeacher: false });
const room = {
id: 'some-room',
roomEntries: {
@ -367,7 +369,6 @@ describe('The Room Page (student)', () => {
cy.getByDataCy('delete-room-entry').should('not.exist');
cy.getByDataCy('modal-save-button').click();
cy.getByDataCy('room-entry').should('have.length', 0);
});
it('shows room entries with comment count', () => {
@ -380,9 +381,11 @@ describe('The Room Page (student)', () => {
});
cy.visit(`/room/${slug}`);
cy.getByDataCy('room-entry').should('have.length', 1).within(() => {
cy.getByDataCy('entry-count').should('contain.text', '2');
});
cy.getByDataCy('room-entry')
.should('have.length', 1)
.within(() => {
cy.getByDataCy('entry-count').should('contain.text', '2');
});
});
it('does not show actions on mobile', () => {

View File

@ -1,15 +1,17 @@
import {getMinimalMe} from '../../../support/helpers';
import {SELECTED_CLASS_ID_ENCODED} from '../../../fixtures/mocks';
import { getMinimalMe } from '../../../support/helpers';
import { SELECTED_CLASS_ID_ENCODED } from '../../../fixtures/mocks';
describe('The Rooms Page', () => {
const getOperations = (isTeacher) => ({
MeQuery: getMinimalMe({isTeacher}),
MeQuery: getMinimalMe({ isTeacher }),
RoomsQuery: {
rooms: [{
schoolClass: {
id: SELECTED_CLASS_ID_ENCODED,
rooms: [
{
schoolClass: {
id: SELECTED_CLASS_ID_ENCODED,
},
},
}],
],
},
});
@ -77,7 +79,7 @@ describe('The Rooms Page', () => {
});
it('adds a room as teacher', () => {
const MeQuery = getMinimalMe({isTeacher: true});
const MeQuery = getMinimalMe({ isTeacher: true });
const getRoom = (title, appearance, description) => {
let id = title.toLowerCase().replace(' ', '-');
return {
@ -87,21 +89,23 @@ describe('The Rooms Page', () => {
entryCount: 3,
appearance: appearance,
description: description,
schoolClass: MeQuery.me.selectedClass
schoolClass: MeQuery.me.selectedClass,
};
};
let rooms = [
getRoom('First Room', 'blue', 'Some description')
];
let rooms = [getRoom('First Room', 'blue', 'Some description')];
const operations = {
MeQuery,
RoomsQuery() {
return {
rooms
rooms,
};
},
AddRoom({input: {room: {title, appearance, description}}}) {
AddRoom({
input: {
room: { title, appearance, description },
},
}) {
const room = getRoom(title, appearance, description);
rooms.push(room);
return {

View File

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

View File

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

View File

@ -1,5 +1,5 @@
describe('The Home Page', () => {
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', () => {
beforeEach(() => {
@ -22,7 +22,7 @@ describe('Onboarding', () => {
},
};
},
NewsTeasers: {}
NewsTeasers: {},
},
});
@ -65,8 +65,8 @@ describe('Onboarding', () => {
cy.mockGraphqlOps({
operations: {
MeQuery: {
me: {}
}
me: {},
},
},
});

View File

@ -1,4 +1,4 @@
import {getMinimalMe} from '../../../support/helpers';
import { getMinimalMe } from '../../../support/helpers';
describe('Sidebar', () => {
beforeEach(() => {
@ -6,7 +6,7 @@ describe('Sidebar', () => {
});
it('should open sidebar and stay open', () => {
const {me} = getMinimalMe({});
const { me } = getMinimalMe({});
const operations = {
MeQuery: {
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');
@ -9,7 +9,7 @@ describe('New student', () => {
// todo: unskip me
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 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 {getMinimalMe} = require('../../../support/helpers');
const { getMinimalMe } = require('../../../support/helpers');
const MeQuery = getMinimalMe({});
const {me: teacher} = MeQuery;
const { me: teacher } = MeQuery;
const members = [
{
@ -100,8 +100,7 @@ describe('School Class Management', () => {
cy.get('[data-cy=class-selection]').click();
cy.get('[data-cy=class-selection-entry]').should('have.length', 2);
})
;
});
it('should leave and re-join class', () => {
cy.mockGraphqlOps({
@ -168,7 +167,7 @@ describe('Teacher Class Management', () => {
it('changes class name', () => {
let className = 'Gotta have class';
const {me: teacher} = getMinimalMe({});
const { me: teacher } = getMinimalMe({});
let localMe = {
me: teacher,
@ -204,10 +203,7 @@ describe('Teacher Class Management', () => {
it('removes student, then leaves class, then rejoins', () => {
const myId = btoa('PrivateUserNode:1');
const memberId = btoa('GroupMemberNode:1');
let classMembers = [
{...teacher, id: myId, isMe: true, isTeacher: true},
...members,
];
let classMembers = [{ ...teacher, id: myId, isMe: true, isTeacher: true }, ...members];
let me = () => ({
...teacher,
id: memberId,
@ -255,9 +251,7 @@ describe('Teacher Class Management', () => {
const name = 'Hill Valley';
let selectedClass = teacher.selectedClass;
const schoolClasses = [
teacher.selectedClass,
];
const schoolClasses = [teacher.selectedClass];
const me = () => ({
...teacher,
@ -265,7 +259,6 @@ describe('Teacher Class Management', () => {
schoolClasses,
});
cy.mockGraphqlOps({
operations: {
MeQuery: () => ({
@ -290,14 +283,13 @@ describe('Teacher Class Management', () => {
req.reply({
data: {
createSchoolClass: {
result: schoolClass
}
}
result: schoolClass,
},
},
});
}
});
cy.visit('/me/my-class');
cy.get('h1').should('exist');
@ -332,9 +324,7 @@ describe('Teacher Class Management', () => {
let selectedClass = teacher.selectedClass;
selectedClass.name = 'Some stupid class';
const schoolClasses = [
teacher.selectedClass,
];
const schoolClasses = [teacher.selectedClass];
const me = () => ({
...teacher,
@ -365,10 +355,10 @@ describe('Teacher Class Management', () => {
createSchoolClass: {
result: {
__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.getByDataCy('join-form-input-error').should('contain', 'Dieser Name wird bereits verwendet.');
});
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,7 +32,7 @@ const getInstrumentId = () => instrumentIdGenerator.next().value;
export default {
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',
SnapshotNode: () => ({
chapters: [],
@ -44,7 +44,7 @@ export default {
id: getChapterId(),
title: 'chapter-title',
description: 'chapter-description',
bookmark: null
bookmark: null,
}),
ContentBlockNode: () => ({
contents: [],
@ -90,7 +90,7 @@ export default {
assignments: [],
objectiveGroups: [],
id: getModuleId(),
bookmark: null
bookmark: null,
}),
TopicNode: () => ({
modules: [],
@ -113,6 +113,6 @@ export default {
title: 'instrument-title',
slug: 'instrument-slug',
id: getInstrumentId(),
bookmarks: null
})
bookmarks: null,
}),
};

View File

@ -1,31 +1,31 @@
{
"id": "TW9kdWxlTm9kZTozMQ==",
"title": "Geld",
"metaTitle": "Modul 2",
"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 ",
"slug": "geld",
"heroImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==",
"solutionsEnabled": false,
"bookmark": null,
"__typename": "ModuleNode",
"assignments": {
"edges": [],
"__typename": "AssignmentNodeConnection"
},
"objectiveGroups": {
"edges": [],
"__typename": "ObjectiveGroupNodeConnection"
},
"chapters": {
"edges": [
{
"node": {
"id": "Q2hhcHRlck5vZGU6MzI=",
"title": "2.1 Eine Welt ohne Geld?",
"description": "",
"bookmark": null,
"contentBlocks": {
"id": "TW9kdWxlTm9kZTozMQ==",
"title": "Geld",
"metaTitle": "Modul 2",
"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 ",
"slug": "geld",
"heroImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==",
"solutionsEnabled": false,
"bookmark": null,
"__typename": "ModuleNode",
"assignments": {
"edges": [],
"__typename": "AssignmentNodeConnection"
},
"objectiveGroups": {
"edges": [],
"__typename": "ObjectiveGroupNodeConnection"
},
"chapters": {
"edges": [
{
"node": {
"id": "Q2hhcHRlck5vZGU6MzI=",
"title": "2.1 Eine Welt ohne Geld?",
"description": "",
"bookmark": null,
"contentBlocks": {
"edges": [
{
"node": {
@ -72,11 +72,11 @@
],
"__typename": "ContentBlockNodeConnection"
},
"__typename": "ChapterNode"
},
"__typename": "ChapterNodeEdge"
}
],
"__typename": "ChapterNodeConnection"
}
"__typename": "ChapterNode"
},
"__typename": "ChapterNodeEdge"
}
],
"__typename": "ChapterNodeConnection"
}
}

View File

@ -11,10 +11,10 @@ export default {
topic: {
title: 'A Topic Mock Title',
description: 'A Topic Mock Description',
slug: 'a-topic-slug'
slug: 'a-topic-slug',
},
slug: 'a-module-slug',
solutionsEnabled: false,
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
// the project's config changing)
require("tsconfig-paths").register();
require('tsconfig-paths').register();
const {readFileSync} = require('fs');
const {resolve} = require('path');
const { readFileSync } = require('fs');
const { resolve } = require('path');
// import webpackPreprocessor from '@cypress/webpack-preprocessor';
module.exports = (on) => {
@ -21,10 +21,7 @@ module.exports = (on) => {
// `config` is the resolved Cypress config
on('task', {
getSchema() {
return readFileSync(
resolve(__dirname, '../../../server/schema.graphql'),
'utf8'
);
}
return readFileSync(resolve(__dirname, '../../../server/schema.graphql'), 'utf8');
},
});
};

View File

@ -25,7 +25,7 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
import {makeExecutableSchema} from "@graphql-tools/schema";
import { makeExecutableSchema } from '@graphql-tools/schema';
declare global {
namespace Cypress {
@ -37,7 +37,7 @@ declare global {
* @example
* 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
@ -45,19 +45,19 @@ declare global {
* @example
* 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
// import 'cypress-graphql-mock';
import mocks from '../fixtures/mocks';
import {addMocksToSchema} from "@graphql-tools/mock";
import {graphql, GraphQLError} from "graphql";
import { addMocksToSchema } from '@graphql-tools/mock';
import { graphql, GraphQLError } from 'graphql';
Cypress.Commands.add('apolloLogin', (username, password) => {
const payload = {
'operationName': 'BetaLogin',
'variables': {
'input': {
'usernameInput': username,
'passwordInput': password,
operationName: 'BetaLogin',
variables: {
input: {
usernameInput: username,
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({
@ -104,7 +105,6 @@ Cypress.Commands.add('login', (username, password, visitLogin = false) => {
cy.get('[data-cy=login-button]').click();
});
Cypress.Commands.add('getByDataCy', (selector: string) => {
return cy.get(`[data-cy=${selector}]`);
});
@ -141,31 +141,31 @@ Cypress.Commands.add('setup', () => {
const typenameResolver = {
__resolveType(obj, context, info) {
return obj.__typename;
}
},
};
Cypress.Commands.add('mockGraphql', (options?: any) => {
cy.task('getSchema').then(( schemaString: string ) => {
cy.task('getSchema').then((schemaString: string) => {
const resolverMap = {
DeleteSnapshotResult: typenameResolver,
UpdateSnapshotResult: typenameResolver
UpdateSnapshotResult: typenameResolver,
};
const schema = makeExecutableSchema({
typeDefs: schemaString,
resolvers: resolverMap
resolvers: resolverMap,
});
const schemaWithMocks = addMocksToSchema({
schema,
mocks,
preserveResolvers: true
preserveResolvers: true,
});
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
cy.intercept('POST', '/api/graphql', (req) => {
const {operationName, query, variables} = req.body;
const { operationName, query, variables } = req.body;
const rootValue = getRootValue(currentOperations, operationName, variables);
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
rootValue instanceof GraphQLError ||
rootValue.constructor === GraphQLError ||
rootValue.constructor.name === "GraphQLError"
rootValue.constructor.name === 'GraphQLError'
) {
return req.reply(
{
body: {
data: {},
errors: [rootValue]
}
}
);
return req.reply({
body: {
data: {},
errors: [rootValue],
},
});
}
graphql({
@ -194,26 +192,28 @@ Cypress.Commands.add('mockGraphql', (options?: any) => {
source: query,
variableValues: variables,
operationName,
rootValue
}).then(result => {
req.reply({
...result,
});
}, e => {
console.error(e);
});
rootValue,
}).then(
(result) => {
req.reply({
...result,
});
},
(e) => {
console.error(e);
}
);
}).as('graphqlRequest');
cy.wrap({
setOperations: (options: any) => {
currentOperations = {
...currentOperations,
...options.operations
...options.operations,
};
}
},
}).as('mockGraphqlOps');
});
});
Cypress.Commands.add('mockGraphqlOps', (options) => {

View File

@ -5,7 +5,7 @@
// const schemaString = '';
interface GraphQLBody {
operationName: string
operationName: string;
}
interface CypressAliasRequest extends Request {
@ -23,7 +23,7 @@ const isGraphQLBody = (body: any): body is GraphQLBody => {
};
export const hasOperationName = (req: Request, operationName: string) => {
const {body} = req;
const { body } = req;
return isGraphQLBody(body) && body.operationName === operationName;
};

View File

@ -1,6 +1,6 @@
// 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 = {
name: 'Selected Class',
id: btoa('SchoolClassNode:987'),
@ -18,9 +18,9 @@ export const getMinimalMe = ({readOnly = false, classReadOnly = false, isTeacher
};
const getSchoolClassNode = (id, schoolClassName) => ({
'id': btoa(`SchoolClassNode:${id}`),
'name': schoolClassName,
'__typename': 'SchoolClassNode',
id: btoa(`SchoolClassNode:${id}`),
name: schoolClassName,
__typename: 'SchoolClassNode',
});
export const assertStartPage = (onboarding) => {
@ -31,7 +31,7 @@ export const assertStartPage = (onboarding) => {
}
};
export const getMe = ({schoolClasses, teacher}) => {
export const getMe = ({ schoolClasses, teacher }) => {
let schoolClassNodes;
if (schoolClasses) {
schoolClassNodes = schoolClasses.map((schoolClass, i) => getSchoolClassNode(i, schoolClass));
@ -40,35 +40,35 @@ export const getMe = ({schoolClasses, teacher}) => {
}
return {
'me': {
'id': 'VXNlck5vZGU6NQ==',
'pk': 5,
'username': 'rachel.green',
'email': 'rachel.green@skillbox.example',
'expiryDate': '3596153600',
'firstName': 'Rachel',
'lastName': 'Green',
'avatarUrl': '',
'isTeacher': teacher,
me: {
id: 'VXNlck5vZGU6NQ==',
pk: 5,
username: 'rachel.green',
email: 'rachel.green@skillbox.example',
expiryDate: '3596153600',
firstName: 'Rachel',
lastName: 'Green',
avatarUrl: '',
isTeacher: teacher,
readOnly: false,
'lastModule': {
'id': 'TW9kdWxlTm9kZToxNw==',
'slug': 'lohn-und-budget',
'__typename': 'ModuleNode',
lastModule: {
id: 'TW9kdWxlTm9kZToxNw==',
slug: 'lohn-und-budget',
__typename: 'ModuleNode',
},
'selectedClass': {
'id': 'U2Nob29sQ2xhc3NOb2RlOjI=',
'__typename': 'SchoolClassNode',
selectedClass: {
id: 'U2Nob29sQ2xhc3NOb2RlOjI=',
__typename: 'SchoolClassNode',
},
'lastTopic': {
'id': 'VG9waWNOb2RlOjU=',
'slug': 'geld-und-kauf',
'__typename': 'TopicNode',
lastTopic: {
id: 'VG9waWNOb2RlOjU=',
slug: 'geld-und-kauf',
__typename: 'TopicNode',
},
'schoolClasses': schoolClassNodes,
'__typename': 'UserNode',
'onboardingVisited': true,
'permissions': teacher ? ['users.can_manage_school_class_content'] : [],
schoolClasses: schoolClassNodes,
__typename: 'UserNode',
onboardingVisited: true,
permissions: teacher ? ['users.can_manage_school_class_content'] : [],
},
};
};
@ -76,262 +76,270 @@ export const getMe = ({schoolClasses, teacher}) => {
export const getModules = () => {
return {
'lohn-und-budget': {
'id': 'TW9kdWxlTm9kZToyOA==',
'title': 'Lohn und Budget',
'metaTitle': 'Modul 1',
'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 ',
'slug': 'lohn-und-budget',
'heroImage': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
'solutionsEnabled': false,
'bookmark': {
'note': null,
'__typename': 'ModuleBookmarkNode',
id: 'TW9kdWxlTm9kZToyOA==',
title: 'Lohn und Budget',
metaTitle: 'Modul 1',
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 ',
slug: 'lohn-und-budget',
heroImage:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
solutionsEnabled: false,
bookmark: {
note: null,
__typename: 'ModuleBookmarkNode',
},
'__typename': 'ModuleNode',
'assignments': {
'edges': [
__typename: 'ModuleNode',
assignments: {
edges: [
{
'node': {
'id': 'QXNzaWdubWVudE5vZGU6MQ==',
'title': 'Ein Auftragstitel',
'assignment': 'Ein Auftrag',
'solution': null,
'submission': {
'id': 'U3R1ZGVudFN1Ym1pc3Npb25Ob2RlOjE=',
'text': 'Hir ist ein Feler gewesen',
'final': false,
'document': '',
'submissionFeedback': {
'id': 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox',
'text': '🙂😐🤬👍🤢🤢🤢🤢😮🤗',
'teacher': {
'firstName': 'Nico',
'lastName': 'Zickgraf',
'__typename': 'UserNode',
node: {
id: 'QXNzaWdubWVudE5vZGU6MQ==',
title: 'Ein Auftragstitel',
assignment: 'Ein Auftrag',
solution: null,
submission: {
id: 'U3R1ZGVudFN1Ym1pc3Npb25Ob2RlOjE=',
text: 'Hir ist ein Feler gewesen',
final: false,
document: '',
submissionFeedback: {
id: 'U3VibWlzc2lvbkZlZWRiYWNrTm9kZTox',
text: '🙂😐🤬👍🤢🤢🤢🤢😮🤗',
teacher: {
firstName: 'Nico',
lastName: 'Zickgraf',
__typename: 'UserNode',
},
'__typename': 'SubmissionFeedbackNode',
__typename: 'SubmissionFeedbackNode',
},
'__typename': 'StudentSubmissionNode',
__typename: 'StudentSubmissionNode',
},
'__typename': 'AssignmentNode',
__typename: 'AssignmentNode',
},
'__typename': 'AssignmentNodeEdge',
__typename: 'AssignmentNodeEdge',
},
],
'__typename': 'AssignmentNodeConnection',
__typename: 'AssignmentNodeConnection',
},
'objectiveGroups': {
'edges': [],
'__typename': 'ObjectiveGroupNodeConnection',
objectiveGroups: {
edges: [],
__typename: 'ObjectiveGroupNodeConnection',
},
'chapters': {
'edges': [
chapters: {
edges: [
{
'node': {
'id': 'Q2hhcHRlck5vZGU6MTg=',
'title': '1.1 Lehrbeginn',
'description': 'Wie sieht Ihr Konsumverhalten aus?',
'bookmark': null,
'contentBlocks': {
'edges': [
node: {
id: 'Q2hhcHRlck5vZGU6MTg=',
title: '1.1 Lehrbeginn',
description: 'Wie sieht Ihr Konsumverhalten aus?',
bookmark: null,
contentBlocks: {
edges: [
{
'node': {
'id': 'Q29udGVudEJsb2NrTm9kZToxOQ==',
'slug': 'assignment',
'title': 'Assignment',
'type': 'NORMAL',
'contents': [
node: {
id: 'Q29udGVudEJsb2NrTm9kZToxOQ==',
slug: 'assignment',
title: 'Assignment',
type: 'NORMAL',
contents: [
{
'type': 'assignment',
'value': {
'title': 'Ein Auftragstitel',
'assignment': 'Ein Auftrag',
'id': 'QXNzaWdubWVudE5vZGU6MQ==',
type: 'assignment',
value: {
title: 'Ein Auftragstitel',
assignment: 'Ein Auftrag',
id: 'QXNzaWdubWVudE5vZGU6MQ==',
},
'id': 'df8212ee-3e82-49fa-977e-c4b60789163e',
id: 'df8212ee-3e82-49fa-977e-c4b60789163e',
},
],
'userCreated': false,
'mine': false,
'bookmarks': [],
'hiddenFor': {
'edges': [],
'__typename': 'SchoolClassNodeConnection',
userCreated: false,
mine: false,
bookmarks: [],
hiddenFor: {
edges: [],
__typename: 'SchoolClassNodeConnection',
},
'visibleFor': {
'edges': [],
'__typename': 'SchoolClassNodeConnection',
visibleFor: {
edges: [],
__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': {
'id': 'TW9kdWxlTm9kZTo0Mg==',
'title': 'Geld',
'metaTitle': 'Modul 2',
'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 ',
'slug': 'geld',
'heroImage': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
'solutionsEnabled': false,
'bookmark': null,
'__typename': 'ModuleNode',
'assignments': {
'edges': [],
'__typename': 'AssignmentNodeConnection',
geld: {
id: 'TW9kdWxlTm9kZTo0Mg==',
title: 'Geld',
metaTitle: 'Modul 2',
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 ',
slug: 'geld',
heroImage:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
solutionsEnabled: false,
bookmark: null,
__typename: 'ModuleNode',
assignments: {
edges: [],
__typename: 'AssignmentNodeConnection',
},
'objectiveGroups': {
'edges': [],
'__typename': 'ObjectiveGroupNodeConnection',
objectiveGroups: {
edges: [],
__typename: 'ObjectiveGroupNodeConnection',
},
'chapters': {
'edges': [
chapters: {
edges: [
{
'node': {
'id': 'Q2hhcHRlck5vZGU6MzI=',
'title': '2.1 Eine Welt ohne Geld?',
'description': '',
'bookmark': null,
'contentBlocks': {
'edges': [
node: {
id: 'Q2hhcHRlck5vZGU6MzI=',
title: '2.1 Eine Welt ohne Geld?',
description: '',
bookmark: null,
contentBlocks: {
edges: [
{
'node': {
'id': 'Q29udGVudEJsb2NrTm9kZToxOQ==',
'slug': 'assignment',
'title': 'Assignment',
'type': 'NORMAL',
'contents': [
node: {
id: 'Q29udGVudEJsb2NrTm9kZToxOQ==',
slug: 'assignment',
title: 'Assignment',
type: 'NORMAL',
contents: [
{
'type': 'assignment',
'value': {
'title': 'Ein Auftragstitel',
'assignment': 'Ein Auftrag',
'id': 'QXNzaWdubWVudE5vZGU6MQ==',
type: 'assignment',
value: {
title: 'Ein Auftragstitel',
assignment: 'Ein Auftrag',
id: 'QXNzaWdubWVudE5vZGU6MQ==',
},
'id': 'df8212ee-3e82-49fa-977e-c4b60789163e',
id: 'df8212ee-3e82-49fa-977e-c4b60789163e',
},
],
'userCreated': false,
'mine': false,
'bookmarks': [],
'hiddenFor': {
'edges': [],
'__typename': 'SchoolClassNodeConnection',
userCreated: false,
mine: false,
bookmarks: [],
hiddenFor: {
edges: [],
__typename: 'SchoolClassNodeConnection',
},
'visibleFor': {
'edges': [],
'__typename': 'SchoolClassNodeConnection',
visibleFor: {
edges: [],
__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': {
'id': 'TW9kdWxlTm9kZTo3MA==',
'title': 'Lerntipps',
'metaTitle': 'Modul 4',
'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 ',
'slug': 'lerntipps',
'heroImage': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
'solutionsEnabled': false,
'bookmark': {
'note': null,
'__typename': 'ModuleBookmarkNode',
lerntipps: {
id: 'TW9kdWxlTm9kZTo3MA==',
title: 'Lerntipps',
metaTitle: 'Modul 4',
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 ',
slug: 'lerntipps',
heroImage:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
solutionsEnabled: false,
bookmark: {
note: null,
__typename: 'ModuleBookmarkNode',
},
'__typename': 'ModuleNode',
'assignments': {
'edges': [],
'__typename': 'AssignmentNodeConnection',
__typename: 'ModuleNode',
assignments: {
edges: [],
__typename: 'AssignmentNodeConnection',
},
'objectiveGroups': {
'edges': [],
'__typename': 'ObjectiveGroupNodeConnection',
objectiveGroups: {
edges: [],
__typename: 'ObjectiveGroupNodeConnection',
},
'chapters': {
'edges': [
chapters: {
edges: [
{
'node': {
'id': 'Q2hhcHRlck5vZGU6MTg=',
'title': '1.1 Lehrbeginn',
'description': 'Wie sieht Ihr Konsumverhalten aus?',
'bookmark': null,
'contentBlocks': {
'edges': [],
'__typename': 'ContentBlockNodeConnection',
node: {
id: 'Q2hhcHRlck5vZGU6MTg=',
title: '1.1 Lehrbeginn',
description: 'Wie sieht Ihr Konsumverhalten aus?',
bookmark: null,
contentBlocks: {
edges: [],
__typename: 'ContentBlockNodeConnection',
},
'__typename': 'ChapterNode',
__typename: 'ChapterNode',
},
'__typename': 'ChapterNodeEdge',
__typename: 'ChapterNodeEdge',
},
],
'__typename': 'ChapterNodeConnection',
__typename: 'ChapterNodeConnection',
},
},
'random': {
'id': 'TW9kdWxlTm9kZTo1NA==',
'title': 'Random',
'metaTitle': 'Modul 5',
'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 ',
'slug': 'random',
'heroImage': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
'solutionsEnabled': false,
'bookmark': {
'note': null,
'__typename': 'ModuleBookmarkNode',
random: {
id: 'TW9kdWxlTm9kZTo1NA==',
title: 'Random',
metaTitle: 'Modul 5',
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 ',
slug: 'random',
heroImage:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
solutionsEnabled: false,
bookmark: {
note: null,
__typename: 'ModuleBookmarkNode',
},
'__typename': 'ModuleNode',
'assignments': {
'edges': [],
'__typename': 'AssignmentNodeConnection',
__typename: 'ModuleNode',
assignments: {
edges: [],
__typename: 'AssignmentNodeConnection',
},
'objectiveGroups': {
'edges': [],
'__typename': 'ObjectiveGroupNodeConnection',
objectiveGroups: {
edges: [],
__typename: 'ObjectiveGroupNodeConnection',
},
'chapters': {
'edges': [
chapters: {
edges: [
{
'node': {
'id': 'Q2hhcHRlck5vZGU6MTg=',
'title': '1.1 Lehrbeginn',
'description': 'Wie sieht Ihr Konsumverhalten aus?',
'bookmark': null,
'contentBlocks': {
'edges': [],
'__typename': 'ContentBlockNodeConnection',
node: {
id: 'Q2hhcHRlck5vZGU6MTg=',
title: '1.1 Lehrbeginn',
description: 'Wie sieht Ihr Konsumverhalten aus?',
bookmark: null,
contentBlocks: {
edges: [],
__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
declare namespace Cypress {
interface Chainable<Subject> {
}
interface Chainable<Subject> {}
}

View File

@ -94,6 +94,10 @@
"webpack-dev-server": "^4.6.0",
"webpack-merge": "^5.8.0"
},
"devDependencies": {
"eslint-config-prettier": "^8.6.0",
"prettier": "2.8.2"
},
"engines": {
"node": ">= 14.x",
"npm": ">= 8.x"
@ -7885,6 +7889,18 @@
"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": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/eslint-formatter-friendly/-/eslint-formatter-friendly-7.0.0.tgz",
@ -15719,10 +15735,10 @@
}
},
"node_modules/prettier": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
"optional": true,
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.2.tgz",
"integrity": "sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==",
"devOptional": true,
"bin": {
"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": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/eslint-formatter-friendly/-/eslint-formatter-friendly-7.0.0.tgz",
@ -30673,10 +30696,10 @@
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="
},
"prettier": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
"optional": true
"version": "2.8.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.2.tgz",
"integrity": "sha512-BtRV9BcncDyI2tsuS19zzhzoxD8Dh8LiCx7j7tHzrkz8GFXAexeWFdi22mjE1d16dftH2qNaytVxqiRTGlMfpw==",
"devOptional": true
},
"pretty": {
"version": "2.0.0",

View File

@ -4,6 +4,9 @@
"description": "skillbox vue client",
"author": "ramon / chrigu",
"private": true,
"prettier": {
"singleQuote": true
},
"scripts": {
"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",
@ -125,5 +128,9 @@
},
"optionalDependencies": {
"fsevents": "^2.3.2"
},
"devDependencies": {
"eslint-config-prettier": "^8.6.0",
"prettier": "2.8.2"
}
}