import { getMinimalMe } from '../../../support/helpers'; describe('New project', () => { const MeQuery = getMinimalMe({ isTeacher: false }); const schoolClass = MeQuery.me.selectedClass; const operations = { ProjectsQuery: { projects: [ { id: 'UHJvamVjdE5vZGU6NjY=', title: 'Some random title', appearance: 'blue', description: 'This description rocks', slug: 'some-random-title', objectives: 'Git gud', final: false, schoolClass, student: { firstName: 'Rachel', lastName: 'Green', id: 'VXNlck5vZGU6NQ==', avatarUrl: '', }, entriesCount: 0, }, ], }, MeQuery, AddProject: (variables) => ({ addProject: { project: Object.assign({}, variables.input.project, { schoolClass }), errors: null, __typename: 'AddProjectPayload', }, }), }; before(() => { cy.setup(); }); it('creates a new project and displays it', () => { cy.mockGraphqlOps({ operations, }); cy.visit('/portfolio'); cy.get('[data-cy=create-project-button]').click(); cy.get('[data-cy=page-form-input-titel]').type('Some random title'); cy.get('[data-cy=page-form-input-beschreibung]').should('exist').should('be.empty'); cy.get('[data-cy=page-form-input-ziele]').should('not.exist'); cy.get('[data-cy=save-project-button]').click(); cy.getByDataCy('project').contains('random'); }); });