60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
import {mockUpdateOnboardingProgress} from '../../support/helpers';
|
|
|
|
const me = require('../../fixtures/me.new-student.json');
|
|
|
|
describe('New student', () => {
|
|
before(() => {
|
|
cy.server();
|
|
cy.task('getSchema').then(schema => {
|
|
cy.mockGraphql({
|
|
schema,
|
|
});
|
|
});
|
|
});
|
|
|
|
it('shows "Enter Code" page and adds the user to a class', () => {
|
|
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: [],
|
|
},
|
|
},
|
|
},
|
|
...mockUpdateOnboardingProgress(),
|
|
},
|
|
});
|
|
|
|
cy.visit('/');
|
|
cy.get('[data-cy=join-form-title]').should('contain', 'Einer Klasse beitreten');
|
|
cy.get('[data-cy=input-form-code]').type('XXXX');
|
|
cy.get('[data-cy=join-form-confirm]').click();
|
|
cy.skipOnboarding();
|
|
cy.get('[data-cy=user-widget-avatar]').click();
|
|
cy.get('[data-cy=class-list-link]').click();
|
|
cy.get('[data-cy=group-list-title]').should('contain', 'Klassenliste');
|
|
});
|
|
});
|