Skip test again

This commit is contained in:
Ramon Wenger 2021-08-19 11:51:10 +02:00
parent 180300bb80
commit 3a7f895354
2 changed files with 82 additions and 57 deletions

View File

@ -1,57 +0,0 @@
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,
});
});
});
// todo: unskip me
it('shows "Enter Code" page and adds the user to a class', () => {
cy.apolloLogin('hansli', 'test');
const name = 'KF1A';
const id = 'U2Nob29sQ2xhc3NOb2RlOjI=';
cy.mockGraphqlOps({
operations: {
MeQuery: me,
JoinClass: {
joinClass: {
success: true,
schoolClass: {
id,
name,
},
},
},
MySchoolClassQuery: {
me: {
...me.me,
selectedClass: {
name,
id,
members: [],
},
},
},
...mockUpdateOnboardingProgress(),
},
});
cy.visit('/');
cy.get('[data-cy=join-form-title]').should('contain', 'Einer Klasse beitreten');
cy.get('[data-cy=join-code-input]').type('XXXX');
cy.get('[data-cy=join-form-confirm]').click();
cy.getByDataCy('onboarding-skip-link').click();
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');
});
});

View File

@ -0,0 +1,82 @@
import {getMinimalMe} from '../../support/helpers';
// const me = require('../../fixtures/me.new-student.json');
describe('New student', () => {
before(() => {
cy.setup();
});
// todo: unskip me
it.skip('shows "Enter Code" page and adds the user to a class', () => {
const {me} = getMinimalMe({isTeacher: false});
let onboardingVisited = false;
let selectedClass;
let schoolClasses = [];
const name = 'KF1A';
const id = 'selectedClassId';
console.log('me', me);
const getSelectedClass = () => {
return selectedClass;
};
const getMe = () => {
return {
...me,
onboardingVisited,
schoolClasses: {edges: schoolClasses},
selectedClass: getSelectedClass(),
};
};
console.log('getMe()', getMe());
cy.mockGraphqlOps({
operations: {
MeQuery() {
return {
me: getMe(),
};
},
JoinClass() {
console.log('joining class');
selectedClass = {
id,
name,
};
schoolClasses.push(selectedClass);
return {
joinClass: {
success: true,
schoolClass: selectedClass,
},
};
},
MySchoolClassQuery: {
me: getMe(),
},
UpdateOnboardingProgress: () => {
onboardingVisited = true;
return {
updateOnboardingProgress: {
success: true,
},
};
},
},
});
cy.visit('/');
cy.get('[data-cy=join-form-title]').should('contain', 'Einer Klasse beitreten');
cy.get('[data-cy=join-form-input]').type('XXXX');
cy.get('[data-cy=join-form-confirm]').click();
cy.getByDataCy('onboarding-skip-link').click();
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');
});
});