60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
const schema = require('../fixtures/schema.json');
|
|
|
|
describe('New project', () => {
|
|
it('creates a new project and displays it', () => {
|
|
cy.server();
|
|
|
|
cy.mockGraphql({
|
|
schema: schema,
|
|
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: 'Rahel',
|
|
lastName: 'Cueni',
|
|
id: 'VXNlck5vZGU6NQ==',
|
|
avatarUrl: '',
|
|
__typename: 'UserNode'
|
|
},
|
|
entriesCount: 0,
|
|
__typename: 'ProjectNode',
|
|
},
|
|
__typename: 'ProjectNodeEdge'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
AddProject: variables => ({
|
|
addProject: {
|
|
project: Object.assign({}, variables.input.project),
|
|
errors: null,
|
|
__typename: 'AddProjectPayload'
|
|
}
|
|
})
|
|
}
|
|
})
|
|
;
|
|
|
|
cy.viewport('macbook-15');
|
|
cy.apolloLogin('rahel.cueni', 'test');
|
|
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');
|
|
})
|
|
});
|