From 8c29ad947b72fbaa173d070221cdf35b7ab6aaa5 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Fri, 10 Jan 2020 23:56:49 +0100 Subject: [PATCH 01/28] Update `vue-test-utils` and follow updated docs https://vue-test-utils.vuejs.org/guides/#writing-asynchronous-tests-using-nexttick-new --- .../CategoriesSelect/CategoriesSelect.spec.js | 4 +- .../CommentForm/CommentForm.spec.js | 3 +- .../ContributionForm/ContributionForm.spec.js | 19 ++++--- .../components/DeleteData/DeleteData.spec.js | 3 +- .../MasonryGrid/MasonryGrid.spec.js | 18 +++---- webapp/components/Modal.spec.js | 4 +- webapp/components/Modal/ReportModal.spec.js | 5 +- webapp/components/TeaserImage/TeaserImage.vue | 11 ++-- webapp/components/Upload/spec.js | 4 +- .../SearchableInput/SearchableInput.spec.js | 24 ++++----- webapp/package.json | 2 +- webapp/pages/settings/my-social-media.spec.js | 36 +++++++------ webapp/yarn.lock | 50 +++++++++++++++++-- 13 files changed, 117 insertions(+), 66 deletions(-) diff --git a/webapp/components/CategoriesSelect/CategoriesSelect.spec.js b/webapp/components/CategoriesSelect/CategoriesSelect.spec.js index b633e5811..82f5e61eb 100644 --- a/webapp/components/CategoriesSelect/CategoriesSelect.spec.js +++ b/webapp/components/CategoriesSelect/CategoriesSelect.spec.js @@ -1,5 +1,6 @@ import { mount } from '@vue/test-utils' import CategoriesSelect from './CategoriesSelect' +import Vue from 'vue' const localVue = global.localVue @@ -55,8 +56,9 @@ describe('CategoriesSelect.vue', () => { }) describe('toggleCategory', () => { - beforeEach(() => { + beforeEach(async () => { wrapper.vm.categories = categories + await Vue.nextTick() democracyAndPolitics = wrapper.findAll('button').at(0) democracyAndPolitics.trigger('click') }) diff --git a/webapp/components/CommentForm/CommentForm.spec.js b/webapp/components/CommentForm/CommentForm.spec.js index 47bc01982..bcfea323c 100644 --- a/webapp/components/CommentForm/CommentForm.spec.js +++ b/webapp/components/CommentForm/CommentForm.spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils' import CommentForm from './CommentForm' - +import Vue from 'vue' import MutationObserver from 'mutation-observer' global.MutationObserver = MutationObserver @@ -74,6 +74,7 @@ describe('CommentForm.vue', () => { it('calls `clear` method when the cancel button is clicked', async () => { wrapper.vm.updateEditorContent('ok') + await Vue.nextTick() await wrapper.find('.cancelBtn').trigger('submit') expect(cancelMethodSpy).toHaveBeenCalledTimes(1) }) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index a52169bd1..789b4e5cf 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -1,6 +1,7 @@ import { config, mount } from '@vue/test-utils' import ContributionForm from './ContributionForm.vue' +import Vue from 'vue' import Vuex from 'vuex' import PostMutations from '~/graphql/PostMutations.js' import CategoriesSelect from '~/components/CategoriesSelect/CategoriesSelect' @@ -147,31 +148,31 @@ describe('ContributionForm.vue', () => { dataPrivacyButton.trigger('click') }) - it('title should not be empty', async () => { + it('title cannot be empty', async () => { postTitleInput.setValue('') wrapper.find('form').trigger('submit') expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) - it('title should not be too long', async () => { + it('title cannot be too long', async () => { postTitleInput.setValue(postTitleTooLong) wrapper.find('form').trigger('submit') expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) - it('title should not be too short', async () => { + it('title cannot be too short', async () => { postTitleInput.setValue(postTitleTooShort) wrapper.find('form').trigger('submit') expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) - it('content should not be empty', async () => { + it('content cannot be empty', async () => { await wrapper.vm.updateEditorContent('') await wrapper.find('form').trigger('submit') expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) - it('should have at least one category', async () => { + it('has at least one category', async () => { dataPrivacyButton = await wrapper .find(CategoriesSelect) .find('[data-test="category-buttons-cat12"]') @@ -180,8 +181,9 @@ describe('ContributionForm.vue', () => { expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) - it('should have not have more than three categories', async () => { + it('has no more than three categories', async () => { wrapper.vm.form.categoryIds = ['cat4', 'cat9', 'cat15', 'cat27'] + await Vue.nextTick() wrapper.find('form').trigger('submit') expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) @@ -209,10 +211,12 @@ describe('ContributionForm.vue', () => { wrapper.find(CategoriesSelect).setData({ categories }) englishLanguage = wrapper.findAll('li').filter(language => language.text() === 'English') englishLanguage.trigger('click') + await Vue.nextTick() dataPrivacyButton = await wrapper .find(CategoriesSelect) .find('[data-test="category-buttons-cat12"]') dataPrivacyButton.trigger('click') + await Vue.nextTick() }) it('creates a post with valid title, content, and at least one category', async () => { @@ -278,10 +282,12 @@ describe('ContributionForm.vue', () => { wrapper.find(CategoriesSelect).setData({ categories }) englishLanguage = wrapper.findAll('li').filter(language => language.text() === 'English') englishLanguage.trigger('click') + await Vue.nextTick() dataPrivacyButton = await wrapper .find(CategoriesSelect) .find('[data-test="category-buttons-cat12"]') dataPrivacyButton.trigger('click') + await Vue.nextTick() }) it('shows an error toaster when apollo mutation rejects', async () => { @@ -370,6 +376,7 @@ describe('ContributionForm.vue', () => { it('supports updating categories', async () => { expectedParams.variables.categoryIds.push('cat3') wrapper.find(CategoriesSelect).setData({ categories }) + await Vue.nextTick() const healthWellbeingButton = await wrapper .find(CategoriesSelect) .find('[data-test="category-buttons-cat3"]') diff --git a/webapp/components/DeleteData/DeleteData.spec.js b/webapp/components/DeleteData/DeleteData.spec.js index abcdf9101..739bbe732 100644 --- a/webapp/components/DeleteData/DeleteData.spec.js +++ b/webapp/components/DeleteData/DeleteData.spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils' import DeleteData from './DeleteData.vue' - +import Vue from 'vue' import Vuex from 'vuex' const localVue = global.localVue @@ -168,6 +168,7 @@ describe('DeleteData.vue', () => { it('shows an error toaster when the mutation rejects', async () => { enableDeletionInput = wrapper.find('.enable-deletion-input input') enableDeletionInput.setValue(deleteAccountName) + await Vue.nextTick() deleteAccountBtn = wrapper.find('.ds-button-danger') await deleteAccountBtn.trigger('click') // second submission causes mutation to reject diff --git a/webapp/components/MasonryGrid/MasonryGrid.spec.js b/webapp/components/MasonryGrid/MasonryGrid.spec.js index b42b9b221..00e7859d8 100644 --- a/webapp/components/MasonryGrid/MasonryGrid.spec.js +++ b/webapp/components/MasonryGrid/MasonryGrid.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils' - +import Vue from 'vue' import MasonryGrid from './MasonryGrid' const localVue = global.localVue @@ -13,29 +13,29 @@ describe('MasonryGrid', () => { masonryGridItem = wrapper.vm.$children[0] }) - it('adds the "reset-grid-height" class when itemsCalculating is more than 0', () => { + it('adds the "reset-grid-height" class when itemsCalculating is more than 0', async () => { wrapper.setData({ itemsCalculating: 1 }) - + await Vue.nextTick() expect(wrapper.classes()).toContain('reset-grid-height') }) - it('removes the "reset-grid-height" class when itemsCalculating is 0', () => { + it('removes the "reset-grid-height" class when itemsCalculating is 0', async () => { wrapper.setData({ itemsCalculating: 0 }) - + await Vue.nextTick() expect(wrapper.classes()).not.toContain('reset-grid-height') }) - it('adds 1 to itemsCalculating when a child emits "calculating-item-height"', () => { + it('adds 1 to itemsCalculating when a child emits "calculating-item-height"', async () => { wrapper.setData({ itemsCalculating: 0 }) masonryGridItem.$emit('calculating-item-height') - + await Vue.nextTick() expect(wrapper.vm.itemsCalculating).toBe(1) }) - it('subtracts 1 from itemsCalculating when a child emits "finished-calculating-item-height"', () => { + it('subtracts 1 from itemsCalculating when a child emits "finished-calculating-item-height"', async () => { wrapper.setData({ itemsCalculating: 2 }) masonryGridItem.$emit('finished-calculating-item-height') - + await Vue.nextTick() expect(wrapper.vm.itemsCalculating).toBe(1) }) }) diff --git a/webapp/components/Modal.spec.js b/webapp/components/Modal.spec.js index 2dae4285a..c309d5684 100644 --- a/webapp/components/Modal.spec.js +++ b/webapp/components/Modal.spec.js @@ -5,6 +5,7 @@ import DisableModal from './Modal/DisableModal.vue' import ReportModal from './Modal/ReportModal.vue' import Vuex from 'vuex' import { getters, mutations } from '../store/modal' +import Vue from 'vue' const localVue = global.localVue @@ -89,8 +90,9 @@ describe('Modal.vue', () => { }) describe('child component emits close', () => { - it('turns empty', () => { + it('turns empty', async () => { wrapper.find(DisableModal).vm.$emit('close') + await Vue.nextTick() expect(wrapper.contains(DisableModal)).toBe(false) }) }) diff --git a/webapp/components/Modal/ReportModal.spec.js b/webapp/components/Modal/ReportModal.spec.js index b151f3c7b..de95cce99 100644 --- a/webapp/components/Modal/ReportModal.spec.js +++ b/webapp/components/Modal/ReportModal.spec.js @@ -1,5 +1,6 @@ import { config, shallowMount, mount } from '@vue/test-utils' import ReportModal from './ReportModal.vue' +import Vue from 'vue' const localVue = global.localVue @@ -151,9 +152,11 @@ describe('ReportModal.vue', () => { }) describe('click confirm button', () => { - beforeEach(() => { + beforeEach(async () => { wrapper.find('.ds-radio-option-label').trigger('click') + await Vue.nextTick() wrapper.find('button.confirm').trigger('click') + await Vue.nextTick() }) it('calls report mutation', () => { diff --git a/webapp/components/TeaserImage/TeaserImage.vue b/webapp/components/TeaserImage/TeaserImage.vue index a08b9e0ef..c2bf56459 100644 --- a/webapp/components/TeaserImage/TeaserImage.vue +++ b/webapp/components/TeaserImage/TeaserImage.vue @@ -62,14 +62,6 @@ export default { showCropper: false, } }, - watch: { - error() { - const that = this - setTimeout(function() { - that.error = false - }, 2000) - }, - }, methods: { template() { return `
@@ -82,6 +74,9 @@ export default { verror(file, message) { this.error = true this.$toast.error(file.status, message) + setTimeout(() => { + this.error = false + }, 2000) }, transformImage(file) { this.file = file diff --git a/webapp/components/Upload/spec.js b/webapp/components/Upload/spec.js index d9878ea2d..e60429974 100644 --- a/webapp/components/Upload/spec.js +++ b/webapp/components/Upload/spec.js @@ -1,4 +1,5 @@ import { shallowMount } from '@vue/test-utils' +import Vue from 'vue' import Upload from '.' const localVue = global.localVue @@ -57,8 +58,9 @@ describe('Upload', () => { expect(mocks.$toast.error).toHaveBeenCalledWith(fileError.status, message) }) - it('changes error status from false to true to false', () => { + it('changes error status from false to true to false', async () => { wrapper.vm.verror(fileError, message) + await Vue.nextTick() expect(wrapper.vm.error).toEqual(true) jest.runAllTimers() expect(wrapper.vm.error).toEqual(false) diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js index db314630f..0ebcda63f 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.spec.js +++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js @@ -45,14 +45,16 @@ describe('SearchableInput.vue', () => { expect(wrapper.find('.is-open').exists()).toBe(true) }) - it('opens the select dropdown and blurs after focused on', () => { + it('opens the select dropdown and blurs after focused on', async () => { select.trigger('blur') + await Vue.nextTick() expect(wrapper.find('.is-open').exists()).toBe(false) }) - it('is clearable', () => { + it('is clearable', async () => { select.trigger('input') select.trigger('keyup.esc') + await Vue.nextTick() expect(wrapper.find('.is-open').exists()).toBe(false) }) @@ -88,11 +90,10 @@ describe('SearchableInput.vue', () => { select.trigger('input') const post = wrapper.find('.search-post') post.trigger('click') - await Vue.nextTick().then(() => { - expect(mocks.$router.push).toHaveBeenCalledWith({ - name: 'post-id-slug', - params: { id: 'post-by-jenny', slug: 'user-post-by-jenny' }, - }) + await Vue.nextTick() + expect(mocks.$router.push).toHaveBeenCalledWith({ + name: 'post-id-slug', + params: { id: 'post-by-jenny', slug: 'user-post-by-jenny' }, }) }) @@ -102,11 +103,10 @@ describe('SearchableInput.vue', () => { const users = wrapper.findAll('.userinfo') const bob = users.filter(item => item.text() === '@bob-der-baumeister') bob.trigger('click') - await Vue.nextTick().then(() => { - expect(mocks.$router.push).toHaveBeenCalledWith({ - name: 'profile-id-slug', - params: { id: 'u2', slug: 'bob-der-baumeister' }, - }) + await Vue.nextTick() + expect(mocks.$router.push).toHaveBeenCalledWith({ + name: 'profile-id-slug', + params: { id: 'u2', slug: 'bob-der-baumeister' }, }) }) }) diff --git a/webapp/package.json b/webapp/package.json index 1e56f3201..2928fe343 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -106,7 +106,7 @@ "@vue/cli-shared-utils": "~4.1.2", "@vue/eslint-config-prettier": "~6.0.0", "@vue/server-test-utils": "~1.0.0-beta.30", - "@vue/test-utils": "~1.0.0-beta.29", + "@vue/test-utils": "~1.0.0-beta.30", "async-validator": "^3.2.3", "babel-core": "~7.0.0-bridge.0", "babel-eslint": "~10.0.3", diff --git a/webapp/pages/settings/my-social-media.spec.js b/webapp/pages/settings/my-social-media.spec.js index b1c9e0649..dd3c1c2c3 100644 --- a/webapp/pages/settings/my-social-media.spec.js +++ b/webapp/pages/settings/my-social-media.spec.js @@ -2,6 +2,7 @@ import { mount } from '@vue/test-utils' import flushPromises from 'flush-promises' import MySocialMedia from './my-social-media.vue' import Vuex from 'vuex' +import Vue from 'vue' const localVue = global.localVue @@ -48,10 +49,10 @@ describe('my-social-media.vue', () => { submitButton = wrapper.find('button') }) - it('requires the link to be a valid url', () => { + it('requires the link to be a valid url', async () => { input.setValue('some value') form.trigger('submit') - + await Vue.nextTick() expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) @@ -59,19 +60,19 @@ describe('my-social-media.vue', () => { mocks.$apollo.mutate.mockRejectedValue({ message: 'Ouch!' }) input.setValue(newSocialMediaUrl) form.trigger('submit') - + await Vue.nextTick() await flushPromises() - expect(mocks.$toast.error).toHaveBeenCalledTimes(1) }) describe('success', () => { - beforeEach(() => { + beforeEach(async () => { mocks.$apollo.mutate.mockResolvedValue({ data: { CreateSocialMedia: { id: 's2', url: newSocialMediaUrl } }, }) input.setValue(newSocialMediaUrl) form.trigger('submit') + await Vue.nextTick() }) it('sends the new url to the backend', () => { @@ -84,13 +85,11 @@ describe('my-social-media.vue', () => { it('displays a success message', async () => { await flushPromises() - expect(mocks.$toast.success).toHaveBeenCalledTimes(1) }) it('clears the form', async () => { await flushPromises() - expect(input.value).toBe(undefined) expect(submitButton.vm.$attrs.disabled).toBe(true) }) @@ -127,19 +126,18 @@ describe('my-social-media.vue', () => { }) }) - it('does not accept a duplicate url', () => { - input = wrapper.find('input#addSocialMedia') - - input.setValue(socialMediaUrl) + it('does not accept a duplicate url', async () => { + wrapper.find('input#addSocialMedia').setValue(socialMediaUrl) form.trigger('submit') - + await Vue.nextTick() expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) describe('editing social media link', () => { - beforeEach(() => { + beforeEach(async () => { const editButton = wrapper.find('a[name="edit"]') editButton.trigger('click') + await Vue.nextTick() input = wrapper.find('input#editSocialMedia') }) @@ -149,28 +147,29 @@ describe('my-social-media.vue', () => { expect(addInput.exists()).toBe(false) }) - it('sends the new url to the backend', () => { + it('sends the new url to the backend', async () => { const expected = expect.objectContaining({ variables: { id: 's1', url: newSocialMediaUrl }, }) input.setValue(newSocialMediaUrl) form.trigger('submit') - + await Vue.nextTick() expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) }) - it('allows the user to cancel editing', () => { + it('allows the user to cancel editing', async () => { const cancelButton = wrapper.find('button#cancel') cancelButton.trigger('click') - + await Vue.nextTick() expect(wrapper.find('input#editSocialMedia').exists()).toBe(false) }) }) describe('deleting social media link', () => { - beforeEach(() => { + beforeEach(async () => { const deleteButton = wrapper.find('a[name="delete"]') deleteButton.trigger('click') + await Vue.nextTick() }) it('sends the link id to the backend', () => { @@ -184,7 +183,6 @@ describe('my-social-media.vue', () => { it('displays a success message', async () => { await flushPromises() - expect(mocks.$toast.success).toHaveBeenCalledTimes(1) }) }) diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 38208d897..20dbb098c 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -2861,13 +2861,14 @@ "@types/cheerio" "^0.22.10" cheerio "^1.0.0-rc.2" -"@vue/test-utils@~1.0.0-beta.29": - version "1.0.0-beta.29" - resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.0.0-beta.29.tgz#c942cf25e891cf081b6a03332b4ae1ef430726f0" - integrity sha512-yX4sxEIHh4M9yAbLA/ikpEnGKMNBCnoX98xE1RwxfhQVcn0MaXNSj1Qmac+ZydTj6VBSEVukchBogXBTwc+9iA== +"@vue/test-utils@~1.0.0-beta.30": + version "1.0.0-beta.30" + resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.0.0-beta.30.tgz#d5f26d1e2411fdb7fa7fdedb61b4b4ea4194c49d" + integrity sha512-Wyvcha9fNk8+kzTDwb3xWGjPkCPzHSYSwKP6MplrPTG/auhqoad7JqUEceZLc6u7AU4km2pPQ8/m9s0RgCZ0NA== dependencies: dom-event-types "^1.0.0" - lodash "^4.17.4" + lodash "^4.17.15" + pretty "^2.0.0" "@webassemblyjs/ast@1.8.5": version "1.8.5" @@ -5577,6 +5578,15 @@ concat-stream@^1.5.0: readable-stream "^2.2.2" typedarray "^0.0.6" +condense-newlines@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/condense-newlines/-/condense-newlines-0.2.1.tgz#3de985553139475d32502c83b02f60684d24c55f" + integrity sha1-PemFVTE5R10yUCyDsC9gaE0kxV8= + dependencies: + extend-shallow "^2.0.1" + is-whitespace "^0.3.0" + kind-of "^3.0.2" + config-chain@^1.1.12: version "1.1.12" resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" @@ -9255,6 +9265,11 @@ is-utf8@^0.2.0: resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" integrity sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI= +is-whitespace@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/is-whitespace/-/is-whitespace-0.3.0.tgz#1639ecb1be036aec69a54cbb401cfbed7114ab7f" + integrity sha1-Fjnssb4DauxppUy7QBz77XEUq38= + is-window@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-window/-/is-window-1.0.2.tgz#2c896ca53db97de45d3c33133a65d8c9f563480d" @@ -9747,6 +9762,17 @@ js-base64@^2.1.8: resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.5.1.tgz#1efa39ef2c5f7980bb1784ade4a8af2de3291121" integrity sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw== +js-beautify@^1.6.12: + version "1.10.2" + resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.10.2.tgz#88c9099cd6559402b124cfab18754936f8a7b178" + integrity sha512-ZtBYyNUYJIsBWERnQP0rPN9KjkrDfJcMjuVGcvXOUJrD1zmOGwhRwQ4msG+HJ+Ni/FA7+sRQEMYVzdTQDvnzvQ== + dependencies: + config-chain "^1.1.12" + editorconfig "^0.15.3" + glob "^7.1.3" + mkdirp "~0.5.1" + nopt "~4.0.1" + js-beautify@^1.6.14: version "1.10.0" resolved "https://registry.yarnpkg.com/js-beautify/-/js-beautify-1.10.0.tgz#9753a13c858d96828658cd18ae3ca0e5783ea672" @@ -12720,6 +12746,15 @@ pretty-time@^1.1.0: resolved "https://registry.yarnpkg.com/pretty-time/-/pretty-time-1.1.0.tgz#ffb7429afabb8535c346a34e41873adf3d74dd0e" integrity sha512-28iF6xPQrP8Oa6uxE6a1biz+lWeTOAPKggvjB8HAs6nVMKZwf5bG++632Dx614hIWgUPkgivRfG+a8uAXGTIbA== +pretty@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/pretty/-/pretty-2.0.0.tgz#adbc7960b7bbfe289a557dc5f737619a220d06a5" + integrity sha1-rbx5YLe7/iiaVX3F9zdhmiINBqU= + dependencies: + condense-newlines "^0.2.1" + extend-shallow "^2.0.1" + js-beautify "^1.6.12" + prismjs@^1.8.4, prismjs@~1.17.0: version "1.17.1" resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.17.1.tgz#e669fcbd4cdd873c35102881c33b14d0d68519be" @@ -14064,6 +14099,11 @@ serve-static@1.14.1, serve-static@^1.14.1: version "1.14.1" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" integrity sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg== + dependencies: + encodeurl "~1.0.2" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.17.1" server-destroy@^1.0.1: version "1.0.1" From 966cdc957434dc85085c1fd6fb7a2a9ca3d029dc Mon Sep 17 00:00:00 2001 From: roschaefer Date: Sun, 12 Jan 2020 17:35:31 +0100 Subject: [PATCH 02/28] fix #2229 I have to agree with @vbelolapotkov here. First of all the translation for German an English does not match and second it does not make an awful lot of sense to have "Report these actions" twice in the list. The English translation "Advocacy or encouragement to these behaviors." probably belongs into the section before. --- webapp/locales/de.json | 3 +-- webapp/locales/en.json | 3 +-- webapp/locales/es.json | 3 +-- webapp/locales/fr.json | 3 +-- webapp/locales/it.json | 3 +-- webapp/locales/pt.json | 5 ++--- webapp/locales/ru.json | 5 ++--- webapp/pages/code-of-conduct.vue | 2 +- 8 files changed, 10 insertions(+), 17 deletions(-) diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 3d9b44c3c..ced288f87 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -762,8 +762,7 @@ "4": "Temporärer Entzug von Schreibrechten", "5": "Vorübergehender Ausschluss aus dem Netzwerk", "6": "Endgültiger Ausschluss aus dem Netzwerk", - "7": "Verstöße gegen deutsches Recht können zur Anzeige gebracht werden.", - "8": "Meldung von Vorkommnissen" + "7": "Verstöße gegen deutsches Recht können zur Anzeige gebracht werden." } }, "get-help": "Wenn Du einem inakzeptablen Verhalten ausgesetzt bist, es miterlebst oder andere Bedenken hast, benachrichtige bitte so schnell wie möglich einen Organisator der Gemeinschaft und verlinke oder verweise auf den entsprechenden Inhalt:" diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 720220356..45da3c287 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -755,8 +755,7 @@ "4": "Temporary withdrawal of write permissions", "5": "Temporary exclusion from the network", "6": "Final exclusion from the network", - "7": "Violations of German law can be reported.", - "8": "Advocacy or encouragement to these behaviors." + "7": "Violations of German law can be reported." } }, "get-help": "If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible and link or refer to the corresponding content:" diff --git a/webapp/locales/es.json b/webapp/locales/es.json index 38a361962..c5500e5e6 100644 --- a/webapp/locales/es.json +++ b/webapp/locales/es.json @@ -757,8 +757,7 @@ "4": "Retirada temporal de permisos de escritura", "5": "Exclusión temporal de la red.", "6": "Exclusión definitiva de la red", - "7": "Las violaciones de la ley alemana pueden ser denunciadas.", - "8": "Notificación de incidentes" + "7": "Las violaciones de la ley alemana pueden ser denunciadas." } }, "get-help": "Si usted está sujeto a un comportamiento inaceptable, lo experimenta o tiene otras preocupaciones, por favor notifique a un organizador de la comunidad tan pronto como sea posible y enlace o apunte el contenido relevante:" diff --git a/webapp/locales/fr.json b/webapp/locales/fr.json index 6d31c2467..047c096cc 100644 --- a/webapp/locales/fr.json +++ b/webapp/locales/fr.json @@ -699,8 +699,7 @@ "4": "Retrait temporaire des droits d'écriture", "5": "Exclusion temporaire du réseau", "6": "Exclusion définitive du réseau", - "7": "Des violations du droit allemand peuvent être signalées.", - "8": "Plaidoyer ou encouragement à ces comportements." + "7": "Des violations du droit allemand peuvent être signalées." } }, "get-help": "Si vous êtes victime ou témoin d'un comportement inacceptable, ou si vous avez d'autres préoccupations, veuillez en aviser un organisateur communautaire dès que possible et établir un lien ou vous référer au contenu correspondant:" diff --git a/webapp/locales/it.json b/webapp/locales/it.json index 20acc01c5..bcfcea1cd 100644 --- a/webapp/locales/it.json +++ b/webapp/locales/it.json @@ -699,8 +699,7 @@ "4": "Revoca temporanea delle autorizzazioni di scrittura", "5": "Esclusione temporanea dalla rete", "6": "Esclusione definitiva dalla rete", - "7": "Violazioni della legge tedesca possono essere segnalate.", - "8": "Sostegno o incoraggiamento a questi comportamenti." + "7": "Violazioni della legge tedesca possono essere segnalate." } }, "get-help": "Se sei soggetto o testimone di un comportamento inaccettabile, o se hai altre preoccupazioni, ti preghiamo di avvisare al più presto un organizzatore della comunità e di fare riferimento al contenuto corrispondente:" diff --git a/webapp/locales/pt.json b/webapp/locales/pt.json index c8a2952b4..70610a1da 100644 --- a/webapp/locales/pt.json +++ b/webapp/locales/pt.json @@ -699,8 +699,7 @@ "4": "Retirada temporária de permissão de escrita", "5": "Exclusão temporária da rede", "6": "Exclusão definitiva da rede", - "7": "Violações da lei alemã podem ser denunciadas", - "8": "Divulgação ou incentivo a estes comportamentos." + "7": "Violações da lei alemã podem ser denunciadas" } }, "get-help": "Se você for vítima ou testemunhar um comportamento inaceitável, ou tiver qualquer outra preocupação, por favor notifique um organizador da comunidade o mais rápido possível e inclua o link ou mencione o conteúdo correspondente:" @@ -749,4 +748,4 @@ "donate-now": "Doe agora", "amount-of-total": "{amount} dos {total} € foram coletados" } -} \ No newline at end of file +} diff --git a/webapp/locales/ru.json b/webapp/locales/ru.json index 75483edfb..d2be12c55 100644 --- a/webapp/locales/ru.json +++ b/webapp/locales/ru.json @@ -91,8 +91,7 @@ "4": "Временный запрет на добавление контента", "5": "Временное исключение из сети", "6": "Окончательное исключение из сети", - "7": "Передача сведений о нарушениях немецкого законодательства.", - "8": "Пропаганда или поощрение такого поведения." + "7": "Передача сведений о нарушениях немецкого законодательства." }, "title": "Последствия неприемлемого поведения" }, @@ -811,4 +810,4 @@ "submitted": "Успешная загрузка!" } } -} \ No newline at end of file +} diff --git a/webapp/pages/code-of-conduct.vue b/webapp/pages/code-of-conduct.vue index d87747ac8..d7818a956 100644 --- a/webapp/pages/code-of-conduct.vue +++ b/webapp/pages/code-of-conduct.vue @@ -56,7 +56,7 @@ export default { }, { key: 'consequences', - items: [...Array(9).keys()], + items: [...Array(8).keys()], }, ], } From 4e8be08afc970907a1f0d697d22636f72c218229 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2020 12:10:16 +0000 Subject: [PATCH 03/28] build(deps): bump metascraper-video from 5.9.5 to 5.10.3 in /backend Bumps [metascraper-video](https://github.com/microlinkhq/metascraper) from 5.9.5 to 5.10.3. - [Release notes](https://github.com/microlinkhq/metascraper/releases) - [Changelog](https://github.com/microlinkhq/metascraper/blob/master/CHANGELOG.md) - [Commits](https://github.com/microlinkhq/metascraper/compare/v5.9.5...v5.10.3) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/package.json b/backend/package.json index 427d1a491..200abcad8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -76,7 +76,7 @@ "metascraper-soundcloud": "^5.9.5", "metascraper-title": "^5.10.3", "metascraper-url": "^5.10.3", - "metascraper-video": "^5.9.5", + "metascraper-video": "^5.10.3", "metascraper-youtube": "^5.9.5", "minimatch": "^3.0.4", "mustache": "^3.2.1", diff --git a/backend/yarn.lock b/backend/yarn.lock index f5ffb1b75..3de0d9c0f 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -6057,12 +6057,12 @@ metascraper-url@^5.10.3: dependencies: "@metascraper/helpers" "^5.10.3" -metascraper-video@^5.9.5: - version "5.9.5" - resolved "https://registry.yarnpkg.com/metascraper-video/-/metascraper-video-5.9.5.tgz#707eb9726a96a64ecd8f234a7716c021ccf10f3f" - integrity sha512-ApYCnVpEPy3+sLHxjMVXUVolHgdEOwpaiH41win4h5HmDX6jz/gWg3ENaHWfRLTn94Gc3c2Fjkqg/dwShRK0/A== +metascraper-video@^5.10.3: + version "5.10.3" + resolved "https://registry.yarnpkg.com/metascraper-video/-/metascraper-video-5.10.3.tgz#deb0510b247aff0c9f1777a9d790f0aa55fa2890" + integrity sha512-xXGtPWX1RYSEOkLDvIzD20+o4hrSYycN31briMwQkjL7ZcuSfGgILDOCXSnT+WcpEbRNNxAOmODvAxU5qGnqjQ== dependencies: - "@metascraper/helpers" "^5.9.5" + "@metascraper/helpers" "^5.10.3" lodash "~4.17.15" metascraper-youtube@^5.9.5: From 3686a93878532efb6ae4503d545216c09a56a48e Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Thu, 16 Jan 2020 13:11:49 +0100 Subject: [PATCH 04/28] Add nextTick to CreateUserAccount - there were changes that moved vue-test-utils from synchronous to asynchronous, which means we need to use nextTick before checking certain attributes. --- webapp/components/Registration/CreateUserAccount.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/components/Registration/CreateUserAccount.spec.js b/webapp/components/Registration/CreateUserAccount.spec.js index 8d1f1617d..faa9319e7 100644 --- a/webapp/components/Registration/CreateUserAccount.spec.js +++ b/webapp/components/Registration/CreateUserAccount.spec.js @@ -1,8 +1,8 @@ import { config, mount } from '@vue/test-utils' +import Vue from 'vue' import { VERSION } from '~/constants/terms-and-conditions-version.js' import CreateUserAccount from './CreateUserAccount' import { SignupVerificationMutation } from '~/graphql/Registration.js' - const localVue = global.localVue config.stubs['sweetalert-icon'] = '' @@ -110,6 +110,7 @@ describe('CreateUserAccount', () => { it('displays success', async () => { await action() + await Vue.nextTick() expect(mocks.$t).toHaveBeenCalledWith( 'components.registration.create-user-account.success', ) @@ -140,6 +141,7 @@ describe('CreateUserAccount', () => { it('displays form errors', async () => { await action() + await Vue.nextTick() expect(mocks.$t).toHaveBeenCalledWith( 'components.registration.create-user-account.error', ) From 6568b181e1fd17a7a18d77ba269e5146594308d0 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2020 16:56:10 +0100 Subject: [PATCH 05/28] build(deps): bump metascraper-youtube from 5.9.5 to 5.10.3 in /backend (#2794) Bumps [metascraper-youtube](https://github.com/microlinkhq/metascraper-youtube) from 5.9.5 to 5.10.3. - [Release notes](https://github.com/microlinkhq/metascraper-youtube/releases) - [Commits](https://github.com/microlinkhq/metascraper-youtube/commits) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/package.json b/backend/package.json index 93dae1f64..779a51185 100644 --- a/backend/package.json +++ b/backend/package.json @@ -77,7 +77,7 @@ "metascraper-title": "^5.10.3", "metascraper-url": "^5.10.3", "metascraper-video": "^5.10.3", - "metascraper-youtube": "^5.9.5", + "metascraper-youtube": "^5.10.3", "minimatch": "^3.0.4", "mustache": "^3.2.1", "neo4j-driver": "^4.0.1", diff --git a/backend/yarn.lock b/backend/yarn.lock index b765754a3..3a1865129 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -6065,12 +6065,12 @@ metascraper-video@^5.10.3: "@metascraper/helpers" "^5.10.3" lodash "~4.17.15" -metascraper-youtube@^5.9.5: - version "5.9.5" - resolved "https://registry.yarnpkg.com/metascraper-youtube/-/metascraper-youtube-5.9.5.tgz#0d67c3619cfaf5434fe51bd3d18be6a6f1b31c7f" - integrity sha512-xC6e6l08/qdqNp7rtyMWPumIh0tCqNhWJkL8F5BjMZCGA3iL2OYh82v26qH/H4GdMZlxSsglNJQTjl8ywcdEmw== +metascraper-youtube@^5.10.3: + version "5.10.3" + resolved "https://registry.yarnpkg.com/metascraper-youtube/-/metascraper-youtube-5.10.3.tgz#58a121ae9b7aa8f244cbbfde66b57884390b9d64" + integrity sha512-mK+pPu3XJt6RqdoUKlXvlO9Lj2Tf+cfZwqCL1zLi8piYIyjbXDEx8VAb5Yz+GxDR57UWeFugnMtn/CpSbSDMNg== dependencies: - "@metascraper/helpers" "^5.9.5" + "@metascraper/helpers" "^5.10.3" get-video-id "~3.1.4" is-reachable "~4.0.0" p-locate "~4.1.0" From 4631db0a1b6c364cd070cf97aeeb3711dab78c1a Mon Sep 17 00:00:00 2001 From: roschaefer Date: Sun, 12 Jan 2020 23:07:01 +0100 Subject: [PATCH 06/28] feat(webapp): Display deployed version in footer Remove VERSION file in favour of version entry in `package.json`. Parse this version in our build server scripts. This commit also introduces `standard-version` which we can use to generate our `CHANGELOG.md` with `yarn run release`. close #1831 --- .versionrc.json | 7 + VERSION | 1 - backend/package.json | 2 +- package.json | 9 +- scripts/docker_push.sh | 3 +- scripts/github_release.sh | 4 +- webapp/components/PageFooter/PageFooter.vue | 12 +- webapp/locales/de.json | 1 - webapp/locales/en.json | 1 - webapp/locales/es.json | 1 - webapp/locales/fr.json | 1 - webapp/locales/it.json | 1 - webapp/locales/nl.json | 1 - webapp/locales/pl.json | 1 - webapp/locales/pt.json | 3 +- webapp/locales/ru.json | 3 +- webapp/nuxt.config.js | 1 + webapp/package.json | 4 +- yarn.lock | 924 +++++++++++++++++++- 19 files changed, 934 insertions(+), 46 deletions(-) create mode 100644 .versionrc.json delete mode 100644 VERSION diff --git a/.versionrc.json b/.versionrc.json new file mode 100644 index 000000000..25c298f45 --- /dev/null +++ b/.versionrc.json @@ -0,0 +1,7 @@ +{ + "bumpFiles": [ + "package.json", + "backend/package.json", + "webapp/package.json" + ] +} diff --git a/VERSION b/VERSION deleted file mode 100644 index 0c62199f1..000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.2.1 diff --git a/backend/package.json b/backend/package.json index 779a51185..e80df24f8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "human-connection-backend", - "version": "0.0.1", + "version": "0.2.1", "description": "GraphQL Backend for Human Connection", "main": "src/index.js", "scripts": { diff --git a/package.json b/package.json index 14fd25508..0e8930251 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,10 @@ "description": "Fullstack and API tests with cypress and cucumber for Human Connection", "author": "Human Connection gGmbh", "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/Human-Connection/Human-Connection.git" + }, "cypress-cucumber-preprocessor": { "nonGlobalStepDefinitions": true }, @@ -18,7 +22,7 @@ "cypress:open": "cross-env cypress open --browser chromium", "cucumber:setup": "cd backend && yarn run dev", "cucumber": "wait-on tcp:4000 && cucumber-js --require-module @babel/register --exit", - "version": "auto-changelog -p" + "release": "standard-version" }, "devDependencies": { "@babel/core": "^7.8.3", @@ -41,7 +45,8 @@ "neo4j-driver": "^4.0.1", "neode": "^0.3.7", "npm-run-all": "^4.1.5", - "slug": "^2.1.0" + "slug": "^2.1.0", + "standard-version": "^7.1.0" }, "resolutions": { "set-value": "^2.0.1" diff --git a/scripts/docker_push.sh b/scripts/docker_push.sh index b342278b9..3c746af92 100755 --- a/scripts/docker_push.sh +++ b/scripts/docker_push.sh @@ -2,7 +2,8 @@ ROOT_DIR=$(dirname "$0")/.. # BUILD_COMMIT=${TRAVIS_COMMIT:-$(git rev-parse HEAD)} -IFS='.' read -r major minor patch < $ROOT_DIR/VERSION +VERSION=$(jq -r '.version' $ROOT_DIR/package.json) +IFS='.' read -r major minor patch <<< $VERSION apps=(nitro-web nitro-backend neo4j maintenance) tags=($major $major.$minor $major.$minor.$patch) diff --git a/scripts/github_release.sh b/scripts/github_release.sh index 81e63d8ff..93f50289d 100755 --- a/scripts/github_release.sh +++ b/scripts/github_release.sh @@ -2,7 +2,7 @@ ROOT_DIR=$(dirname "$0")/.. RELEASE_DIR="${ROOT_DIR}/release" -VERSION=$(<$ROOT_DIR/VERSION) +VERSION=$(jq -r ".version" $ROOT_DIR/package.json) # mkdir -p $RELEASE_DIR @@ -13,4 +13,4 @@ VERSION=$(<$ROOT_DIR/VERSION) # docker image save "humanconnection/${app}:latest" | gzip > "${RELEASE_DIR}/${app}.${VERSION}.tar.gz" # done -ghr -soft "${VERSION}" +ghr -c "${VERSION}" "${VERSION}" diff --git a/webapp/components/PageFooter/PageFooter.vue b/webapp/components/PageFooter/PageFooter.vue index e01aae817..61ba7fc71 100644 --- a/webapp/components/PageFooter/PageFooter.vue +++ b/webapp/components/PageFooter/PageFooter.vue @@ -18,12 +18,20 @@ {{ $t('site.faq') }} - - - {{ $t('site.changelog') }} + + {{ version }}
+ +