describe('Project Entry', () => { beforeEach(() => { cy.exec("python ../server/manage.py prepare_projects_for_cypress"); cy.viewport('macbook-15'); cy.startGraphQLCapture(); cy.login('rahel.cueni', 'test', true); cy.get('body').contains('Neues Wissen erwerben'); }); it('should create a new project entry', () => { cy.visit('/portfolio'); cy.get('[data-cy=project-link]:first-of-type').click(); cy.get('[data-cy=add-project-entry]:first-of-type').click(); cy.get('[data-cy=activity-input]').within(() => { cy.get('[data-cy=text-form-input]').type('Join the Guardians'); }); cy.get('[data-cy=reflection-input]').within(() => { cy.get('[data-cy=text-form-input]').type('They are cool!'); }); cy.get('[data-cy=next-steps-input]').within(() => { cy.get('[data-cy=text-form-input]').type('Stay with Rocket\nMeet Quill'); }); cy.get('[data-cy=modal-save-button]').click(); cy.waitFor('AddProjectEntryMutation'); cy.get('.project-entry:last-of-type').within(() => { cy.get('.project-entry__paragraph:first-of-type').contains('Join the Guardians') }); }); it('should edit first entry', () => { cy.visit('/portfolio/groot'); cy.get('.project-entry__paragraph:first-of-type').contains('Kill Thanos'); cy.get('.project-entry:first-of-type').within(() => { cy.get('[data-cy=project-entry-more]').click(); cy.get('[data-cy=edit-project-entry]').click(); }); cy.get('[data-cy=activity-input]').within(() => { cy.get('[data-cy=text-form-input]').clear().type('Defeat Thanos'); }); cy.get('[data-cy=modal-save-button]').click(); cy.waitFor('UpdateProjectEntry'); cy.get('.project-entry__paragraph:first-of-type').contains('Defeat Thanos'); }); it('should delete the last entry', () => { cy.visit('/portfolio/groot'); cy.get('.project-entry').should('have.length', 2); cy.get('.project-entry:last-of-type').within(() => { cy.get('[data-cy=project-entry-more]').click(); cy.get('[data-cy=delete-project-entry]').click(); }); cy.get('.project-entry').should('have.length', 1); }); });