Fix re-added tests
This commit is contained in:
parent
f384844380
commit
cec562589f
|
|
@ -1,3 +1,11 @@
|
||||||
|
const selectedClass = {
|
||||||
|
id: 'selectedClassId',
|
||||||
|
name: 'Moordale',
|
||||||
|
readOnly: false,
|
||||||
|
code: 'XXXX',
|
||||||
|
members: []
|
||||||
|
};
|
||||||
|
|
||||||
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'}),
|
||||||
|
|
@ -42,7 +50,13 @@ export default {
|
||||||
}),
|
}),
|
||||||
PrivateUserNode: () => ({
|
PrivateUserNode: () => ({
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
onboardingVisited: true
|
onboardingVisited: true,
|
||||||
|
selectedClass,
|
||||||
|
schoolClasses: {
|
||||||
|
edges: [
|
||||||
|
{node: selectedClass}
|
||||||
|
]
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
SchoolClassNode: () => ({
|
SchoolClassNode: () => ({
|
||||||
readOnly: false
|
readOnly: false
|
||||||
|
|
|
||||||
|
|
@ -17,23 +17,33 @@ const members = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const selectedClass = {
|
const getSelectedClass = (classMembers = members) => ({
|
||||||
name: 'Moordale',
|
name: 'Moordale',
|
||||||
members
|
members: classMembers
|
||||||
};
|
});
|
||||||
|
|
||||||
describe('Class Management', () => {
|
describe('School Class Management', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.setup();
|
cy.setup();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should join class', () => {
|
it('should join class', () => {
|
||||||
const name = 'KF1A';
|
const name = 'KF1A';
|
||||||
const id = 'U2Nob29sQ2xhc3NOb2RlOjI=';
|
let selectedClassName = 'Moordale';
|
||||||
|
|
||||||
|
const getSelectedClassWithName = () => ({
|
||||||
|
id: 'selectedClassId',
|
||||||
|
name: selectedClassName
|
||||||
|
});
|
||||||
|
|
||||||
cy.mockGraphqlOps({
|
cy.mockGraphqlOps({
|
||||||
operations: {
|
operations: {
|
||||||
MeQuery,
|
MeQuery: () => ({
|
||||||
|
me: {
|
||||||
|
...teacher,
|
||||||
|
selectedClass: getSelectedClassWithName()
|
||||||
|
}
|
||||||
|
}),
|
||||||
// JoinClass() {
|
// JoinClass() {
|
||||||
// // fixme: is this necessary? the cache somehow does not seem to do anything for the MeQuery
|
// // fixme: is this necessary? the cache somehow does not seem to do anything for the MeQuery
|
||||||
// let schoolClass = {
|
// let schoolClass = {
|
||||||
|
|
@ -52,25 +62,21 @@ describe('Class Management', () => {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
JoinClass: {
|
JoinClass() {
|
||||||
joinClass: {
|
selectedClassName = name;
|
||||||
success: true,
|
return {
|
||||||
schoolClass: {
|
joinClass: {
|
||||||
name,
|
success: true,
|
||||||
id
|
schoolClass: getSelectedClassWithName()
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
MySchoolClassQuery: {
|
MySchoolClassQuery: () => ({
|
||||||
me: {
|
me: {
|
||||||
...selectedClass.me,
|
...teacher,
|
||||||
selectedClass: {
|
selectedClass: getSelectedClassWithName()
|
||||||
name,
|
|
||||||
id,
|
|
||||||
members: []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -85,10 +91,10 @@ describe('Class Management', () => {
|
||||||
|
|
||||||
cy.get('[data-cy=join-class-link]').click();
|
cy.get('[data-cy=join-class-link]').click();
|
||||||
|
|
||||||
cy.get('[data-cy=input-class-code]').type('XXXX');
|
cy.get('[data-cy=join-form-input]').type('XXXX');
|
||||||
cy.get('[data-cy=join-class]').click();
|
cy.get('[data-cy=join-form-confirm]').click();
|
||||||
|
|
||||||
cy.get('[data-cy=school-class-name]').should('contain', name);
|
cy.get('[data-cy=group-list-name]').should('contain', name);
|
||||||
cy.get('[data-cy=current-class-name]').should('contain', name);
|
cy.get('[data-cy=current-class-name]').should('contain', name);
|
||||||
|
|
||||||
cy.get('[data-cy=header-user-widget]').within(() => {
|
cy.get('[data-cy=header-user-widget]').within(() => {
|
||||||
|
|
@ -97,7 +103,8 @@ describe('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({
|
||||||
|
|
@ -110,8 +117,7 @@ describe('Class Management', () => {
|
||||||
},
|
},
|
||||||
MySchoolClassQuery: {
|
MySchoolClassQuery: {
|
||||||
me: {
|
me: {
|
||||||
...teacher,
|
...teacher
|
||||||
selectedClass
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -184,17 +190,14 @@ describe('Teacher Class Management', () => {
|
||||||
MySchoolClassQuery: {
|
MySchoolClassQuery: {
|
||||||
me: {
|
me: {
|
||||||
...teacher,
|
...teacher,
|
||||||
selectedClass,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
UpdateSchoolClass: {
|
UpdateSchoolClass: {
|
||||||
updateSchoolClass: {
|
updateSchoolClass: {
|
||||||
success: true,
|
success: true,
|
||||||
schoolClass: {
|
schoolClass: {
|
||||||
name: className,
|
name: className
|
||||||
__typename: 'SchoolClassNode',
|
|
||||||
},
|
},
|
||||||
__typename: 'UpdateSchoolClassPayload',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -212,35 +215,39 @@ describe('Teacher Class Management', () => {
|
||||||
cy.get('not-implemented');
|
cy.get('not-implemented');
|
||||||
});
|
});
|
||||||
|
|
||||||
// // fixme: cache misbehaves with mequery, but only for test
|
it.only('creates a new class', () => {
|
||||||
//
|
const name = 'Hill Valley';
|
||||||
it('creates a new class', () => {
|
let selectedClass = teacher.selectedClass;
|
||||||
const name = 'Moordale';
|
|
||||||
const id = 'U2Nob29sQ2xhc3NOb2RlOjI=';
|
const schoolClasses = [
|
||||||
const __typename = 'SchoolClassNode';
|
{
|
||||||
let localMe = {
|
node: teacher.selectedClass
|
||||||
me: {
|
|
||||||
...me.me,
|
|
||||||
isTeacher: true
|
|
||||||
}
|
}
|
||||||
};
|
];
|
||||||
|
|
||||||
|
const me = () => ({
|
||||||
|
...teacher,
|
||||||
|
selectedClass,
|
||||||
|
schoolClasses: {
|
||||||
|
edges: schoolClasses
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
cy.mockGraphqlOps({
|
cy.mockGraphqlOps({
|
||||||
operations: {
|
operations: {
|
||||||
MeQuery: () => {
|
MeQuery: () => ({
|
||||||
return localMe;
|
me: me()
|
||||||
},
|
}),
|
||||||
CreateSchoolClass() {
|
CreateSchoolClass() {
|
||||||
// fixme: is this necessary? the cache somehow does not seem to do anything for the MeQuery
|
const schoolClass = {
|
||||||
let schoolClass = {
|
id: 'newSchoolClassId',
|
||||||
id,
|
|
||||||
name,
|
name,
|
||||||
__typename
|
readOnly: false
|
||||||
};
|
};
|
||||||
// localMe.me.schoolClasses.edges.push({
|
schoolClasses.push({
|
||||||
// node: schoolClass,
|
node: schoolClass
|
||||||
// __typename: 'SchoolClassNodeEdge'
|
});
|
||||||
// });
|
selectedClass = schoolClass;
|
||||||
return {
|
return {
|
||||||
createSchoolClass: {
|
createSchoolClass: {
|
||||||
success: true,
|
success: true,
|
||||||
|
|
@ -248,17 +255,9 @@ describe('Teacher Class Management', () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
MySchoolClassQuery: {
|
MySchoolClassQuery: () => ({
|
||||||
me: {
|
me: me()
|
||||||
...selectedClass.me,
|
})
|
||||||
selectedClass: {
|
|
||||||
__typename,
|
|
||||||
name,
|
|
||||||
id,
|
|
||||||
members: []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -275,11 +274,12 @@ describe('Teacher Class Management', () => {
|
||||||
|
|
||||||
cy.get('[data-cy=create-class-link]').click();
|
cy.get('[data-cy=create-class-link]').click();
|
||||||
|
|
||||||
cy.get('[data-cy=input-class-name]').type(name);
|
cy.get('[data-cy=join-form-input]').type(name);
|
||||||
|
|
||||||
cy.get('[data-cy=create-class]').click();
|
cy.get('[data-cy=join-form-confirm]').click();
|
||||||
|
|
||||||
cy.get('[data-cy=school-class-name]').should('contain', name);
|
cy.get('[data-cy=close-profile-sidebar-link]').click();
|
||||||
|
cy.get('[data-cy=group-list-name]').should('contain', name);
|
||||||
cy.get('[data-cy=current-class-name]').should('contain', name);
|
cy.get('[data-cy=current-class-name]').should('contain', name);
|
||||||
|
|
||||||
cy.get('[data-cy=header-user-widget]').within(() => {
|
cy.get('[data-cy=header-user-widget]').within(() => {
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
:class="{'skillboxform-input__input--error': error}"
|
:class="{'skillboxform-input__input--error': error}"
|
||||||
:value="value"
|
:value="value"
|
||||||
class="skillbox-input skillboxform-input__input"
|
class="skillbox-input skillboxform-input__input"
|
||||||
data-cy="input-form-code"
|
data-cy="join-form-input"
|
||||||
id="join-code"
|
id="join-code"
|
||||||
@input="$emit('input', $event)">
|
@input="$emit('input', $event)">
|
||||||
<small
|
<small
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
v-if="sidebar.profile">
|
v-if="sidebar.profile">
|
||||||
<a
|
<a
|
||||||
class="profile-sidebar__close-link"
|
class="profile-sidebar__close-link"
|
||||||
|
data-cy="close-profile-sidebar-link"
|
||||||
@click="close">
|
@click="close">
|
||||||
<cross class="profile-sidebar__close-icon"/>
|
<cross class="profile-sidebar__close-icon"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue