Fix room test
This commit is contained in:
parent
5785077edd
commit
33b476fcb0
|
|
@ -66,8 +66,8 @@ export default {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
recentModules: {
|
recentModules: {
|
||||||
edges: []
|
edges: [],
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
SchoolClassNode: () => ({
|
SchoolClassNode: () => ({
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
|
|
@ -93,7 +93,20 @@ export default {
|
||||||
}),
|
}),
|
||||||
TopicNode: () => ({
|
TopicNode: () => ({
|
||||||
modules: {
|
modules: {
|
||||||
edges: []
|
edges: [],
|
||||||
}
|
},
|
||||||
})
|
}),
|
||||||
|
RoomNode: () => ({
|
||||||
|
title: 'A Room',
|
||||||
|
entryCount: 3,
|
||||||
|
appearance: 'blue',
|
||||||
|
description: 'A Room description',
|
||||||
|
schoolClass: {
|
||||||
|
id: 'selectedClassId',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
RoomEntryNode: () => ({
|
||||||
|
title: 'A Room Entry',
|
||||||
|
contents: [],
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,10 @@ const me = require('../../fixtures/me.join-class.json');
|
||||||
|
|
||||||
describe('Onboarding', () => {
|
describe('Onboarding', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.server();
|
cy.setup();
|
||||||
|
|
||||||
cy.task('getSchema').then(schema => {
|
|
||||||
cy.mockGraphql({
|
|
||||||
schema,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows the onboarding steps and finishes them', () => {
|
it('shows the onboarding steps and finishes them', () => {
|
||||||
cy.fakeLogin('hansli', 'test');
|
|
||||||
|
|
||||||
cy.mockGraphqlOps({
|
cy.mockGraphqlOps({
|
||||||
operations: {
|
operations: {
|
||||||
MeQuery: {
|
MeQuery: {
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,61 @@
|
||||||
describe('The Room Page', () => {
|
import {getMinimalMe} from '../../../support/helpers';
|
||||||
it('displays new room entry with author name', () => {
|
|
||||||
// todo: mock all the graphql queries and mutations
|
|
||||||
|
|
||||||
cy.viewport('macbook-15');
|
describe('The Room Page', () => {
|
||||||
cy.apolloLogin('rachel.green', 'test');
|
const entryText = 'something should be here';
|
||||||
cy.visit('/room/ein-historisches-festival');
|
const entryTitle = 'some title';
|
||||||
|
const slug = 'ein-historisches-festival';
|
||||||
|
|
||||||
|
const operations = {
|
||||||
|
MeQuery: getMinimalMe({}),
|
||||||
|
RoomEntriesQuery: {
|
||||||
|
room: {
|
||||||
|
slug,
|
||||||
|
roomEntries: {
|
||||||
|
edges: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
AddRoomEntry: {
|
||||||
|
addRoomEntry: {
|
||||||
|
roomEntry: {
|
||||||
|
title: entryTitle,
|
||||||
|
contents: [
|
||||||
|
{
|
||||||
|
type: 'text_block',
|
||||||
|
value: {
|
||||||
|
text: entryText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
author: {
|
||||||
|
firstName: 'Rachel',
|
||||||
|
lastName: 'Green',
|
||||||
|
id: 'rachels-id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
errors: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.setup();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('displays new room entry with author name', () => {
|
||||||
|
cy.mockGraphqlOps({
|
||||||
|
operations,
|
||||||
|
});
|
||||||
|
cy.visit(`/room/${slug}`);
|
||||||
|
|
||||||
cy.get('[data-cy=add-room-entry-button]').click();
|
cy.get('[data-cy=add-room-entry-button]').click();
|
||||||
cy.get('.add-content-element:first-of-type').click();
|
cy.get('.add-content-element:first-of-type').click();
|
||||||
cy.get('[data-cy=choose-text-widget]').click();
|
cy.get('[data-cy=choose-text-widget]').click();
|
||||||
cy.get('[data-cy=modal-title-input] > .modal-input__inputfield').type('some title');
|
cy.get('[data-cy=modal-title-input] > .modal-input__inputfield').type(entryTitle);
|
||||||
|
|
||||||
let text = 'something should be here';
|
cy.get('[data-cy=text-form-input]').type(entryText);
|
||||||
cy.get('[data-cy=text-form-input]').type(text);
|
|
||||||
cy.get('[data-cy=modal-save-button]').click();
|
cy.get('[data-cy=modal-save-button]').click();
|
||||||
|
|
||||||
cy.get('.room-entry__content:first').should('contain', text).should('contain', 'Rachel Green');
|
cy.get('.room-entry__content:first').should('contain', entryText).should('contain', 'Rachel Green');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue