53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
const schema = require('../fixtures/schema.json');
|
|
const me = require('../fixtures/me.new-student.json');
|
|
|
|
describe('New student', () => {
|
|
it('shows "Enter Code" page and adds the user to a class', () => {
|
|
|
|
cy.server();
|
|
|
|
cy.mockGraphql({
|
|
schema: schema,
|
|
});
|
|
|
|
cy.apolloLogin('hansli', 'test');
|
|
|
|
const __typename = "SchoolClassNode";
|
|
const name = "KF1A";
|
|
const id = "U2Nob29sQ2xhc3NOb2RlOjI=";
|
|
|
|
cy.mockGraphqlOps({
|
|
operations: {
|
|
MeQuery: me,
|
|
JoinClass: {
|
|
joinClass: {
|
|
success: true,
|
|
schoolClass: {
|
|
id,
|
|
name,
|
|
__typename
|
|
}
|
|
}
|
|
},
|
|
MySchoolClassQuery: {
|
|
me: {
|
|
...me.me,
|
|
selectedClass: {
|
|
__typename,
|
|
name,
|
|
id,
|
|
members: []
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
cy.visit('/');
|
|
cy.get('[data-cy=join-class-title]').should('contain', 'Zugangscode');
|
|
cy.get('[data-cy=input-class-code]').type('XXXX');
|
|
cy.get('[data-cy=join-class]').click();
|
|
cy.get('[data-cy=class-list-title]').should('contain', 'Klassenliste');
|
|
});
|
|
});
|