Add failing tests for new features
This commit is contained in:
parent
337a9e49cf
commit
e0ee8b5cad
|
|
@ -1,57 +0,0 @@
|
|||
const operations = {
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [
|
||||
{
|
||||
node: {
|
||||
id: 'UHJvamVjdE5vZGU6NjY=',
|
||||
title: 'Some random title',
|
||||
appearance: 'blue',
|
||||
description: 'This description rocks',
|
||||
slug: 'some-random-title',
|
||||
objectives: 'Git gud',
|
||||
final: false,
|
||||
student: {
|
||||
firstName: 'Rachel',
|
||||
lastName: 'Green',
|
||||
id: 'VXNlck5vZGU6NQ==',
|
||||
avatarUrl: '',
|
||||
},
|
||||
entriesCount: 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
MeQuery: {
|
||||
me: {
|
||||
}
|
||||
},
|
||||
AddProject: variables => ({
|
||||
addProject: {
|
||||
project: Object.assign({}, variables.input.project),
|
||||
errors: null,
|
||||
__typename: 'AddProjectPayload',
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
describe('New project', () => {
|
||||
before(() => {
|
||||
cy.setup();
|
||||
});
|
||||
|
||||
it('creates a new project and displays it', () => {
|
||||
cy.mockGraphqlOps({
|
||||
operations
|
||||
});
|
||||
cy.visit('/portfolio');
|
||||
|
||||
cy.get('[data-cy=add-project-button]').click();
|
||||
cy.get('[data-cy=page-form-input-titel]').type('Some random title');
|
||||
cy.get('[data-cy=page-form-input-beschreibung]').type('This description rocks');
|
||||
cy.get('[data-cy=page-form-input-ziele]').type('Git gud');
|
||||
cy.get('[data-cy=save-project-button]').click();
|
||||
cy.get('.project-widget:first').contains('random');
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
describe('New project', () => {
|
||||
const operations = {
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [
|
||||
{
|
||||
node: {
|
||||
id: 'UHJvamVjdE5vZGU6NjY=',
|
||||
title: 'Some random title',
|
||||
appearance: 'blue',
|
||||
description: 'This description rocks',
|
||||
slug: 'some-random-title',
|
||||
objectives: 'Git gud',
|
||||
final: false,
|
||||
student: {
|
||||
firstName: 'Rachel',
|
||||
lastName: 'Green',
|
||||
id: 'VXNlck5vZGU6NQ==',
|
||||
avatarUrl: '',
|
||||
},
|
||||
entriesCount: 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
MeQuery: {
|
||||
me: {},
|
||||
},
|
||||
AddProject: variables => ({
|
||||
addProject: {
|
||||
project: Object.assign({}, variables.input.project),
|
||||
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=add-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.get('.project-widget:first').contains('random');
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
describe('Project Entry', () => {
|
||||
const operations = {
|
||||
MeQuery: {
|
||||
me: {
|
||||
id: 'VXNlck5vZGU6NQ==',
|
||||
permissions: [],
|
||||
},
|
||||
},
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [{
|
||||
node: {
|
||||
id: 'UHJvamVjdE5vZGU6MzM=',
|
||||
title: 'Groot',
|
||||
appearance: 'red',
|
||||
'description': 'I am Groot',
|
||||
'slug': 'groot',
|
||||
'objectives': 'Be Groot\nBe awesome',
|
||||
'final': false,
|
||||
'student': {
|
||||
'firstName': 'Rachel',
|
||||
'lastName': 'Green',
|
||||
'id': 'VXNlck5vZGU6NQ==',
|
||||
'avatarUrl': '',
|
||||
'__typename': 'UserNode',
|
||||
},
|
||||
'entriesCount': 2,
|
||||
'__typename': 'ProjectNode',
|
||||
},
|
||||
'__typename': 'ProjectNodeEdge',
|
||||
}],
|
||||
'__typename': 'ProjectNodeConnection',
|
||||
},
|
||||
},
|
||||
ProjectQuery: {
|
||||
'project': {
|
||||
'id': 'UHJvamVjdE5vZGU6MzY=',
|
||||
'title': 'Groot',
|
||||
'appearance': 'yellow',
|
||||
'description': 'I am Groot',
|
||||
'slug': 'groot',
|
||||
'objectives': 'Be Groot\nBe awesome',
|
||||
'final': false,
|
||||
'student': {
|
||||
'firstName': 'Rachel',
|
||||
'lastName': 'Green',
|
||||
'id': 'VXNlck5vZGU6NQ==',
|
||||
'avatarUrl': '',
|
||||
'__typename': 'UserNode',
|
||||
},
|
||||
'entriesCount': 1,
|
||||
'__typename': 'ProjectNode',
|
||||
'entries': {
|
||||
'edges': [{
|
||||
'node': {
|
||||
'id': 'UHJvamVjdEVudHJ5Tm9kZTo2NQ==',
|
||||
'activity': 'Kill Thanos',
|
||||
'reflection': 'He sucks',
|
||||
'nextSteps': 'Go for the head',
|
||||
'documentUrl': '',
|
||||
'__typename': 'ProjectEntryNode',
|
||||
'created': '2020-01-20T15:20:31.262510+00:00',
|
||||
},
|
||||
'__typename': 'ProjectEntryNodeEdge',
|
||||
}],
|
||||
'__typename': 'ProjectEntryNodeConnection',
|
||||
},
|
||||
},
|
||||
},
|
||||
AddProjectEntry: variables => ({
|
||||
addProjectEntry: {
|
||||
projectEntry: Object.assign({}, variables.input.projectEntry, {
|
||||
created: '2020-01-20T15:26:58.722773+00:00',
|
||||
}),
|
||||
errors: null,
|
||||
__typename: 'AddProjectEntryPayload',
|
||||
},
|
||||
}),
|
||||
UpdateProjectEntry: variables => ({
|
||||
updateProjectEntry: {
|
||||
projectEntry: variables.input.projectEntry,
|
||||
errors: null,
|
||||
__typename: 'UpdateProjectEntryPayload',
|
||||
},
|
||||
}),
|
||||
DeleteProjectEntry: {
|
||||
deleteProjectEntry: {
|
||||
success: true,
|
||||
__typename: 'DeleteProjectEntryPayload',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
cy.setup();
|
||||
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphqlOps({
|
||||
operations,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
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.getByDataCy('activity-input').should('not.exist');
|
||||
// cy.get('[data-cy=activity-input]').within(() => {
|
||||
// cy.get('[data-cy=text-form-input]').type('Join the Guardians');
|
||||
// });
|
||||
cy.getByDataCy('reflection-input').should('not.exist');
|
||||
// cy.get('[data-cy=reflection-input]').within(() => {
|
||||
// cy.get('[data-cy=text-form-input]').type('They are cool!');
|
||||
// });
|
||||
cy.getByDataCy('next-steps-input').should('not.exist');
|
||||
// cy.get('[data-cy=next-steps-input]').within(() => {
|
||||
// cy.get('[data-cy=text-form-input]').type('Stay with Rocket\nMeet Quill');
|
||||
// });
|
||||
cy.getByDataCy('modal-title').should('contain', 'Beitrag erfassen');
|
||||
cy.getByDataCy('project-entry-input').should('exist');
|
||||
cy.getByDataCy('use-template-button').should('exist').click();
|
||||
cy.getByDataCy('upload-document-button').should('exist');
|
||||
cy.getByDataCy('modal-save-button').click();
|
||||
|
||||
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.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', 1);
|
||||
|
||||
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', 0);
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
import {getMinimalMe} from '../../../support/helpers';
|
||||
|
||||
describe('Projects page', () => {
|
||||
const MeQuery = getMinimalMe({});
|
||||
beforeEach(() => {
|
||||
cy.setup();
|
||||
});
|
||||
|
||||
it('displays portfolio onboarding', () => {
|
||||
const operations = {
|
||||
MeQuery,
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
cy.mockGraphqlOps({
|
||||
operations,
|
||||
});
|
||||
cy.visit('/portfolio');
|
||||
cy.getByDataCy('page-title').should('contain', 'Portfolio');
|
||||
cy.getByDataCy('portfolio-onboarding-illustration').should('exist');
|
||||
cy.getByDataCy('portfolio-onboarding-subtitle').should('contain', 'Woran denken Sie gerade');
|
||||
cy.getByDataCy('portfolio-onboarding-text').should('contain', 'Hier können Sie Projekte erstellen.');
|
||||
cy.getByDataCy('page-footer').should('not.exist');
|
||||
cy.getByDataCy('create-project-button').should('exist');
|
||||
});
|
||||
|
||||
it('displays the project list', () => {
|
||||
const operations = {
|
||||
MeQuery,
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
cy.mockGraphqlOps({
|
||||
operations,
|
||||
});
|
||||
cy.visit('/portfolio');
|
||||
cy.getByDataCy('page-title').should('contain', 'Portfolio');
|
||||
cy.getByDataCy('create-project-button').should('exist');
|
||||
cy.getByDataCy('project-list').should('exist');
|
||||
cy.getByDataCy('project').should('have.length', 1);
|
||||
cy.getByDataCy('project-owner').should('contain', 'Bilbo Baggins');
|
||||
});
|
||||
});
|
||||
|
|
@ -1,151 +0,0 @@
|
|||
|
||||
const operations = {
|
||||
MeQuery: {
|
||||
me: {
|
||||
id: 'VXNlck5vZGU6NQ==',
|
||||
permissions: [],
|
||||
},
|
||||
},
|
||||
ProjectsQuery: {
|
||||
projects: {
|
||||
edges: [{
|
||||
node: {
|
||||
id: 'UHJvamVjdE5vZGU6MzM=',
|
||||
title: 'Groot',
|
||||
appearance: 'red',
|
||||
'description': 'I am Groot',
|
||||
'slug': 'groot',
|
||||
'objectives': 'Be Groot\nBe awesome',
|
||||
'final': false,
|
||||
'student': {
|
||||
'firstName': 'Rachel',
|
||||
'lastName': 'Green',
|
||||
'id': 'VXNlck5vZGU6NQ==',
|
||||
'avatarUrl': '',
|
||||
'__typename': 'UserNode',
|
||||
},
|
||||
'entriesCount': 2,
|
||||
'__typename': 'ProjectNode',
|
||||
},
|
||||
'__typename': 'ProjectNodeEdge',
|
||||
}],
|
||||
'__typename': 'ProjectNodeConnection',
|
||||
},
|
||||
},
|
||||
ProjectQuery: {
|
||||
'project': {
|
||||
'id': 'UHJvamVjdE5vZGU6MzY=',
|
||||
'title': 'Groot',
|
||||
'appearance': 'yellow',
|
||||
'description': 'I am Groot',
|
||||
'slug': 'groot',
|
||||
'objectives': 'Be Groot\nBe awesome',
|
||||
'final': false,
|
||||
'student': {
|
||||
'firstName': 'Rachel',
|
||||
'lastName': 'Green',
|
||||
'id': 'VXNlck5vZGU6NQ==',
|
||||
'avatarUrl': '',
|
||||
'__typename': 'UserNode',
|
||||
},
|
||||
'entriesCount': 1,
|
||||
'__typename': 'ProjectNode',
|
||||
'entries': {
|
||||
'edges': [{
|
||||
'node': {
|
||||
'id': 'UHJvamVjdEVudHJ5Tm9kZTo2NQ==',
|
||||
'activity': 'Kill Thanos',
|
||||
'reflection': 'He sucks',
|
||||
'nextSteps': 'Go for the head',
|
||||
'documentUrl': '',
|
||||
'__typename': 'ProjectEntryNode',
|
||||
'created': '2020-01-20T15:20:31.262510+00:00',
|
||||
},
|
||||
'__typename': 'ProjectEntryNodeEdge',
|
||||
}],
|
||||
'__typename': 'ProjectEntryNodeConnection',
|
||||
},
|
||||
},
|
||||
},
|
||||
AddProjectEntry: variables => ({
|
||||
addProjectEntry: {
|
||||
projectEntry: Object.assign({}, variables.input.projectEntry, {
|
||||
created: '2020-01-20T15:26:58.722773+00:00',
|
||||
}),
|
||||
errors: null,
|
||||
__typename: 'AddProjectEntryPayload',
|
||||
},
|
||||
}),
|
||||
UpdateProjectEntry: variables => ({
|
||||
updateProjectEntry: {
|
||||
projectEntry: variables.input.projectEntry,
|
||||
errors: null,
|
||||
__typename: 'UpdateProjectEntryPayload',
|
||||
},
|
||||
}),
|
||||
DeleteProjectEntry: {
|
||||
deleteProjectEntry: {
|
||||
success: true,
|
||||
__typename: 'DeleteProjectEntryPayload',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
describe('Project Entry', () => {
|
||||
beforeEach(() => {
|
||||
cy.setup();
|
||||
|
||||
cy.task('getSchema').then(schema => {
|
||||
cy.mockGraphqlOps({
|
||||
operations,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
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.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.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', 1);
|
||||
|
||||
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', 0);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue