From 0c8cc7380b7fe2a5da58353ddbe5aab9b658cd65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 8 Apr 2019 14:55:41 +0200 Subject: [PATCH] Minimal implementation to let cypress test pass --- cypress/integration/common/steps.js | 7 +++++-- webapp/layouts/default.vue | 15 +++++++++++++-- webapp/store/auth.js | 13 +++++++++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index 6ccde03f4..4286849c0 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -300,13 +300,16 @@ When('I log in with the following credentials:', table => { }) When('open the notification menu and click on the first item', () => { + cy.get('.notifications-menu').click() + cy.get('.notifications-menu-popover a').first().click() }) Then('see {int} unread notifications in the top menu', count => { - cy.find('.notifications-menu').should('contain', count) + cy.get('.notifications-menu').should('contain', count) }) Then('I get to the post page of {string}', path => { path = path.replace('...', '') - cy.location('pathname').should('contain', `/post/${path}`) + cy.location('pathname').should('contain', '/post/') + cy.location('pathname').should('contain', path) }) diff --git a/webapp/layouts/default.vue b/webapp/layouts/default.vue index 77aa32b2b..67edc52a3 100644 --- a/webapp/layouts/default.vue +++ b/webapp/layouts/default.vue @@ -42,13 +42,21 @@ icon="bell" @click.prevent="toggleMenu" > - 7 + 1 @@ -154,6 +162,9 @@ export default { } }, computed: { + notifications() { + return this.user.notifications + }, ...mapGetters({ user: 'auth/user', isLoggedIn: 'auth/isLoggedIn', diff --git a/webapp/store/auth.js b/webapp/store/auth.js index 4785ff0c0..688b8bed1 100644 --- a/webapp/store/auth.js +++ b/webapp/store/auth.js @@ -83,6 +83,19 @@ export const actions = { role about locationName + notifications(read: false, orderBy: createdAt_desc) { + id + read + createdAt + post { + author { + name + } + title + contentExcerpt + slug + } + } } }`) })