50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
const schema = require('../fixtures/schema.json');
|
|
const me = require('../fixtures/me.join-class.json');
|
|
|
|
describe('Join Class', () => {
|
|
beforeEach(() => {
|
|
cy.server();
|
|
|
|
cy.mockGraphql({
|
|
schema: schema,
|
|
});
|
|
|
|
cy.viewport('macbook-15');
|
|
cy.apolloLogin('rahel.cueni', 'test');
|
|
|
|
});
|
|
|
|
it('should join class', () => {
|
|
cy.mockGraphqlOps({
|
|
operations: {
|
|
MeQuery: me,
|
|
JoinClass: {
|
|
joinClass: {
|
|
success: true,
|
|
schoolClass: {
|
|
id: "U2Nob29sQ2xhc3NOb2RlOjI=",
|
|
name: "KF1A",
|
|
__typename: "SchoolClassNode"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
cy.visit('/me/profile');
|
|
|
|
cy.get('[data-cy=user-widget-avatar]').click();
|
|
cy.get('[data-cy=class-selection]').click();
|
|
cy.get('[data-cy=class-selection-entry]').should('have.length', 1);
|
|
|
|
cy.get('[data-cy=join-class-link]').click();
|
|
|
|
cy.get('[data-cy=input-class-code]').type('XXXX');
|
|
cy.get('[data-cy=join-class]').click();
|
|
|
|
cy.get('[data-cy=class-selection]').click();
|
|
cy.get('[data-cy=class-selection-entry]').should('have.length', 2);
|
|
})
|
|
})
|