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