From 24898f5fe2e2c168fe78d977f28d3b11ae534252 Mon Sep 17 00:00:00 2001 From: Alina Beck Date: Tue, 21 Jan 2020 17:07:00 +0300 Subject: [PATCH] quick fix tests relying on classes of child components MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit changing class names in the UserTeaser leads to tests failing for other components, like SearchableInput and NotificationsTable – I just updated the classes but long-term it would be good to find a way to not rely on implementation details of child components – maybe just test if the child component is rendered? --- .../NotificationsTable/NotificationsTable.spec.js | 8 ++++---- webapp/components/features/ReportRow/ReportRow.vue | 12 ++---------- .../generic/SearchableInput/SearchableInput.spec.js | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/webapp/components/NotificationsTable/NotificationsTable.spec.js b/webapp/components/NotificationsTable/NotificationsTable.spec.js index 80095666f..ef4e19b01 100644 --- a/webapp/components/NotificationsTable/NotificationsTable.spec.js +++ b/webapp/components/NotificationsTable/NotificationsTable.spec.js @@ -89,8 +89,8 @@ describe('NotificationsTable.vue', () => { }) it('renders the author', () => { - const username = firstRowNotification.find('.username') - expect(username.text()).toEqual(postNotification.from.author.name) + const userinfo = firstRowNotification.find('.user-teaser > .info') + expect(userinfo.text()).toContain(postNotification.from.author.name) }) it('renders the reason for the notification', () => { @@ -122,8 +122,8 @@ describe('NotificationsTable.vue', () => { }) it('renders the author', () => { - const username = secondRowNotification.find('.username') - expect(username.text()).toEqual(commentNotification.from.author.name) + const userinfo = secondRowNotification.find('.user-teaser > .info') + expect(userinfo.text()).toContain(commentNotification.from.author.name) }) it('renders the reason for the notification', () => { diff --git a/webapp/components/features/ReportRow/ReportRow.vue b/webapp/components/features/ReportRow/ReportRow.vue index cd23d2ae2..72fd8d24e 100644 --- a/webapp/components/features/ReportRow/ReportRow.vue +++ b/webapp/components/features/ReportRow/ReportRow.vue @@ -19,11 +19,7 @@ - + {{ linkText | truncate(50) }} @@ -33,11 +29,7 @@ - + diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js index 5594896fb..c685ae3e6 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.spec.js +++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js @@ -97,7 +97,7 @@ describe('SearchableInput.vue', () => { it("pushes to user's profile", async () => { select.element.value = 'Bob' select.trigger('input') - const users = wrapper.findAll('.user-slug') + const users = wrapper.findAll('.slug') const bob = users.filter(item => item.text().match(/@bob-der-baumeister/)) bob.trigger('click') await Vue.nextTick()