From b2c67569abf71428fcd74eb9c536f72068063ede Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 24 Oct 2018 16:04:57 +0200 Subject: [PATCH] Add e2e test for room entry addition --- client/cypress/integration/room-page.spec.js | 17 +++++++++++++ client/cypress/integration/rooms-page.spec.js | 11 +++++++-- .../content-block-form/ContentsForm.vue | 8 ++++--- .../ContentBlockElementChooserWidget.vue | 24 ++++++++++++++----- .../src/components/content-forms/TextForm.vue | 1 + .../components/rooms/AddRoomEntryButton.vue | 2 +- 6 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 client/cypress/integration/room-page.spec.js diff --git a/client/cypress/integration/room-page.spec.js b/client/cypress/integration/room-page.spec.js new file mode 100644 index 00000000..3a4dc1c6 --- /dev/null +++ b/client/cypress/integration/room-page.spec.js @@ -0,0 +1,17 @@ +describe('The Room Page', () => { + it.only('displays new room entry with author name', () => { + cy.login('rahel.cueni', 'test'); + + cy.visit('/room/ein-historisches-festival'); + cy.get('[data-cy=add-room-entry-button]').click(); + cy.get('.add-content-element:nth-child(1)').click(); + cy.get('[data-cy=choose-text-widget]').click(); + cy.get('[data-cy=modal-title-input] > .modal-input__inputfield').type('some title'); + + let text = 'something should be here'; + cy.get('[data-cy=text-form-input]').type(text); + cy.get('[data-cy=modal-save-button]').click(); + + cy.get('.room-entry__content:first').should('contain', text).should('contain', 'Rahel Cueni'); + }); +}); diff --git a/client/cypress/integration/rooms-page.spec.js b/client/cypress/integration/rooms-page.spec.js index ce510a85..82f6ec11 100644 --- a/client/cypress/integration/rooms-page.spec.js +++ b/client/cypress/integration/rooms-page.spec.js @@ -1,9 +1,16 @@ describe('The Rooms Page', () => { - it.only('goes to the rooms page', () => { - cy.login('rahel.cueni', 'test'); + it('goes to the rooms page', () => { + cy.login('nico.zickgraf', 'test'); cy.visit('/rooms'); cy.get('.add-room').should('exist'); }); + it('add room should not exist for student', () => { + cy.login('rahel.cueni', 'test'); + + cy.visit('/rooms'); + + cy.get('.add-room').should('not.exist'); + }); }); diff --git a/client/src/components/content-block-form/ContentsForm.vue b/client/src/components/content-block-form/ContentsForm.vue index 0bf84b87..ea12a699 100644 --- a/client/src/components/content-block-form/ContentsForm.vue +++ b/client/src/components/content-block-form/ContentsForm.vue @@ -4,7 +4,9 @@ + :error="error" + data-cy="modal-title-input" + >
- Speichern + Speichern Abbrechen
@@ -291,7 +293,7 @@ grid-column: 1 / span 2; } - &__task { + &__task { margin: 15px 0 10px; } } diff --git a/client/src/components/content-forms/ContentBlockElementChooserWidget.vue b/client/src/components/content-forms/ContentBlockElementChooserWidget.vue index 73f68e00..45756621 100644 --- a/client/src/components/content-forms/ContentBlockElementChooserWidget.vue +++ b/client/src/components/content-forms/ContentBlockElementChooserWidget.vue @@ -1,26 +1,38 @@