skillbox/client/cypress/integration/frontend/new-project.spec.js

59 lines
1.4 KiB
JavaScript

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: {
onboardingVisited: true
}
},
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');
});
});