Refactor cypress tests
This commit is contained in:
parent
e7d25535a9
commit
0e1764f51c
|
|
@ -4,7 +4,6 @@ const minimalMe = {
|
||||||
lastName: '',
|
lastName: '',
|
||||||
avatarUrl: '',
|
avatarUrl: '',
|
||||||
email: '',
|
email: '',
|
||||||
onboardingVisited: true,
|
|
||||||
schoolClasses: {},
|
schoolClasses: {},
|
||||||
id: '',
|
id: '',
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,8 @@ export default {
|
||||||
solution: 'Assignment Solution',
|
solution: 'Assignment Solution',
|
||||||
}),
|
}),
|
||||||
PrivateUserNode: () => ({
|
PrivateUserNode: () => ({
|
||||||
readOnly: false
|
readOnly: false,
|
||||||
|
onboardingVisited: true
|
||||||
}),
|
}),
|
||||||
SchoolClassNode: () => ({
|
SchoolClassNode: () => ({
|
||||||
readOnly: false
|
readOnly: false
|
||||||
|
|
|
||||||
|
|
@ -5,31 +5,24 @@ const operations = {
|
||||||
title: 'Ein Auftragstitel',
|
title: 'Ein Auftragstitel',
|
||||||
solution: '<p>Eine Lösung</p>',
|
solution: '<p>Eine Lösung</p>',
|
||||||
assignment: 'Ein Auftrag',
|
assignment: 'Ein Auftrag',
|
||||||
submissions: []
|
submissions: [],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {},
|
||||||
onboardingVisited: true
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Assignments', () => {
|
describe('Assignments', () => {
|
||||||
before(() => {
|
beforeEach(() => {
|
||||||
cy.task('getSchema').then(schema => {
|
cy.setup();
|
||||||
cy.mockGraphql({
|
|
||||||
schema,
|
cy.mockGraphqlOps({
|
||||||
mocks: {},
|
operations,
|
||||||
operations,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('it does not display HTML tags', () => {
|
it('it does not display HTML tags', () => {
|
||||||
cy.server();
|
|
||||||
cy.viewport('macbook-15');
|
|
||||||
cy.fakeLogin('ross.geller', 'test');
|
|
||||||
cy.visit('/module/lohn-und-budget/submissions/QXNzaWdubWVudE5vZGU6MQ==');
|
cy.visit('/module/lohn-und-budget/submissions/QXNzaWdubWVudE5vZGU6MQ==');
|
||||||
cy.getByDataCy('assignment-solution').should('have.text', 'Eine Lösung');
|
cy.getByDataCy('assignment-solution').should('have.text', 'Eine Lösung');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ const operations = {
|
||||||
},
|
},
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
onboardingVisited: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
AddProject: variables => ({
|
AddProject: variables => ({
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ const operations = {
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
id: 'VXNlck5vZGU6NQ==',
|
id: 'VXNlck5vZGU6NQ==',
|
||||||
onboardingVisited: true,
|
|
||||||
permissions: [],
|
permissions: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
import mocks from '../../../fixtures/mocks';
|
|
||||||
|
|
||||||
const myText = 'Mein Feedback';
|
const myText = 'Mein Feedback';
|
||||||
|
|
||||||
const getOperations = ({readOnly, classReadOnly = false}) => ({
|
const getOperations = ({readOnly, classReadOnly = false}) => ({
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
onboardingVisited: true,
|
|
||||||
readOnly,
|
readOnly,
|
||||||
selectedClass: {
|
selectedClass: {
|
||||||
id: 'selectedClassId',
|
id: 'selectedClassId',
|
||||||
|
|
@ -37,14 +34,7 @@ const getOperations = ({readOnly, classReadOnly = false}) => ({
|
||||||
|
|
||||||
describe('Assignment feedback read-only - Teacher', () => {
|
describe('Assignment feedback read-only - Teacher', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.fakeLogin('nico.teacher', 'test');
|
cy.setup();
|
||||||
cy.server();
|
|
||||||
cy.task('getSchema').then(schema => {
|
|
||||||
cy.mockGraphql({
|
|
||||||
schema,
|
|
||||||
mocks,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can not edit', () => {
|
it('can not edit', () => {
|
||||||
|
|
@ -53,10 +43,6 @@ describe('Assignment feedback read-only - Teacher', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.visit('submission/submission-id');
|
cy.visit('submission/submission-id');
|
||||||
// cy.get('.submission-form__textarea--readonly').as('textarea');
|
|
||||||
//
|
|
||||||
// cy.get('@textarea').invoke('val').should('contain', myText);
|
|
||||||
// cy.get('@textarea').should('have.attr', 'readonly');
|
|
||||||
|
|
||||||
cy.isSubmissionReadOnly(myText);
|
cy.isSubmissionReadOnly(myText);
|
||||||
cy.getByDataCy('final-submission-reopen').should('not.exist');
|
cy.getByDataCy('final-submission-reopen').should('not.exist');
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ const myText = 'submission text';
|
||||||
const getOperations = ({final, readOnly, classReadOnly = false}) => ({
|
const getOperations = ({final, readOnly, classReadOnly = false}) => ({
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
onboardingVisited: true,
|
|
||||||
readOnly,
|
readOnly,
|
||||||
selectedClass: {
|
selectedClass: {
|
||||||
id: 'selectedClassId',
|
id: 'selectedClassId',
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ const SELECTED_CLASS_ID = 'selectedClassId';
|
||||||
const getOperations = ({readOnly, classReadOnly}) => ({
|
const getOperations = ({readOnly, classReadOnly}) => ({
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
onboardingVisited: true,
|
|
||||||
readOnly,
|
readOnly,
|
||||||
isTeacher: true,
|
isTeacher: true,
|
||||||
selectedClass: {
|
selectedClass: {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ const SELECTED_CLASS_ID = 'selectedClassId';
|
||||||
const getOperations = ({readOnly, classReadOnly}) => ({
|
const getOperations = ({readOnly, classReadOnly}) => ({
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
onboardingVisited: true,
|
|
||||||
readOnly,
|
readOnly,
|
||||||
isTeacher: true,
|
isTeacher: true,
|
||||||
selectedClass: {
|
selectedClass: {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ const selectedClassName = 'My Class';
|
||||||
const getOperations = ({readOnly}) => ({
|
const getOperations = ({readOnly}) => ({
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
onboardingVisited: true,
|
|
||||||
readOnly,
|
readOnly,
|
||||||
isTeacher: true,
|
isTeacher: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ const operations = {
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
permissions: [],
|
permissions: [],
|
||||||
onboardingVisited: true,
|
readOnly: false,
|
||||||
readOnly: false
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
AssignmentQuery: {
|
AssignmentQuery: {
|
||||||
|
|
@ -131,19 +130,15 @@ const operations = {
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Spellcheck', () => {
|
describe('Spellcheck', () => {
|
||||||
before(() => {
|
beforeEach(() => {
|
||||||
cy.server();
|
cy.setup();
|
||||||
cy.task('getSchema').then(schema => {
|
cy.mockGraphqlOps({
|
||||||
cy.mockGraphql({
|
operations,
|
||||||
schema,
|
|
||||||
operations,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// todo: unskip me
|
// todo: unskip me
|
||||||
it.skip('should highlight three errors', () => {
|
it('should highlight three errors', () => {
|
||||||
cy.fakeLogin('rachel.green', 'test');
|
|
||||||
cy.visit('/module/lohn-und-budget/');
|
cy.visit('/module/lohn-und-budget/');
|
||||||
|
|
||||||
cy.getByDataCy('spellcheck-correction').should('have.length', 0);
|
cy.getByDataCy('spellcheck-correction').should('have.length', 0);
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ describe('Survey', () => {
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
me: {
|
me: {
|
||||||
permissions: [],
|
permissions: [],
|
||||||
onboardingVisited: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ModuleQuery: variables => ({module}),
|
ModuleQuery: variables => ({module}),
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
export const getMinimalMe = ({readOnly = false, classReadOnly = false, isTeacher = true}) => ({
|
export const getMinimalMe = ({readOnly = false, classReadOnly = false, isTeacher = true}) => ({
|
||||||
me: {
|
me: {
|
||||||
id: 'meId',
|
id: 'meId',
|
||||||
onboardingVisited: true,
|
|
||||||
readOnly,
|
readOnly,
|
||||||
isTeacher,
|
isTeacher,
|
||||||
selectedClass: {
|
selectedClass: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue