diff --git a/SUMMARY.md b/SUMMARY.md index 701eac2d0..c281e2fae 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -27,6 +27,7 @@ * [Kubernetes Dashboard](deployment/digital-ocean/dashboard/README.md) * [HTTPS](deployment/digital-ocean/https/README.md) * [Human Connection](deployment/human-connection/README.md) + * [Mailserver](deployment/human-connection/mailserver/README.md) * [Volumes](deployment/volumes/README.md) * [Neo4J Offline-Backups](deployment/volumes/neo4j-offline-backup/README.md) * [Volume Snapshots](deployment/volumes/volume-snapshots/README.md) diff --git a/backend/package.json b/backend/package.json index 85a51fa14..276daed2f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -47,16 +47,16 @@ "apollo-client": "~2.6.3", "apollo-link-context": "~1.0.18", "apollo-link-http": "~1.5.15", - "apollo-server": "~2.6.4", + "apollo-server": "~2.6.6", "bcryptjs": "~2.4.3", "cheerio": "~1.0.0-rc.3", "cors": "~2.8.5", "cross-env": "~5.2.0", - "date-fns": "2.0.0-alpha.35", + "date-fns": "2.0.0-alpha.37", "debug": "~4.1.1", "dotenv": "~8.0.0", "express": "~4.17.1", - "faker": "~4.1.0", + "faker": "Marak/faker.js#master", "graphql": "~14.3.1", "graphql-custom-directives": "~0.2.14", "graphql-iso-date": "~3.6.1", @@ -70,7 +70,7 @@ "lodash": "~4.17.11", "merge-graphql-schemas": "^1.5.8", "neo4j-driver": "~1.7.4", - "neo4j-graphql-js": "git+https://github.com/Human-Connection/neo4j-graphql-js.git#temporary_fixes", + "neo4j-graphql-js": "^2.6.3", "node-fetch": "~2.6.0", "nodemailer": "^6.2.1", "npm-run-all": "~4.1.5", @@ -88,20 +88,20 @@ "@babel/plugin-proposal-throw-expressions": "^7.2.0", "@babel/preset-env": "~7.4.5", "@babel/register": "~7.4.4", - "apollo-server-testing": "~2.6.4", + "apollo-server-testing": "~2.6.6", "babel-core": "~7.0.0-0", "babel-eslint": "~10.0.2", "babel-jest": "~24.8.0", "chai": "~4.2.0", "cucumber": "~5.1.0", - "eslint": "~5.16.0", + "eslint": "~6.0.1", "eslint-config-prettier": "~5.0.0", "eslint-config-standard": "~12.0.0", - "eslint-plugin-import": "~2.17.3", - "eslint-plugin-jest": "~22.7.0", + "eslint-plugin-import": "~2.18.0", + "eslint-plugin-jest": "~22.7.1", "eslint-plugin-node": "~9.1.0", "eslint-plugin-prettier": "~3.1.0", - "eslint-plugin-promise": "~4.1.1", + "eslint-plugin-promise": "~4.2.1", "eslint-plugin-standard": "~4.0.0", "graphql-request": "~1.8.2", "jest": "~24.8.0", diff --git a/backend/src/schema/resolvers/comments.js b/backend/src/schema/resolvers/comments.js index 7f3b11da4..d2e296596 100644 --- a/backend/src/schema/resolvers/comments.js +++ b/backend/src/schema/resolvers/comments.js @@ -38,22 +38,41 @@ export default { if (!post) { throw new UserInputError(NO_POST_ERR_MESSAGE) } - const comment = await neo4jgraphql(object, params, context, resolveInfo, false) + const commentWithoutRelationships = await neo4jgraphql( + object, + params, + context, + resolveInfo, + false, + ) - await session.run( + let transactionRes = await session.run( ` MATCH (post:Post {id: $postId}), (comment:Comment {id: $commentId}), (author:User {id: $userId}) MERGE (post)<-[:COMMENTS]-(comment)<-[:WROTE]-(author) - RETURN post`, + RETURN comment, author`, { userId: context.user.id, postId, - commentId: comment.id, + commentId: commentWithoutRelationships.id, }, ) - session.close() - return comment + const [commentWithAuthor] = transactionRes.records.map(record => { + return { + comment: record.get('comment'), + author: record.get('author'), + } + }) + + const { comment, author } = commentWithAuthor + + const commentReturnedWithAuthor = { + ...comment.properties, + author: author.properties, + } + session.close() + return commentReturnedWithAuthor }, DeleteComment: async (object, params, context, resolveInfo) => { const comment = await neo4jgraphql(object, params, context, resolveInfo, false) diff --git a/backend/src/seed/factories/posts.js b/backend/src/seed/factories/posts.js index ea92f7d9f..b8e30ee2e 100644 --- a/backend/src/seed/factories/posts.js +++ b/backend/src/seed/factories/posts.js @@ -13,7 +13,7 @@ export default function(params) { faker.lorem.sentence(), faker.lorem.sentence(), ].join('. '), - image = faker.image.image(), + image = faker.image.unsplash.imageUrl(), visibility = 'public', deleted = false, } = params diff --git a/backend/src/seed/seed-db.js b/backend/src/seed/seed-db.js index 27af1106a..27c07868d 100644 --- a/backend/src/seed/seed-db.js +++ b/backend/src/seed/seed-db.js @@ -214,21 +214,21 @@ import Factory from './factories' 'Hey @jenny-rostock, here is another notification for you!' await Promise.all([ - asAdmin.create('Post', { id: 'p0' }), - asModerator.create('Post', { id: 'p1' }), + asAdmin.create('Post', { id: 'p0', image: faker.image.unsplash.food() }), + asModerator.create('Post', { id: 'p1', image: faker.image.unsplash.technology() }), asUser.create('Post', { id: 'p2' }), asTick.create('Post', { id: 'p3' }), asTrick.create('Post', { id: 'p4' }), asTrack.create('Post', { id: 'p5' }), - asAdmin.create('Post', { id: 'p6' }), + asAdmin.create('Post', { id: 'p6', image: faker.image.unsplash.buildings() }), asModerator.create('Post', { id: 'p7', content: `${mention1} ${faker.lorem.paragraph()}` }), - asUser.create('Post', { id: 'p8' }), + asUser.create('Post', { id: 'p8', image: faker.image.unsplash.nature() }), asTick.create('Post', { id: 'p9' }), asTrick.create('Post', { id: 'p10' }), - asTrack.create('Post', { id: 'p11' }), + asTrack.create('Post', { id: 'p11', image: faker.image.unsplash.people() }), asAdmin.create('Post', { id: 'p12', content: `${mention2} ${faker.lorem.paragraph()}` }), asModerator.create('Post', { id: 'p13' }), - asUser.create('Post', { id: 'p14' }), + asUser.create('Post', { id: 'p14', image: faker.image.unsplash.objects() }), asTick.create('Post', { id: 'p15' }), ]) diff --git a/backend/yarn.lock b/backend/yarn.lock index dee5b8d20..eb6a714ea 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -1217,10 +1217,10 @@ activitystreams-context@>=3.0.0, activitystreams-context@^3.0.0: resolved "https://registry.yarnpkg.com/activitystreams-context/-/activitystreams-context-3.1.0.tgz#28334e129f17cfb937e8c702c52c1bcb1d2830c7" integrity sha512-KBQ+igwf1tezMXGVw5MvRSEm0gp97JI1hTZ45I6MEkWv25lEgNoA9L6wqfaOiCX8wnMRWw9pwRsPZKypdtxAtg== -ajv@^6.5.5, ajv@^6.9.1: - version "6.9.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.9.2.tgz#4927adb83e7f48e5a32b45729744c71ec39c9c7b" - integrity sha512-4UFy0/LgDo7Oa/+wOAlj44tp9K78u38E5/359eSrqEp1Z5PdVfimCcs7SluXMP755RUQu6d2b4AvF0R1C9RZjg== +ajv@^6.10.0, ajv@^6.5.5, ajv@^6.9.1: + version "6.10.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1" + integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg== dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" @@ -1279,13 +1279,13 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" -apollo-cache-control@0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/apollo-cache-control/-/apollo-cache-control-0.7.2.tgz#b8852422d973c582493e85c776abc9c660090162" - integrity sha512-7prjFN8H9lRE0npqGG8kM3XICvNCcgQt6eCy8kkcPOIZwM+F8m8ShjEfNF9UWW32i+poOk3G67HegPRyjCc6/Q== +apollo-cache-control@0.7.4: + version "0.7.4" + resolved "https://registry.yarnpkg.com/apollo-cache-control/-/apollo-cache-control-0.7.4.tgz#0cb5c7be0e0dd0c44b1257144cd7f9f2a3c374e6" + integrity sha512-TVACHwcEF4wfHo5H9FLnoNjo0SLDo2jPW+bXs9aw0Y4Z2UisskSAPnIYOqUPnU8SoeNvs7zWgbLizq11SRTJtg== dependencies: apollo-server-env "2.4.0" - graphql-extensions "0.7.2" + graphql-extensions "0.7.4" apollo-cache-control@^0.1.0: version "0.1.1" @@ -1342,17 +1342,17 @@ apollo-engine-reporting-protobuf@0.3.1: dependencies: protobufjs "^6.8.6" -apollo-engine-reporting@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/apollo-engine-reporting/-/apollo-engine-reporting-1.3.2.tgz#b2569f79eb1a7a7380f49340db61465f449284fe" - integrity sha512-Q9XUZ3CTqddjCswlbn+OD2oYxZ5p4lCAnsWOGMfYnSmCXLagyNK28UFFQodjFOy73p6nlTAg9cwaJ9yMOBeeXA== +apollo-engine-reporting@1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/apollo-engine-reporting/-/apollo-engine-reporting-1.3.4.tgz#65e12f94221d80b3b1740c26e82ce9bb6bdfb7ee" + integrity sha512-DJdYghyUBzT0/LcPLwuQNXDCw06r1RfxkVfNTGKoTv6a+leVvjhDJmXvc+jSuBPwaNsc+RYRnfyQ2qUn9fmfyA== dependencies: apollo-engine-reporting-protobuf "0.3.1" apollo-graphql "^0.3.2" - apollo-server-core "2.6.4" + apollo-server-core "2.6.6" apollo-server-env "2.4.0" async-retry "^1.2.1" - graphql-extensions "0.7.3" + graphql-extensions "0.7.5" apollo-env@0.5.1: version "0.5.1" @@ -1422,24 +1422,24 @@ apollo-server-caching@0.4.0: dependencies: lru-cache "^5.0.0" -apollo-server-core@2.6.4: - version "2.6.4" - resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-2.6.4.tgz#0372e3a28f221b9db83bdfbb0fd0b2960cd29bab" - integrity sha512-GBF+tQoJ/ysaY2CYMkuuAwJM1nk1yLJumrsBTFfcvalSzS64VdS5VN/zox1eRI+LHQQzHM18HYEAgDGa/EX+gw== +apollo-server-core@2.6.6: + version "2.6.6" + resolved "https://registry.yarnpkg.com/apollo-server-core/-/apollo-server-core-2.6.6.tgz#55fea7980a943948c49dea20d81b9bbfc0e04f87" + integrity sha512-PFSjJbqkV1eetfFJxu11gzklQYC8BrF0RZfvC1d1mhvtxAOKl25uhPHxltN0Omyjp7LW4YeoC6zwl9rLWuhZFQ== dependencies: "@apollographql/apollo-tools" "^0.3.6" "@apollographql/graphql-playground-html" "1.6.20" "@types/ws" "^6.0.0" - apollo-cache-control "0.7.2" + apollo-cache-control "0.7.4" apollo-datasource "0.5.0" - apollo-engine-reporting "1.3.2" + apollo-engine-reporting "1.3.4" apollo-server-caching "0.4.0" apollo-server-env "2.4.0" apollo-server-errors "2.3.0" - apollo-server-plugin-base "0.5.3" - apollo-tracing "0.7.2" + apollo-server-plugin-base "0.5.5" + apollo-tracing "0.7.3" fast-json-stable-stringify "^2.0.0" - graphql-extensions "0.7.3" + graphql-extensions "0.7.5" graphql-subscriptions "^1.0.0" graphql-tag "^2.9.2" graphql-tools "^4.0.0" @@ -1470,10 +1470,10 @@ apollo-server-errors@2.3.0: resolved "https://registry.yarnpkg.com/apollo-server-errors/-/apollo-server-errors-2.3.0.tgz#700622b66a16dffcad3b017e4796749814edc061" integrity sha512-rUvzwMo2ZQgzzPh2kcJyfbRSfVKRMhfIlhY7BzUfM4x6ZT0aijlgsf714Ll3Mbf5Fxii32kD0A/DmKsTecpccw== -apollo-server-express@2.6.4: - version "2.6.4" - resolved "https://registry.yarnpkg.com/apollo-server-express/-/apollo-server-express-2.6.4.tgz#fc1d661be73fc1880aa53a56e1abe3733d08eada" - integrity sha512-U6hiZxty/rait39V5d+QeueNHlwfl68WbYtsutDUVxnq2Jws2ZDrvIkaWWN6HQ77+nBy5gGVxycvWIyoHHfi+g== +apollo-server-express@2.6.6: + version "2.6.6" + resolved "https://registry.yarnpkg.com/apollo-server-express/-/apollo-server-express-2.6.6.tgz#ec2b955354d7dd4d12fe01ea7e983d302071d5b9" + integrity sha512-bY/xrr9lZH+hsjchiQuSXpW3ivXfL1h81M5VE9Ppus1PVwwEIar/irBN+PFp97WxERZPDjVZzrRKa+lRHjtJsA== dependencies: "@apollographql/graphql-playground-html" "1.6.20" "@types/accepts" "^1.3.5" @@ -1481,7 +1481,7 @@ apollo-server-express@2.6.4: "@types/cors" "^2.8.4" "@types/express" "4.17.0" accepts "^1.3.5" - apollo-server-core "2.6.4" + apollo-server-core "2.6.6" body-parser "^1.18.3" cors "^2.8.4" graphql-subscriptions "^1.0.0" @@ -1509,36 +1509,36 @@ apollo-server-module-graphiql@^1.3.4, apollo-server-module-graphiql@^1.4.0: resolved "https://registry.yarnpkg.com/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.4.0.tgz#c559efa285578820709f1769bb85d3b3eed3d8ec" integrity sha512-GmkOcb5he2x5gat+TuiTvabnBf1m4jzdecal3XbXBh/Jg+kx4hcvO3TTDFQ9CuTprtzdcVyA11iqG7iOMOt7vA== -apollo-server-plugin-base@0.5.3: - version "0.5.3" - resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.5.3.tgz#234c6330c412a2e83ff49305a0c2f991fb40a266" - integrity sha512-Ax043vQTzPgFeJk6m6hmPm9NMfogO3LlTKJfrWHuyZhPNeTLweHNK30vpdzzgPalcryyDMDfLYFzxuDm0W+rRQ== +apollo-server-plugin-base@0.5.5: + version "0.5.5" + resolved "https://registry.yarnpkg.com/apollo-server-plugin-base/-/apollo-server-plugin-base-0.5.5.tgz#364e4a2fca4d95ddeb9fd3e78940ed1da58865c2" + integrity sha512-agiuhknyu3lnnEsqUh99tzxwPCGp+TuDK+TSRTkXU1RUG6lY4C3uJp0JGJw03cP+M6ze73TbRjMA4E68g/ks5A== -apollo-server-testing@~2.6.4: - version "2.6.4" - resolved "https://registry.yarnpkg.com/apollo-server-testing/-/apollo-server-testing-2.6.4.tgz#615dfaa6ea840b6ea3ce4fd2297b28402f2d5208" - integrity sha512-s9AeZnnndhz4WRBmgFM388BFKqD2H90L6ax0e6uNEmtZk3/iODqd16RbTNHbx+PkxFvZ8BQbX1/4rbvQn6r9CA== +apollo-server-testing@~2.6.6: + version "2.6.6" + resolved "https://registry.yarnpkg.com/apollo-server-testing/-/apollo-server-testing-2.6.6.tgz#3d96486ebdb151219183fcb715973a8385c66e0a" + integrity sha512-GfzEAqXGzhWp1YgNJONAijC3mC34E6cI5XiOdLX9FGAnBmZvDURlZwloZbdNgvqvXnwuxuNgo4xvCnTe7kndqg== dependencies: - apollo-server-core "2.6.4" + apollo-server-core "2.6.6" -apollo-server@~2.6.4: - version "2.6.4" - resolved "https://registry.yarnpkg.com/apollo-server/-/apollo-server-2.6.4.tgz#34b3a50135e20b8df8c194a14e4636eb9c2898b2" - integrity sha512-f0TZOc969XNNlSm8sVsU34D8caQfPNwS0oqmWUxb8xXl88HlFzB+HBmOU6ZEKdpMCksTNDbqYo0jXiGJ0rL/0g== +apollo-server@~2.6.6: + version "2.6.6" + resolved "https://registry.yarnpkg.com/apollo-server/-/apollo-server-2.6.6.tgz#0570fce4a682eb1de8bc1b86dbe2543de440cd4e" + integrity sha512-7Bulb3RnOO4/SGA66LXu3ZHCXIK8MYMrsxy4yti1/adDIUmcniolDqJwOYUGoTmv1AQjRxgJb4TVZ0Dk9nrrYg== dependencies: - apollo-server-core "2.6.4" - apollo-server-express "2.6.4" + apollo-server-core "2.6.6" + apollo-server-express "2.6.6" express "^4.0.0" graphql-subscriptions "^1.0.0" graphql-tools "^4.0.0" -apollo-tracing@0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/apollo-tracing/-/apollo-tracing-0.7.2.tgz#7730159a4670bca465ac1bfa01f9902610a7aba4" - integrity sha512-bT4/n8Vy9DweC3+XWJelJD41FBlKMXR0OVxjLMiCe9clb4yTgKhYxRGTyh9KjmhWsng9gG/DphO0ixWsOgdXmA== +apollo-tracing@0.7.3: + version "0.7.3" + resolved "https://registry.yarnpkg.com/apollo-tracing/-/apollo-tracing-0.7.3.tgz#8533e3e2dca2d5a25e8439ce498ea33ff4d159ee" + integrity sha512-H6fSC+awQGnfDyYdGIB0UQUhcUC3n5Vy+ujacJ0bY6R+vwWeZOQvu7wRHNjk/rbOSTLCo9A0OcVX7huRyu9SZg== dependencies: apollo-server-env "2.4.0" - graphql-extensions "0.7.2" + graphql-extensions "0.7.4" apollo-tracing@^0.1.0: version "0.1.4" @@ -2584,10 +2584,10 @@ data-urls@^1.0.0: whatwg-mimetype "^2.2.0" whatwg-url "^7.0.0" -date-fns@2.0.0-alpha.35: - version "2.0.0-alpha.35" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.35.tgz#185813cdc51b05cc1468a95116494bb3f3440934" - integrity sha512-dAY1ujqRtyUsa9mVeupyMzUluWo1d7kAMwyXTQHFImKYSHKvxDw/dipiY6fdswQOs8CwpGoiKysGfaaRP5r3bA== +date-fns@2.0.0-alpha.37: + version "2.0.0-alpha.37" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.37.tgz#c58b3e827da4f860ec8dc123e54019efb4a610e0" + integrity sha512-fyIv/h6fkFd1u2NHXni5LPRPoa9FFh3hY67JSjNfa+k/u4EKvfrpGtoTM16Y/BJOqTb4W05UjcmwBna1ElyxDA== debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" @@ -3036,10 +3036,10 @@ eslint-plugin-es@^1.4.0: eslint-utils "^1.3.0" regexpp "^2.0.1" -eslint-plugin-import@~2.17.3: - version "2.17.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.17.3.tgz#00548b4434c18faebaba04b24ae6198f280de189" - integrity sha512-qeVf/UwXFJbeyLbxuY8RgqDyEKCkqV7YC+E5S5uOjAp4tOc8zj01JP3ucoBM8JcEqd1qRasJSg6LLlisirfy0Q== +eslint-plugin-import@~2.18.0: + version "2.18.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.0.tgz#7a5ba8d32622fb35eb9c8db195c2090bd18a3678" + integrity sha512-PZpAEC4gj/6DEMMoU2Df01C5c50r7zdGIN52Yfi7CvvWaYssG7Jt5R9nFG5gmqodxNOz9vQS87xk6Izdtpdrig== dependencies: array-includes "^3.0.3" contains-path "^0.1.0" @@ -3053,10 +3053,10 @@ eslint-plugin-import@~2.17.3: read-pkg-up "^2.0.0" resolve "^1.11.0" -eslint-plugin-jest@~22.7.0: - version "22.7.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.7.0.tgz#a1d325bccb024b04f5354c56fe790baba54a454c" - integrity sha512-0U9nBd9V6+GKpM/KvRDcmMuPsewSsdM7NxCozgJkVAh8IrwHmQ0aw44/eYuVkhT8Fcdhsz0zYiyPtKg147eXMQ== +eslint-plugin-jest@~22.7.1: + version "22.7.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.7.1.tgz#5dcdf8f7a285f98040378220d6beca581f0ab2a1" + integrity sha512-CrT3AzA738neimv8G8iK2HCkrCwHnAJeeo7k5TEHK86VMItKl6zdJT/tHBDImfnVVAYsVs4Y6BUdBZQCCgfiyw== eslint-plugin-node@~9.1.0: version "9.1.0" @@ -3077,10 +3077,10 @@ eslint-plugin-prettier@~3.1.0: dependencies: prettier-linter-helpers "^1.0.0" -eslint-plugin-promise@~4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.1.1.tgz#1e08cb68b5b2cd8839f8d5864c796f56d82746db" - integrity sha512-faAHw7uzlNPy7b45J1guyjazw28M+7gJokKUjC5JSFoYfUEyy6Gw/i7YQvmv2Yk00sUjWcmzXQLpU1Ki/C2IZQ== +eslint-plugin-promise@~4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a" + integrity sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw== eslint-plugin-standard@~4.0.0: version "4.0.0" @@ -3113,13 +3113,13 @@ eslint-visitor-keys@^1.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== -eslint@~5.16.0: - version "5.16.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" - integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== +eslint@~6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.0.1.tgz#4a32181d72cb999d6f54151df7d337131f81cda7" + integrity sha512-DyQRaMmORQ+JsWShYsSg4OPTjY56u1nCjAmICrE8vLWqyLKxhFXOthwMj1SA8xwfrv0CofLNVnqbfyhwCkaO0w== dependencies: "@babel/code-frame" "^7.0.0" - ajv "^6.9.1" + ajv "^6.10.0" chalk "^2.1.0" cross-spawn "^6.0.5" debug "^4.0.1" @@ -3127,18 +3127,19 @@ eslint@~5.16.0: eslint-scope "^4.0.3" eslint-utils "^1.3.1" eslint-visitor-keys "^1.0.0" - espree "^5.0.1" + espree "^6.0.0" esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob "^7.1.2" + glob-parent "^3.1.0" globals "^11.7.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" inquirer "^6.2.2" - js-yaml "^3.13.0" + is-glob "^4.0.0" + js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" lodash "^4.17.11" @@ -3146,7 +3147,6 @@ eslint@~5.16.0: mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" - path-is-inside "^1.0.2" progress "^2.0.0" regexpp "^2.0.1" semver "^5.5.1" @@ -3155,10 +3155,10 @@ eslint@~5.16.0: table "^5.2.3" text-table "^0.2.0" -espree@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" - integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A== +espree@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.0.0.tgz#716fc1f5a245ef5b9a7fdb1d7b0d3f02322e75f6" + integrity sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q== dependencies: acorn "^6.0.7" acorn-jsx "^5.0.0" @@ -3373,10 +3373,9 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= -faker@~4.1.0: +faker@Marak/faker.js#master: version "4.1.0" - resolved "https://registry.yarnpkg.com/faker/-/faker-4.1.0.tgz#1e45bbbecc6774b3c195fad2835109c6d748cc3f" - integrity sha1-HkW7vsxndLPBlfrSg1EJxtdIzD8= + resolved "https://codeload.github.com/Marak/faker.js/tar.gz/10bfb9f467b0ac2b8912ffc15690b50ef3244f09" fast-deep-equal@^2.0.1: version "2.0.1" @@ -3721,17 +3720,17 @@ graphql-deduplicator@^2.0.1: resolved "https://registry.yarnpkg.com/graphql-deduplicator/-/graphql-deduplicator-2.0.2.tgz#d8608161cf6be97725e178df0c41f6a1f9f778f3" integrity sha512-0CGmTmQh4UvJfsaTPppJAcHwHln8Ayat7yXXxdnuWT+Mb1dBzkbErabCWzjXyKh/RefqlGTTA7EQOZHofMaKJA== -graphql-extensions@0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.2.tgz#8711543f835661eaf24b48d6ac2aad44dbbd5506" - integrity sha512-TuVINuAOrEtzQAkAlCZMi9aP5rcZ+pVaqoBI5fD2k5O9fmb8OuXUQOW028MUhC66tg4E7h4YSF1uYUIimbu4SQ== +graphql-extensions@0.7.4: + version "0.7.4" + resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.4.tgz#78327712822281d5778b9210a55dc59c93a9c184" + integrity sha512-Ly+DiTDU+UtlfPGQkqmBX2SWMr9OT3JxMRwpB9K86rDNDBTJtG6AE2kliQKKE+hg1+945KAimO7Ep+YAvS7ywg== dependencies: "@apollographql/apollo-tools" "^0.3.6" -graphql-extensions@0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.3.tgz#2ab7331c72ae657e4cbfa4ff004c400b19f56cdf" - integrity sha512-D+FZM0t5gFntJUizeRCurZuUqsyVP13CRejRX+cDJivyGkE6OMWYkCWlzHcbye79q+hYN1m6a3NhlrJRaD9D0w== +graphql-extensions@0.7.5: + version "0.7.5" + resolved "https://registry.yarnpkg.com/graphql-extensions/-/graphql-extensions-0.7.5.tgz#fab2b9e53cf6014952e6547456d50680ff0ea579" + integrity sha512-B1m+/WEJa3IYKWqBPS9W/7OasfPmlHOSz5hpEAq2Jbn6T0FQ/d2YWFf2HBETHR3RR2qfT+55VMiYovl2ga3qcg== dependencies: "@apollographql/apollo-tools" "^0.3.6" @@ -4941,10 +4940,10 @@ js-levenshtein@^1.1.3: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.13.0: - version "3.13.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.0.tgz#38ee7178ac0eea2c97ff6d96fff4b18c7d8cf98e" - integrity sha512-pZZoSxcCYco+DIKBTimr67J6Hy+EYGZDY/HCWC+iAEA9h1ByhMXAIVUXMcMFpOCxQ/xjXmPI2MkDL5HRm5eFrQ== +js-yaml@^3.13.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -5614,9 +5613,10 @@ neo4j-driver@^1.7.3, neo4j-driver@~1.7.4: text-encoding "^0.6.4" uri-js "^4.2.1" -"neo4j-graphql-js@git+https://github.com/Human-Connection/neo4j-graphql-js.git#temporary_fixes": - version "2.6.1" - resolved "git+https://github.com/Human-Connection/neo4j-graphql-js.git#84d529b9ecbc5c284cce4f86238c6d19b192cf0f" +neo4j-graphql-js@^2.6.3: + version "2.6.3" + resolved "https://registry.yarnpkg.com/neo4j-graphql-js/-/neo4j-graphql-js-2.6.3.tgz#8f28c2479adda08c90abcc32a784587ef49b8b95" + integrity sha512-WZdEqQ8EL9GOIB1ZccbLk1BZz5Dqdbk9i8BDXqxhp1SOI07P9y2cZ244f2Uz4zyES9AVXGmv+861N5xLhrSL2A== dependencies: graphql "^14.2.1" graphql-auth-directives "^2.1.0" @@ -6122,7 +6122,7 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= -path-is-inside@^1.0.1, path-is-inside@^1.0.2: +path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index 8f5bcc8ea..73313d331 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -1,347 +1,361 @@ -import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps' -import { getLangByName } from '../../support/helpers' +import { Given, When, Then } from "cypress-cucumber-preprocessor/steps"; +import { getLangByName } from "../../support/helpers"; /* global cy */ -let lastPost = {} +let lastPost = {}; let loginCredentials = { - email: 'peterpan@example.org', - password: '1234' -} + email: "peterpan@example.org", + password: "1234" +}; const narratorParams = { - name: 'Peter Pan', - avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg', + name: "Peter Pan", + avatar: "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg", ...loginCredentials -} +}; -Given('I am logged in', () => { - cy.login(loginCredentials) -}) +Given("I am logged in", () => { + cy.login(loginCredentials); +}); -Given('we have a selection of tags and categories as well as posts', () => { +Given("we have a selection of tags and categories as well as posts", () => { cy.factory() .authenticateAs(loginCredentials) - .create('Category', { - id: 'cat1', - name: 'Just For Fun', - slug: 'justforfun', - icon: 'smile' + .create("Category", { + id: "cat1", + name: "Just For Fun", + slug: "justforfun", + icon: "smile" }) - .create('Category', { - id: 'cat2', - name: 'Happyness & Values', - slug: 'happyness-values', - icon: 'heart-o' + .create("Category", { + id: "cat2", + name: "Happyness & Values", + slug: "happyness-values", + icon: "heart-o" }) - .create('Category', { - id: 'cat3', - name: 'Health & Wellbeing', - slug: 'health-wellbeing', - icon: 'medkit' + .create("Category", { + id: "cat3", + name: "Health & Wellbeing", + slug: "health-wellbeing", + icon: "medkit" }) - .create('Tag', { id: 't1', name: 'Ecology' }) - .create('Tag', { id: 't2', name: 'Nature' }) - .create('Tag', { id: 't3', name: 'Democracy' }) + .create("Tag", { id: "t1", name: "Ecology" }) + .create("Tag", { id: "t2", name: "Nature" }) + .create("Tag", { id: "t3", name: "Democracy" }); const someAuthor = { - id: 'authorId', - email: 'author@example.org', - password: '1234' - } + id: "authorId", + email: "author@example.org", + password: "1234" + }; const yetAnotherAuthor = { - id: 'yetAnotherAuthor', - email: 'yet-another-author@example.org', - password: '1234' - } + id: "yetAnotherAuthor", + email: "yet-another-author@example.org", + password: "1234" + }; cy.factory() - .create('User', someAuthor) + .create("User", someAuthor) .authenticateAs(someAuthor) - .create('Post', { id: 'p0' }) - .create('Post', { id: 'p1' }) + .create("Post", { id: "p0" }) + .create("Post", { id: "p1" }); cy.factory() - .create('User', yetAnotherAuthor) + .create("User", yetAnotherAuthor) .authenticateAs(yetAnotherAuthor) - .create('Post', { id: 'p2' }) + .create("Post", { id: "p2" }); cy.factory() .authenticateAs(loginCredentials) - .create('Post', { id: 'p3' }) - .relate('Post', 'Categories', { from: 'p0', to: 'cat1' }) - .relate('Post', 'Categories', { from: 'p1', to: 'cat2' }) - .relate('Post', 'Categories', { from: 'p2', to: 'cat1' }) - .relate('Post', 'Tags', { from: 'p0', to: 't1' }) - .relate('Post', 'Tags', { from: 'p0', to: 't2' }) - .relate('Post', 'Tags', { from: 'p0', to: 't3' }) - .relate('Post', 'Tags', { from: 'p1', to: 't2' }) - .relate('Post', 'Tags', { from: 'p1', to: 't3' }) - .relate('Post', 'Tags', { from: 'p2', to: 't2' }) - .relate('Post', 'Tags', { from: 'p2', to: 't3' }) - .relate('Post', 'Tags', { from: 'p3', to: 't3' }) -}) + .create("Post", { id: "p3" }) + .relate("Post", "Categories", { from: "p0", to: "cat1" }) + .relate("Post", "Categories", { from: "p1", to: "cat2" }) + .relate("Post", "Categories", { from: "p2", to: "cat1" }) + .relate("Post", "Tags", { from: "p0", to: "t1" }) + .relate("Post", "Tags", { from: "p0", to: "t2" }) + .relate("Post", "Tags", { from: "p0", to: "t3" }) + .relate("Post", "Tags", { from: "p1", to: "t2" }) + .relate("Post", "Tags", { from: "p1", to: "t3" }) + .relate("Post", "Tags", { from: "p2", to: "t2" }) + .relate("Post", "Tags", { from: "p2", to: "t3" }) + .relate("Post", "Tags", { from: "p3", to: "t3" }); +}); -Given('we have the following user accounts:', table => { +Given("we have the following user accounts:", table => { table.hashes().forEach(params => { - cy.factory().create('User', params) - }) -}) + cy.factory().create("User", params); + }); +}); -Given('I have a user account', () => { - cy.factory().create('User', narratorParams) -}) +Given("I have a user account", () => { + cy.factory().create("User", narratorParams); +}); -Given('my user account has the role {string}', role => { - cy.factory().create('User', { +Given("my user account has the role {string}", role => { + cy.factory().create("User", { role, ...loginCredentials - }) -}) + }); +}); -When('I log out', cy.logout) +When("I log out", cy.logout); -When('I visit {string}', page => { - cy.openPage(page) -}) +When("I visit {string}", page => { + cy.openPage(page); +}); -When('I visit the {string} page', page => { - cy.openPage(page) -}) +When("I visit the {string} page", page => { + cy.openPage(page); +}); -Given('I am on the {string} page', page => { - cy.openPage(page) -}) +Given("I am on the {string} page", page => { + cy.openPage(page); +}); -When('I fill in my email and password combination and click submit', () => { - cy.login(loginCredentials) -}) +When("I fill in my email and password combination and click submit", () => { + cy.login(loginCredentials); +}); When(/(?:when )?I refresh the page/, () => { - cy.reload() -}) + cy.reload(); +}); -When('I log out through the menu in the top right corner', () => { - cy.get('.avatar-menu').click() - cy.get('.avatar-menu-popover') +When("I log out through the menu in the top right corner", () => { + cy.get(".avatar-menu").click(); + cy.get(".avatar-menu-popover") .find('a[href="/logout"]') - .click() -}) + .click(); +}); -Then('I can see my name {string} in the dropdown menu', () => { - cy.get('.avatar-menu-popover').should('contain', narratorParams.name) -}) +Then("I can see my name {string} in the dropdown menu", () => { + cy.get(".avatar-menu-popover").should("contain", narratorParams.name); +}); -Then('I see the login screen again', () => { - cy.location('pathname').should('contain', '/login') -}) +Then("I see the login screen again", () => { + cy.location("pathname").should("contain", "/login"); +}); -Then('I can click on my profile picture in the top right corner', () => { - cy.get('.avatar-menu').click() - cy.get('.avatar-menu-popover') -}) +Then("I can click on my profile picture in the top right corner", () => { + cy.get(".avatar-menu").click(); + cy.get(".avatar-menu-popover"); +}); -Then('I am still logged in', () => { - cy.get('.avatar-menu').click() - cy.get('.avatar-menu-popover').contains(narratorParams.name) -}) +Then("I am still logged in", () => { + cy.get(".avatar-menu").click(); + cy.get(".avatar-menu-popover").contains(narratorParams.name); +}); -When('I select {string} in the language menu', name => { - cy.switchLanguage(name, true) -}) -Given('I previously switched the language to {string}', name => { - cy.switchLanguage(name, true) -}) -Then('the whole user interface appears in {string}', name => { - const lang = getLangByName(name) - cy.get(`html[lang=${lang.code}]`) - cy.getCookie('locale').should('have.property', 'value', lang.code) -}) -Then('I see a button with the label {string}', label => { - cy.contains('button', label) -}) +When("I select {string} in the language menu", name => { + cy.switchLanguage(name, true); +}); +Given("I previously switched the language to {string}", name => { + cy.switchLanguage(name, true); +}); +Then("the whole user interface appears in {string}", name => { + const lang = getLangByName(name); + cy.get(`html[lang=${lang.code}]`); + cy.getCookie("locale").should("have.property", "value", lang.code); +}); +Then("I see a button with the label {string}", label => { + cy.contains("button", label); +}); When(`I click on {string}`, linkOrButton => { - cy.contains(linkOrButton).click() -}) + cy.contains(linkOrButton).click(); +}); When(`I click on the menu item {string}`, linkOrButton => { - cy.contains('.ds-menu-item', linkOrButton).click() -}) + cy.contains(".ds-menu-item", linkOrButton).click(); +}); -When('I press {string}', label => { - cy.contains(label).click() -}) +When("I press {string}", label => { + cy.contains(label).click(); +}); -Given('we have the following posts in our database:', table => { +Given("we have the following posts in our database:", table => { table.hashes().forEach(({ Author, ...postAttributes }) => { const userAttributes = { name: Author, email: `${Author}@example.org`, - password: '1234' - } - postAttributes.deleted = Boolean(postAttributes.deleted) - const disabled = Boolean(postAttributes.disabled) + password: "1234" + }; + postAttributes.deleted = Boolean(postAttributes.deleted); + const disabled = Boolean(postAttributes.disabled); cy.factory() - .create('User', userAttributes) + .create("User", userAttributes) .authenticateAs(userAttributes) - .create('Post', postAttributes) + .create("Post", postAttributes); if (disabled) { const moderatorParams = { - email: 'moderator@example.org', - role: 'moderator', - password: '1234' - } + email: "moderator@example.org", + role: "moderator", + password: "1234" + }; cy.factory() - .create('User', moderatorParams) + .create("User", moderatorParams) .authenticateAs(moderatorParams) - .mutate('mutation($id: ID!) { disable(id: $id) }', postAttributes) + .mutate("mutation($id: ID!) { disable(id: $id) }", postAttributes); } - }) -}) + }); +}); -Then('I see a success message:', message => { - cy.contains(message) -}) +Then("I see a success message:", message => { + cy.contains(message); +}); -When('I click on the avatar menu in the top right corner', () => { - cy.get('.avatar-menu').click() -}) +When("I click on the avatar menu in the top right corner", () => { + cy.get(".avatar-menu").click(); +}); When( - 'I click on the big plus icon in the bottom right corner to create post', + "I click on the big plus icon in the bottom right corner to create post", () => { - cy.get('.post-add-button').click() + cy.get(".post-add-button").click(); } -) +); -Given('I previously created a post', () => { +Given("I previously created a post", () => { + lastPost.title = "previously created post"; + lastPost.content = "with some content"; cy.factory() .authenticateAs(loginCredentials) - .create('Post', lastPost) -}) + .create("Post", lastPost); +}); -When('I choose {string} as the title of the post', title => { - lastPost.title = title.replace('\n', ' ') - cy.get('input[name="title"]').type(lastPost.title) -}) +When("I choose {string} as the title of the post", title => { + lastPost.title = title.replace("\n", " "); + cy.get('input[name="title"]').type(lastPost.title); +}); -When('I type in the following text:', text => { - lastPost.content = text.replace('\n', ' ') - cy.get('.ProseMirror').type(lastPost.content) -}) +When("I type in the following text:", text => { + lastPost.content = text.replace("\n", " "); + cy.get(".ProseMirror").type(lastPost.content); +}); -Then('the post shows up on the landing page at position {int}', index => { - cy.openPage('landing') - const selector = `.post-card:nth-child(${index}) > .ds-card-content` - cy.get(selector).should('contain', lastPost.title) - cy.get(selector).should('contain', lastPost.content) -}) +Then("the post shows up on the landing page at position {int}", index => { + cy.openPage("landing"); + const selector = `.post-card:nth-child(${index}) > .ds-card-content`; + cy.get(selector).should("contain", lastPost.title); + cy.get(selector).should("contain", lastPost.content); +}); -Then('I get redirected to {string}', route => { - cy.location('pathname').should('contain', route.replace('...', '')) -}) +Then("I get redirected to {string}", route => { + cy.location("pathname").should("contain", route.replace("...", "")); +}); -Then('the post was saved successfully', () => { - cy.get('.ds-card-content > .ds-heading').should('contain', lastPost.title) - cy.get('.content').should('contain', lastPost.content) -}) +Then("the post was saved successfully", () => { + cy.get(".ds-card-content > .ds-heading").should("contain", lastPost.title); + cy.get(".content").should("contain", lastPost.content); +}); Then(/^I should see only ([0-9]+) posts? on the landing page/, postCount => { - cy.get('.post-card').should('have.length', postCount) -}) + cy.get(".post-card").should("have.length", postCount); +}); -Then('the first post on the landing page has the title:', title => { - cy.get('.post-card:first').should('contain', title) -}) +Then("the first post on the landing page has the title:", title => { + cy.get(".post-card:first").should("contain", title); +}); Then( - 'the page {string} returns a 404 error with a message:', + "the page {string} returns a 404 error with a message:", (route, message) => { // TODO: how can we check HTTP codes with cypress? - cy.visit(route, { failOnStatusCode: false }) - cy.get('.error').should('contain', message) + cy.visit(route, { failOnStatusCode: false }); + cy.get(".error").should("contain", message); } -) +); -Given('my user account has the following login credentials:', table => { - loginCredentials = table.hashes()[0] - cy.debug() - cy.factory().create('User', loginCredentials) -}) +Given("my user account has the following login credentials:", table => { + loginCredentials = table.hashes()[0]; + cy.debug(); + cy.factory().create("User", loginCredentials); +}); -When('I fill the password form with:', table => { - table = table.rowsHash() - cy.get('input[id=oldPassword]') - .type(table['Your old password']) - .get('input[id=newPassword]') - .type(table['Your new passsword']) - .get('input[id=confirmPassword]') - .type(table['Confirm new password']) -}) +When("I fill the password form with:", table => { + table = table.rowsHash(); + cy.get("input[id=oldPassword]") + .type(table["Your old password"]) + .get("input[id=newPassword]") + .type(table["Your new passsword"]) + .get("input[id=confirmPassword]") + .type(table["Confirm new password"]); +}); -When('submit the form', () => { - cy.get('form').submit() -}) +When("submit the form", () => { + cy.get("form").submit(); +}); -Then('I cannot login anymore with password {string}', password => { - cy.reload() - const { email } = loginCredentials - cy.visit(`/login`) - cy.get('input[name=email]') - .trigger('focus') - .type(email) - cy.get('input[name=password]') - .trigger('focus') - .type(password) - cy.get('button[name=submit]') - .as('submitButton') - .click() - cy.get('.iziToast-wrapper').should('contain', 'Incorrect email address or password.') -}) +Then("I cannot login anymore with password {string}", password => { + cy.reload(); + const { email } = loginCredentials; + cy.visit(`/login`); + cy.get("input[name=email]") + .trigger("focus") + .type(email); + cy.get("input[name=password]") + .trigger("focus") + .type(password); + cy.get("button[name=submit]") + .as("submitButton") + .click(); + cy.get(".iziToast-wrapper").should( + "contain", + "Incorrect email address or password." + ); +}); -Then('I can login successfully with password {string}', password => { - cy.reload() +Then("I can login successfully with password {string}", password => { + cy.reload(); cy.login({ ...loginCredentials, - ...{password} - }) - cy.get('.iziToast-wrapper').should('contain', "You are logged in!") -}) + ...{ password } + }); + cy.get(".iziToast-wrapper").should("contain", "You are logged in!"); +}); -When('I log in with the following credentials:', table => { - const { email, password } = table.hashes()[0] - cy.login({ email, password }) -}) +When("I log in with the following credentials:", table => { + const { email, password } = table.hashes()[0]; + cy.login({ email, password }); +}); -When('open the notification menu and click on the first item', () => { - cy.get('.notifications-menu').click() - cy.get('.notification-mention-post').first().click() -}) +When("open the notification menu and click on the first item", () => { + cy.get(".notifications-menu").click(); + cy.get(".notification-mention-post") + .first() + .click(); +}); -Then('see {int} unread notifications in the top menu', count => { - cy.get('.notifications-menu').should('contain', count) -}) +Then("see {int} unread notifications in the top menu", count => { + cy.get(".notifications-menu").should("contain", count); +}); -Then('I get to the post page of {string}', path => { - path = path.replace('...', '') - cy.url().should('contain', '/post/') - cy.url().should('contain', path) -}) +Then("I get to the post page of {string}", path => { + path = path.replace("...", ""); + cy.url().should("contain", "/post/"); + cy.url().should("contain", path); +}); -When('I start to write a new post with the title {string} beginning with:', (title, intro) => { - cy.get('.post-add-button').click() - cy.get('input[name="title"]').type(title) - cy.get('.ProseMirror').type(intro) -}) +When( + "I start to write a new post with the title {string} beginning with:", + (title, intro) => { + cy.get(".post-add-button").click(); + cy.get('input[name="title"]').type(title); + cy.get(".ProseMirror").type(intro); + } +); -When('mention {string} in the text', (mention) => { - cy.get('.ProseMirror').type(' @') - cy.get('.suggestion-list__item').contains(mention).click() - cy.debug() -}) +When("mention {string} in the text", mention => { + cy.get(".ProseMirror").type(" @"); + cy.get(".suggestion-list__item") + .contains(mention) + .click(); + cy.debug(); +}); -Then('the notification gets marked as read', () => { - cy.get('.notification').first().should('have.class', 'read') -}) +Then("the notification gets marked as read", () => { + cy.get(".notification") + .first() + .should("have.class", "read"); +}); -Then('there are no notifications in the top menu', () => { - cy.get('.notifications-menu').should('contain', '0') -}) +Then("there are no notifications in the top menu", () => { + cy.get(".notifications-menu").should("contain", "0"); +}); diff --git a/cypress/integration/post/WritePost.feature b/cypress/integration/post/WritePost.feature index fed1bbf2f..06ac4a175 100644 --- a/cypress/integration/post/WritePost.feature +++ b/cypress/integration/post/WritePost.feature @@ -12,10 +12,10 @@ Feature: Create a post When I click on the big plus icon in the bottom right corner to create post And I choose "My first post" as the title of the post And I type in the following text: - """ - Human Connection is a free and open-source social network - for active citizenship. - """ + """ + Human Connection is a free and open-source social network + for active citizenship. + """ And I click on "Save" Then I get redirected to ".../my-first-post" And the post was saved successfully diff --git a/deployment/digital-ocean/https/templates/ingress.template.yaml b/deployment/digital-ocean/https/templates/ingress.template.yaml index ba4681bc8..9d0068e08 100644 --- a/deployment/digital-ocean/https/templates/ingress.template.yaml +++ b/deployment/digital-ocean/https/templates/ingress.template.yaml @@ -10,6 +10,7 @@ metadata: spec: tls: - hosts: + # - nitro-mailserver.human-connection.org - nitro-staging.human-connection.org secretName: tls rules: @@ -20,3 +21,10 @@ spec: backend: serviceName: nitro-web servicePort: 3000 + # - host: nitro-mailserver.human-connection.org + # http: + # paths: + # - path: / + # backend: + # serviceName: mailserver + # servicePort: 80 diff --git a/deployment/human-connection/mailserver/README.md b/deployment/human-connection/mailserver/README.md new file mode 100644 index 000000000..9a224a3b9 --- /dev/null +++ b/deployment/human-connection/mailserver/README.md @@ -0,0 +1,18 @@ +# Development Mail Server + +You can deploy a fake smtp server which captures all send mails and displays +them in a web interface. The [sample configuration](../templates/configmap.template.yml) +is assuming such a dummy server in the `SMTP_HOST` configuration and points to +a cluster-internal SMTP server. + +To deploy the SMTP server just uncomment the relevant code in the +[ingress server configuration](../../https/templates/ingress.template.yaml) and +run the following: + +```bash +# in folder deployment/human-connection +kubectl apply -f mailserver/ +``` + +You might need to refresh the TLS secret to enable HTTPS on the publicly +available web interface. diff --git a/deployment/human-connection/mailserver/deployment-mailserver.yaml b/deployment/human-connection/mailserver/deployment-mailserver.yaml new file mode 100644 index 000000000..d97a66bc9 --- /dev/null +++ b/deployment/human-connection/mailserver/deployment-mailserver.yaml @@ -0,0 +1,34 @@ +--- + apiVersion: extensions/v1beta1 + kind: Deployment + metadata: + name: mailserver + namespace: human-connection + spec: + replicas: 1 + minReadySeconds: 15 + progressDeadlineSeconds: 60 + selector: + matchLabels: + human-connection.org/selector: deployment-human-connection-mailserver + template: + metadata: + labels: + human-connection.org/selector: deployment-human-connection-mailserver + name: "mailserver" + spec: + containers: + - name: mailserver + image: djfarrelly/maildev + imagePullPolicy: Always + ports: + - containerPort: 80 + - containerPort: 25 + envFrom: + - configMapRef: + name: configmap + - secretRef: + name: human-connection + restartPolicy: Always + terminationGracePeriodSeconds: 30 + status: {} diff --git a/deployment/human-connection/mailserver/service-mailserver.yaml b/deployment/human-connection/mailserver/service-mailserver.yaml new file mode 100644 index 000000000..655488b89 --- /dev/null +++ b/deployment/human-connection/mailserver/service-mailserver.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: mailserver + namespace: human-connection + labels: + human-connection.org/selector: deployment-human-connection-mailserver +spec: + ports: + - name: web + port: 80 + targetPort: 80 + - name: smtp + port: 25 + targetPort: 25 + selector: + human-connection.org/selector: deployment-human-connection-mailserver diff --git a/deployment/human-connection/templates/configmap.template.yaml b/deployment/human-connection/templates/configmap.template.yaml index 87b51a7d3..762901ae8 100644 --- a/deployment/human-connection/templates/configmap.template.yaml +++ b/deployment/human-connection/templates/configmap.template.yaml @@ -2,6 +2,10 @@ apiVersion: v1 kind: ConfigMap data: + SMTP_HOST: "mailserver.human-connection" + SMTP_PORT: "25" + SMTP_USERNAME: "" + SMTP_PASSWORD: "" GRAPHQL_PORT: "4000" GRAPHQL_URI: "http://nitro-backend.human-connection:4000" MOCKS: "false" diff --git a/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh b/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh index abed9b0f5..8d16f42fa 100755 --- a/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh +++ b/deployment/legacy-migration/maintenance-worker/migration/mongo/export.sh @@ -8,11 +8,18 @@ set +o allexport # Export collection function defintion function export_collection () { - "${EXPORT_MONGOEXPORT_BIN}" --db ${MONGODB_DATABASE} --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --collection $1 --collection $1 --out "${EXPORT_PATH}$1.json" + "${EXPORT_MONGOEXPORT_BIN}" --db ${MONGODB_DATABASE} --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --collection $1 --out "${EXPORT_PATH}$1.json" mkdir -p ${EXPORT_PATH}splits/$1/ split -l ${MONGO_EXPORT_SPLIT_SIZE} -a 3 ${EXPORT_PATH}$1.json ${EXPORT_PATH}splits/$1/ } +# Export collection with query function defintion +function export_collection_query () { + "${EXPORT_MONGOEXPORT_BIN}" --db ${MONGODB_DATABASE} --host localhost -d ${MONGODB_DATABASE} --port 27018 --username ${MONGODB_USERNAME} --password ${MONGODB_PASSWORD} --authenticationDatabase ${MONGODB_AUTH_DB} --collection $1 --out "${EXPORT_PATH}$1_$3.json" --query "$2" + mkdir -p ${EXPORT_PATH}splits/$1_$3/ + split -l ${MONGO_EXPORT_SPLIT_SIZE} -a 3 ${EXPORT_PATH}$1_$3.json ${EXPORT_PATH}splits/$1_$3/ +} + # Delete old export & ensure directory rm -rf ${EXPORT_PATH}* mkdir -p ${EXPORT_PATH} @@ -24,9 +31,12 @@ ssh -4 -M -S my-ctrl-socket -fnNT -L 27018:localhost:27017 -l ${SSH_USERNAME} ${ export_collection "badges" export_collection "categories" export_collection "comments" -export_collection "contributions" +export_collection_query "contributions" "{'type': 'DELETED'}" "DELETED" +export_collection_query "contributions" "{'type': 'post'}" "post" +export_collection_query "contributions" "{'type': 'cando'}" "cando" export_collection "emotions" -export_collection "follows" +export_collection_query "follows" "{'foreignService': 'organizations'}" "organizations" +export_collection_query "follows" "{'foreignService': 'users'}" "users" export_collection "invites" export_collection "notifications" export_collection "organizations" diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges/badges.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/badges.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/badges/badges.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/badges/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/badges_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/badges/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories/categories.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/categories.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/categories/categories.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/categories/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/categories_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/categories/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments/comments.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/comments.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/comments/comments.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/comments/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/comments_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/comments/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql similarity index 96% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql index 472354763..a0f1418aa 100644 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions.cql +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/contributions.cql @@ -109,8 +109,8 @@ } } }, -[?] deleted: { -[X] type: Boolean, +[?] deleted: { // THis field is not always present in the alpha-data +[?] type: Boolean, [ ] default: false, // Default value is missing in Nitro [-] index: true }, @@ -137,7 +137,7 @@ p.contentExcerpt = post.contentExcerpt, p.visibility = toLower(post.visibility), p.createdAt = post.createdAt.`$date`, p.updatedAt = post.updatedAt.`$date`, -p.deleted = post.deleted, +p.deleted = COALESCE(post.deleted,false), p.disabled = NOT post.isEnabled WITH p, post MATCH (u:User {id: post.userId}) diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/contributions/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/_delete_all.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/delete_all.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/_delete_all.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/delete_all.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions/emotions.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/emotions/emotions.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/follows_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/follows/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/follows/follows.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/follows.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/follows/follows.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh index ac256e3f0..8eef68c92 100755 --- a/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh +++ b/deployment/legacy-migration/maintenance-worker/migration/neo4j/import.sh @@ -9,10 +9,10 @@ set +o allexport # Delete collection function defintion function delete_collection () { # Delete from Database - echo "Delete $1" - "${IMPORT_CYPHERSHELL_BIN}" < $(dirname "$0")/$1_delete.cql > /dev/null + echo "Delete $2" + "${IMPORT_CYPHERSHELL_BIN}" < $(dirname "$0")/$1/delete.cql > /dev/null # Delete index file - rm -f "${IMPORT_PATH}splits/$1.index" + rm -f "${IMPORT_PATH}splits/$2.index" } # Import collection function defintion @@ -34,7 +34,7 @@ function import_collection () { # calculate the path of the chunk export IMPORT_CHUNK_PATH_CQL_FILE="${IMPORT_CHUNK_PATH_CQL}$1/${CHUNK_FILE_NAME}" # load the neo4j command and replace file variable with actual path - NEO4J_COMMAND="$(envsubst '${IMPORT_CHUNK_PATH_CQL_FILE}' < $(dirname "$0")/$1.cql)" + NEO4J_COMMAND="$(envsubst '${IMPORT_CHUNK_PATH_CQL_FILE}' < $(dirname "$0")/$2)" # run the import of the chunk echo "Import $1 ${CHUNK_FILE_NAME} (${chunk})" echo "${NEO4J_COMMAND}" | "${IMPORT_CYPHERSHELL_BIN}" > /dev/null @@ -52,13 +52,14 @@ SECONDS=0 # Delete all Neo4J Database content echo "Deleting Database Contents" -delete_collection "badges" -delete_collection "categories" -delete_collection "users" -delete_collection "follows" -delete_collection "contributions" -delete_collection "shouts" -delete_collection "comments" +delete_collection "badges" "badges" +delete_collection "categories" "categories" +delete_collection "users" "users" +delete_collection "follows" "follows_users" +delete_collection "contributions" "contributions_post" +delete_collection "contributions" "contributions_cando" +delete_collection "shouts" "shouts" +delete_collection "comments" "comments" #delete_collection "emotions" #delete_collection "invites" @@ -75,26 +76,33 @@ echo "DONE" # Import Data echo "Start Importing Data" -import_collection "badges" -import_collection "categories" -import_collection "users" -import_collection "follows" -import_collection "contributions" -import_collection "shouts" -import_collection "comments" +import_collection "badges" "badges/badges.cql" +import_collection "categories" "categories/categories.cql" +import_collection "users" "users/users.cql" +import_collection "follows_users" "follows/follows.cql" +#import_collection "follows_organizations" "follows/follows.cql" +import_collection "contributions_post" "contributions/contributions.cql" +import_collection "contributions_cando" "contributions/contributions.cql" +#import_collection "contributions_DELETED" "contributions/contributions.cql" +import_collection "shouts" "shouts/shouts.cql" +import_collection "comments" "comments/comments.cql" # import_collection "emotions" # import_collection "invites" # import_collection "notifications" # import_collection "organizations" # import_collection "pages" -# import_collection "projects" -# import_collection "settings" -# import_collection "status" # import_collection "systemnotifications" # import_collection "userscandos" # import_collection "usersettings" +# does only contain dummy data +# import_collection "projects" + +# does only contain alpha specifc data +# import_collection "status +# import_collection "settings"" + echo "DONE" echo "Time elapsed: $SECONDS seconds" diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/invites_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/invites/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/invites_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/invites/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/invites.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/invites/invites.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/invites.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/invites/invites.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications/notifications.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/notifications/notifications.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations/organizations.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/organizations/organizations.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/pages_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/pages/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/pages_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/pages/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/pages.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/pages/pages.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/pages.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/pages/pages.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/projects_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/projects/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/projects_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/projects/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/projects.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/projects/projects.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/projects.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/projects/projects.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/settings_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/settings/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/settings_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/settings/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/settings.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/settings/settings.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/settings.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/settings/settings.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts/shouts.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/shouts/shouts.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/status_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/status/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/status_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/status/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/status.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/status/status.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/status.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/status/status.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications/systemnotifications.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/systemnotifications/systemnotifications.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/users_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/users/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/users/users.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/users.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/users/users.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos/userscandos.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/userscandos/userscandos.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings_delete.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings/delete.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings_delete.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings/delete.cql diff --git a/deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings.cql b/deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings/usersettings.cql similarity index 100% rename from deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings.cql rename to deployment/legacy-migration/maintenance-worker/migration/neo4j/usersettings/usersettings.cql diff --git a/package.json b/package.json index fed6c742b..38c5c9a39 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,9 @@ "cypress-file-upload": "^3.1.4", "cypress-plugin-retries": "^1.2.2", "dotenv": "^8.0.0", - "faker": "^4.1.0", + "faker": "Marak/faker.js#master", "graphql-request": "^1.8.2", "neo4j-driver": "^1.7.5", "npm-run-all": "^4.1.5" } -} \ No newline at end of file +} diff --git a/webapp/components/Avatar/Avatar.spec.js b/webapp/components/Avatar/Avatar.spec.js index d3ebcb030..626e584c9 100644 --- a/webapp/components/Avatar/Avatar.spec.js +++ b/webapp/components/Avatar/Avatar.spec.js @@ -53,7 +53,7 @@ describe('Avatar.vue', () => { beforeEach(() => { propsData = { user: { - avatar: 'http://lorempixel.com/640/480/animals', + avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/sawalazar/128.jpg', }, } }) @@ -64,7 +64,7 @@ describe('Avatar.vue', () => { Wrapper() .find('img') .attributes('src'), - ).toBe('http://lorempixel.com/640/480/animals') + ).toBe('https://s3.amazonaws.com/uifaces/faces/twitter/sawalazar/128.jpg') }) }) }) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 81ec713bd..833f7116b 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -2,6 +2,7 @@ import { config, mount, createLocalVue } from '@vue/test-utils' import ContributionForm from './index.vue' import Styleguide from '@human-connection/styleguide' import Vuex from 'vuex' +import PostMutations from '~/graphql/PostMutations.js' const localVue = createLocalVue() @@ -17,11 +18,9 @@ describe('ContributionForm.vue', () => { let deutschOption let cancelBtn let mocks - let tagsInput - let chipText + let propsData const postTitle = 'this is a title for a post' const postContent = 'this is a post' - const computed = { locale: () => 'English' } beforeEach(() => { mocks = { @@ -54,6 +53,7 @@ describe('ContributionForm.vue', () => { push: jest.fn(), }, } + propsData = {} }) describe('mount', () => { @@ -66,7 +66,7 @@ describe('ContributionForm.vue', () => { getters, }) const Wrapper = () => { - return mount(ContributionForm, { mocks, localVue, computed, store }) + return mount(ContributionForm, { mocks, localVue, store, propsData }) } beforeEach(() => { @@ -75,16 +75,22 @@ describe('ContributionForm.vue', () => { }) describe('CreatePost', () => { + describe('language placeholder', () => { + it("displays the name that corresponds with the user's location code", () => { + expect(wrapper.find('.ds-select-placeholder').text()).toEqual('English') + }) + }) + describe('invalid form submission', () => { it('title required for form submission', async () => { postTitleInput = wrapper.find('.ds-input') - postTitleInput.setValue('this is a title for a post') + postTitleInput.setValue(postTitle) await wrapper.find('form').trigger('submit') expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) it('content required for form submission', async () => { - wrapper.vm.updateEditorContent('this is a post') + wrapper.vm.updateEditorContent(postContent) await wrapper.find('form').trigger('submit') expect(mocks.$apollo.mutate).not.toHaveBeenCalled() }) @@ -93,17 +99,12 @@ describe('ContributionForm.vue', () => { describe('valid form submission', () => { beforeEach(async () => { expectedParams = { - variables: { - title: postTitle, - content: postContent, - language: 'en', - id: null, - tags: [], - }, + mutation: PostMutations().CreatePost, + variables: { title: postTitle, content: postContent, language: 'en', id: null }, } postTitleInput = wrapper.find('.ds-input') - postTitleInput.setValue('this is a title for a post') - wrapper.vm.updateEditorContent('this is a post') + postTitleInput.setValue(postTitle) + wrapper.vm.updateEditorContent(postContent) await wrapper.find('form').trigger('submit') }) @@ -165,8 +166,8 @@ describe('ContributionForm.vue', () => { beforeEach(async () => { wrapper = Wrapper() postTitleInput = wrapper.find('.ds-input') - postTitleInput.setValue('this is a title for a post') - wrapper.vm.updateEditorContent('this is a post') + postTitleInput.setValue(postTitle) + wrapper.vm.updateEditorContent(postContent) // second submission causes mutation to reject await wrapper.find('form').trigger('submit') }) @@ -177,5 +178,57 @@ describe('ContributionForm.vue', () => { }) }) }) + + describe('UpdatePost', () => { + beforeEach(() => { + propsData = { + contribution: { + id: 'p1456', + slug: 'dies-ist-ein-post', + title: 'dies ist ein Post', + content: 'auf Deutsch geschrieben', + language: 'de', + }, + } + wrapper = Wrapper() + }) + + it('sets id equal to contribution id', () => { + expect(wrapper.vm.id).toEqual(propsData.contribution.id) + }) + + it('sets slug equal to contribution slug', () => { + expect(wrapper.vm.slug).toEqual(propsData.contribution.slug) + }) + + it('sets title equal to contribution title', () => { + expect(wrapper.vm.form.title).toEqual(propsData.contribution.title) + }) + + it('sets content equal to contribution content', () => { + expect(wrapper.vm.form.content).toEqual(propsData.contribution.content) + }) + + it('sets language equal to contribution language', () => { + expect(wrapper.vm.form.language).toEqual({ value: propsData.contribution.language }) + }) + + it('calls the UpdatePost apollo mutation', async () => { + expectedParams = { + mutation: PostMutations().UpdatePost, + variables: { + title: postTitle, + content: postContent, + language: propsData.contribution.language, + id: propsData.contribution.id, + }, + } + postTitleInput = wrapper.find('.ds-input') + postTitleInput.setValue(postTitle) + wrapper.vm.updateEditorContent(postContent) + await wrapper.find('form').trigger('submit') + expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams)) + }) + }) }) }) diff --git a/webapp/components/ContributionForm/index.vue b/webapp/components/ContributionForm/index.vue index 4989088df..11d6553f8 100644 --- a/webapp/components/ContributionForm/index.vue +++ b/webapp/components/ContributionForm/index.vue @@ -108,7 +108,7 @@ export default { this.slug = contribution.slug this.form.content = contribution.content this.form.title = contribution.title - this.form.language = this.locale + this.form.language = { value: contribution.language } }, }, }, diff --git a/webapp/components/comments/CommentForm/index.vue b/webapp/components/comments/CommentForm/index.vue index f105bd5ff..753d09c13 100644 --- a/webapp/components/comments/CommentForm/index.vue +++ b/webapp/components/comments/CommentForm/index.vue @@ -25,6 +25,8 @@