Merge branch 'master' into fix-coverage

This commit is contained in:
Ulf Gebhardt 2023-06-07 10:56:46 +02:00 committed by GitHub
commit 33bb92de1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
182 changed files with 3075 additions and 3034 deletions

View File

@ -12,7 +12,6 @@ docker-compose*.yml
./*.log ./*.log
node_modules/ node_modules/
scripts/
build/ build/
maintenance-worker/ maintenance-worker/

View File

@ -74,7 +74,7 @@ FROM code as build
# yarn install # yarn install
RUN yarn install --production=false --frozen-lockfile --non-interactive RUN yarn install --production=false --frozen-lockfile --non-interactive
# yarn build # yarn build
RUN yarn run build RUN /bin/sh -c "yarn run build"
################################################################################## ##################################################################################
# TEST ########################################################################### # TEST ###########################################################################

View File

@ -11,7 +11,7 @@
"__migrate": "migrate --compiler 'js:@babel/register' --migrations-dir ./src/db/migrations", "__migrate": "migrate --compiler 'js:@babel/register' --migrations-dir ./src/db/migrations",
"prod:migrate": "migrate --migrations-dir ./build/db/migrations --store ./build/db/migrate/store.js", "prod:migrate": "migrate --migrations-dir ./build/db/migrations --store ./build/db/migrate/store.js",
"start": "node build/", "start": "node build/",
"build": "tsc && mkdir -p build/middleware/helpers/email/templates/ && cp -r src/middleware/helpers/email/templates/*.html build/middleware/helpers/email/templates/ && mkdir -p build/middleware/helpers/email/templates/en/ && cp -r src/middleware/helpers/email/templates/en/*.html build/middleware/helpers/email/templates/en/ && mkdir -p build/middleware/helpers/email/templates/de/ && cp -r src/middleware/helpers/email/templates/de/*.html build/middleware/helpers/email/templates/de/ && mkdir -p build/schema/types/ && cp -r src/schema/types/*.gql build/schema/types/ && mkdir -p build/schema/types/enum/ && cp -r src/schema/types/enum/*.gql build/schema/types/enum/ && mkdir -p build/schema/types/scalar/ && cp -r src/schema/types/scalar/*.gql build/schema/types/scalar/ && mkdir -p build/schema/types/type/ && cp -r src/schema/types/type/*.gql build/schema/types/type/", "build": "tsc && ./scripts/build.copy.files.sh",
"dev": "nodemon --exec ts-node src/ -e js,ts,gql", "dev": "nodemon --exec ts-node src/ -e js,ts,gql",
"dev:debug": "nodemon --exec babel-node --inspect=0.0.0.0:9229 src/ -e js,gql", "dev:debug": "nodemon --exec babel-node --inspect=0.0.0.0:9229 src/ -e js,gql",
"lint": "eslint src --config .eslintrc.js", "lint": "eslint src --config .eslintrc.js",
@ -72,7 +72,7 @@
"metascraper-logo": "^5.33.5", "metascraper-logo": "^5.33.5",
"metascraper-publisher": "^5.33.5", "metascraper-publisher": "^5.33.5",
"metascraper-soundcloud": "^5.34.4", "metascraper-soundcloud": "^5.34.4",
"metascraper-title": "^5.33.5", "metascraper-title": "^5.34.7",
"metascraper-url": "^5.34.2", "metascraper-url": "^5.34.2",
"metascraper-video": "^5.33.5", "metascraper-video": "^5.33.5",
"metascraper-youtube": "^5.33.5", "metascraper-youtube": "^5.33.5",

View File

@ -0,0 +1,24 @@
#!/bin/sh
# html files
mkdir -p build/middleware/helpers/email/templates/
cp -r src/middleware/helpers/email/templates/*.html build/middleware/helpers/email/templates/
mkdir -p build/middleware/helpers/email/templates/en/
cp -r src/middleware/helpers/email/templates/en/*.html build/middleware/helpers/email/templates/en/
mkdir -p build/middleware/helpers/email/templates/de/
cp -r src/middleware/helpers/email/templates/de/*.html build/middleware/helpers/email/templates/de/
# gql files
mkdir -p build/schema/types/
cp -r src/schema/types/*.gql build/schema/types/
mkdir -p build/schema/types/enum/
cp -r src/schema/types/enum/*.gql build/schema/types/enum/
mkdir -p build/schema/types/scalar/
cp -r src/schema/types/scalar/*.gql build/schema/types/scalar/
mkdir -p build/schema/types/type/
cp -r src/schema/types/type/*.gql build/schema/types/type/

View File

@ -1,20 +1,37 @@
// NOTE: We cannot use `fs` here to clean up the code. Cypress breaks on any npm // NOTE: We cannot use `fs` here to clean up the code. Cypress breaks on any npm
// module that is not browser-compatible. Node's `fs` module is server-side only // module that is not browser-compatible. Node's `fs` module is server-side only
export default { export default {
Image: require('./Image.js').default, Image: typeof Cypress !== 'undefined' ? require('./Image.js') : require('./Image.js').default,
Badge: require('./Badge.js').default, Badge: typeof Cypress !== 'undefined' ? require('./Badge.js') : require('./Badge.js').default,
User: require('./User.js').default, User: typeof Cypress !== 'undefined' ? require('./User.js') : require('./User.js').default,
Group: require('./Group.js').default, Group: typeof Cypress !== 'undefined' ? require('./Group.js') : require('./Group.js').default,
EmailAddress: require('./EmailAddress.js').default, EmailAddress:
UnverifiedEmailAddress: require('./UnverifiedEmailAddress.js').default, typeof Cypress !== 'undefined'
SocialMedia: require('./SocialMedia.js').default, ? require('./EmailAddress.js')
Post: require('./Post.js').default, : require('./EmailAddress.js').default,
Comment: require('./Comment.js').default, UnverifiedEmailAddress:
Category: require('./Category.js').default, typeof Cypress !== 'undefined'
Tag: require('./Tag.js').default, ? require('./UnverifiedEmailAddress.js')
Location: require('./Location.js').default, : require('./UnverifiedEmailAddress.js').default,
Donations: require('./Donations.js').default, SocialMedia:
Report: require('./Report.js').default, typeof Cypress !== 'undefined'
Migration: require('./Migration.js').default, ? require('./SocialMedia.js')
InviteCode: require('./InviteCode.js').default, : require('./SocialMedia.js').default,
Post: typeof Cypress !== 'undefined' ? require('./Post.js') : require('./Post.js').default,
Comment:
typeof Cypress !== 'undefined' ? require('./Comment.js') : require('./Comment.js').default,
Category:
typeof Cypress !== 'undefined' ? require('./Category.js') : require('./Category.js').default,
Tag: typeof Cypress !== 'undefined' ? require('./Tag.js') : require('./Tag.js').default,
Location:
typeof Cypress !== 'undefined' ? require('./Location.js') : require('./Location.js').default,
Donations:
typeof Cypress !== 'undefined' ? require('./Donations.js') : require('./Donations.js').default,
Report: typeof Cypress !== 'undefined' ? require('./Report.js') : require('./Report.js').default,
Migration:
typeof Cypress !== 'undefined' ? require('./Migration.js') : require('./Migration.js').default,
InviteCode:
typeof Cypress !== 'undefined'
? require('./InviteCode.js')
: require('./InviteCode.js').default,
} }

View File

@ -158,7 +158,7 @@ describe('Filter Posts', () => {
}) })
describe('order events by event start descending', () => { describe('order events by event start descending', () => {
it('finds the events orderd accordingly', async () => { it('finds the events ordered accordingly', async () => {
const { const {
data: { Post: result }, data: { Post: result },
} = await query({ } = await query({
@ -180,7 +180,7 @@ describe('Filter Posts', () => {
}) })
describe('order events by event start ascending', () => { describe('order events by event start ascending', () => {
it('finds the events orderd accordingly', async () => { it('finds the events ordered accordingly', async () => {
const { const {
data: { Post: result }, data: { Post: result },
} = await query({ } = await query({

View File

@ -1511,10 +1511,10 @@
url-regex "~4.1.1" url-regex "~4.1.1"
video-extensions "~1.1.0" video-extensions "~1.1.0"
"@metascraper/helpers@^5.33.5", "@metascraper/helpers@^5.34.2", "@metascraper/helpers@^5.34.4": "@metascraper/helpers@^5.33.5", "@metascraper/helpers@^5.34.2", "@metascraper/helpers@^5.34.4", "@metascraper/helpers@^5.34.7":
version "5.34.4" version "5.34.7"
resolved "https://registry.yarnpkg.com/@metascraper/helpers/-/helpers-5.34.4.tgz#59faf01466938b26aa8df147f97c7f9f4d739d28" resolved "https://registry.yarnpkg.com/@metascraper/helpers/-/helpers-5.34.7.tgz#749a288813e9f61938bb64d34bfb4e2c26689cbe"
integrity sha512-OZdXkfxJXH5dW+aoptLJzxN56Xj+ABzbqZ9NDuKn908zW4tvLBPD6go3qdd3GXXQZH7TxvWpETn9i1AxzoyKmQ== integrity sha512-h3Kg9xFoVlr3rqxbhpR+o7nzYuThXtiDuk+kiaIWozAguUWT6xvwb3iHKuCdKC9/29PXeJ+UqM9WxBamxbzGmg==
dependencies: dependencies:
audio-extensions "0.0.0" audio-extensions "0.0.0"
chrono-node "~2.6.2" chrono-node "~2.6.2"
@ -1527,13 +1527,13 @@
is-uri "~1.2.4" is-uri "~1.2.4"
iso-639-3 "~2.2.0" iso-639-3 "~2.2.0"
isostring "0.0.1" isostring "0.0.1"
jsdom "~22.0.0" jsdom "~22.1.0"
lodash "~4.17.21" lodash "~4.17.21"
memoize-one "~6.0.0" memoize-one "~6.0.0"
microsoft-capitalize "~1.0.5" microsoft-capitalize "~1.0.5"
mime "~3.0.0" mime "~3.0.0"
normalize-url "~6.1.0" normalize-url "~6.1.0"
re2 "~1.18.0" re2 "~1.18.3"
smartquotes "~2.3.2" smartquotes "~2.3.2"
tldts "~6.0.1" tldts "~6.0.1"
url-regex-safe "~3.0.0" url-regex-safe "~3.0.0"
@ -5918,10 +5918,10 @@ insane@2.6.1:
assignment "2.0.0" assignment "2.0.0"
he "0.5.0" he "0.5.0"
install-artifact-from-github@^1.3.1: install-artifact-from-github@^1.3.3:
version "1.3.2" version "1.3.3"
resolved "https://registry.yarnpkg.com/install-artifact-from-github/-/install-artifact-from-github-1.3.2.tgz#1a16d9508e40330523a3017ae0d4713ccc64de82" resolved "https://registry.yarnpkg.com/install-artifact-from-github/-/install-artifact-from-github-1.3.3.tgz#57d89bacfa0f47d7307fe41b6247cda9f9a8079c"
integrity sha512-yCFcLvqk0yQdxx0uJz4t9Z3adDMLAYrcGYv546uRXCSvxE+GqNYhhz/KmrGcUKGI/gVLR9n/e/zM9jX/+ASMJQ== integrity sha512-x79SL0d8WOi1ZjXSTUqqs0GPQZ92YArJAN9O46wgU9wdH2U9ecyyhB9YGDbPe2OLV4ptmt6AZYRQZ2GydQZosQ==
invariant@^2.2.2, invariant@^2.2.4: invariant@^2.2.2, invariant@^2.2.4:
version "2.2.4" version "2.2.4"
@ -6807,10 +6807,10 @@ jsbn@~0.1.0:
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==
jsdom@~22.0.0: jsdom@~22.1.0:
version "22.0.0" version "22.1.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-22.0.0.tgz#3295c6992c70089c4b8f5cf060489fddf7ee9816" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-22.1.0.tgz#0fca6d1a37fbeb7f4aac93d1090d782c56b611c8"
integrity sha512-p5ZTEb5h+O+iU02t0GfEjAnkdYPrQSkfuTSMkMYyIoMvUNEHsbG0bHHbfXIcfTqD2UfvjQX7mmgiFsyRwGscVw== integrity sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==
dependencies: dependencies:
abab "^2.0.6" abab "^2.0.6"
cssstyle "^3.0.0" cssstyle "^3.0.0"
@ -7385,12 +7385,12 @@ metascraper-soundcloud@^5.34.4:
dependencies: dependencies:
"@metascraper/helpers" "^5.34.4" "@metascraper/helpers" "^5.34.4"
metascraper-title@^5.33.5: metascraper-title@^5.34.7:
version "5.33.5" version "5.34.7"
resolved "https://registry.yarnpkg.com/metascraper-title/-/metascraper-title-5.33.5.tgz#2efd6aae03211175fa2e27b4d827cade4c3e35f4" resolved "https://registry.yarnpkg.com/metascraper-title/-/metascraper-title-5.34.7.tgz#d53afa05eb4d5f2d7b8ec772ddfc335733f86a21"
integrity sha512-Vavt/2Yt4BZP+++xsV2ZnUqqQ4WHxRImZq6fZD6Eh8R8nt43kuQdgKrBKTD3Ybk6/qvlCTQ9XY57m/KTIiAMnA== integrity sha512-k+eDC12Y1m5n/RE3GhqmWRtNSKH9rDXvAzJ6k2T9+9PyaGeaSN9dWLnc3rK9TYmdFP02kTKhCAV8WerHw/7IqA==
dependencies: dependencies:
"@metascraper/helpers" "^5.33.5" "@metascraper/helpers" "^5.34.7"
metascraper-url@^5.34.2: metascraper-url@^5.34.2:
version "5.34.2" version "5.34.2"
@ -7854,7 +7854,7 @@ node-fetch@^2.1.2, node-fetch@^2.2.0, node-fetch@^2.6.0, node-fetch@~2.6.1:
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
node-gyp@^9.3.0: node-gyp@^9.3.1:
version "9.3.1" version "9.3.1"
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.3.1.tgz#1e19f5f290afcc9c46973d68700cbd21a96192e4" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.3.1.tgz#1e19f5f290afcc9c46973d68700cbd21a96192e4"
integrity sha512-4Q16ZCqq3g8awk6UplT7AuxQ35XN4R/yf/+wSAwcBUAjg7l58RTactWaP8fIDTi0FzI7YcVLujwExakZlfWkXg== integrity sha512-4Q16ZCqq3g8awk6UplT7AuxQ35XN4R/yf/+wSAwcBUAjg7l58RTactWaP8fIDTi0FzI7YcVLujwExakZlfWkXg==
@ -8711,14 +8711,14 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.2.7:
minimist "^1.2.0" minimist "^1.2.0"
strip-json-comments "~2.0.1" strip-json-comments "~2.0.1"
re2@~1.18.0: re2@~1.18.3:
version "1.18.0" version "1.18.3"
resolved "https://registry.yarnpkg.com/re2/-/re2-1.18.0.tgz#6d6f47c5aaa436eb7a7d68b260f8cf25d7948619" resolved "https://registry.yarnpkg.com/re2/-/re2-1.18.3.tgz#64120f3990351e6d71207b095a92ebc41f123c7f"
integrity sha512-MoCYZlJ9YUgksND9asyNF2/x532daXU/ARp1UeJbQ5flMY6ryKNEhrWt85aw3YluzOJlC3vXpGgK2a1jb0b4GA== integrity sha512-QAUSIl5znNR/GOXLIUWWao0pPQ2VZU/t9u+0j17x7lXXypPsil8iuYBsSuMDZ3TGx439332tYdh0d9Nt8XGbHg==
dependencies: dependencies:
install-artifact-from-github "^1.3.1" install-artifact-from-github "^1.3.3"
nan "^2.17.0" nan "^2.17.0"
node-gyp "^9.3.0" node-gyp "^9.3.1"
reachable-url@~1.7.1: reachable-url@~1.7.1:
version "1.7.1" version "1.7.1"

53
cypress/cypress.config.js Normal file
View File

@ -0,0 +1,53 @@
const dotenv = require('dotenv')
const { defineConfig } = require("cypress");
const browserify = require("@badeball/cypress-cucumber-preprocessor/browserify");
const { addCucumberPreprocessorPlugin } = require("@badeball/cypress-cucumber-preprocessor");
// Test persistent(between commands) store
const testStore = {}
async function setupNodeEvents(on, config) {
await addCucumberPreprocessorPlugin(on, config);
on("file:preprocessor", browserify.default(config));
on("task", {
pushValue({ name, value }) {
testStore[name] = value
return true
},
getValue(name) {
console.log("getValue",name,testStore)
return testStore[name]
},
});
on("after:run", (results) => {
if (results) {
console.log(results.status);
}
});
return config;
}
// Import backend .env (smart)?
const { parsed } = dotenv.config({ path: '../backend/.env' })
module.exports = defineConfig({
e2e: {
projectId: "qa7fe2",
defaultCommandTimeout: 10000,
chromeWebSecurity: false,
baseUrl: "http://localhost:3000",
specPattern: "cypress/e2e/**/*.feature",
supportFile: "cypress/support/e2e.js",
retries: {
runMode: 2,
openMode: 0,
},
video: false,
setupNodeEvents,
},
env: parsed
});

View File

@ -1,12 +0,0 @@
{
"projectId": "qa7fe2",
"defaultCommandTimeout": 10000,
"ignoreTestFiles": "*.js",
"chromeWebSecurity": false,
"baseUrl": "http://localhost:3000",
"video":false,
"retries": {
"runMode": 2,
"openMode": 0
}
}

View File

@ -22,5 +22,6 @@ Feature: User authentication
Scenario: Log out Scenario: Log out
Given I am logged in as "peter-pan" Given I am logged in as "peter-pan"
When I log out When I navigate to page "/"
And I log out
Then I am on page "login" Then I am on page "login"

View File

@ -1,5 +0,0 @@
import { Then } from "cypress-cucumber-preprocessor/steps";
Then("I click save", () => {
cy.get(".save-button").click()
})

View File

@ -1,6 +0,0 @@
import { Then } from "cypress-cucumber-preprocessor/steps";
Then("I click the checkbox show donations progress bar and save", () => {
cy.get("#showDonations").click()
cy.get(".donations-info-button").click()
})

View File

@ -1,5 +0,0 @@
import { When } from "cypress-cucumber-preprocessor/steps";
When("I submit the form", () => {
cy.get("form").submit();
});

View File

@ -1,5 +0,0 @@
import { Given } from "cypress-cucumber-preprocessor/steps";
Given("I navigate to page {string}", page => {
cy.visit(page);
});

View File

@ -1,6 +0,0 @@
import { When } from "cypress-cucumber-preprocessor/steps";
When('I refresh the page', () => {
cy.visit('/')
.reload();
});

View File

@ -1,5 +0,0 @@
import { When } from "cypress-cucumber-preprocessor/steps";
When("I wait for {int} milliseconds", time => {
cy.wait(time)
});

View File

@ -8,10 +8,10 @@ CUR_JOB=$(expr $1 - 1)
MAX_JOBS=$2 MAX_JOBS=$2
# Features # Features
FEATURE_LIST=( $(find cypress/integration/ -maxdepth 1 -name "*.feature") ) FEATURE_LIST=( $(find cypress/e2e/ -maxdepth 1 -name "*.feature") )
# Calculation # Calculation
MAX_FEATURES=$(find cypress/integration/ -maxdepth 1 -name "*.feature" -print | wc -l) MAX_FEATURES=$(find cypress/e2e/ -maxdepth 1 -name "*.feature" -print | wc -l)
# adds overhead features to the first jobs # adds overhead features to the first jobs
if [[ $CUR_JOB -lt $(expr ${MAX_FEATURES} % ${MAX_JOBS}) ]] if [[ $CUR_JOB -lt $(expr ${MAX_FEATURES} % ${MAX_JOBS}) ]]
then then

View File

@ -1,41 +0,0 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
const cucumber = require('cypress-cucumber-preprocessor').default
const dotenv = require('dotenv')
// Import backend .env (smart)?
const { parsed } = dotenv.config({ path: require.resolve('../../backend/.env') })
// Test persistent(between commands) store
const testStore = {}
module.exports = (on, config) => {
config.env.NEO4J_URI = parsed.NEO4J_URI
config.env.NEO4J_USERNAME = parsed.NEO4J_USERNAME
config.env.NEO4J_PASSWORD = parsed.NEO4J_PASSWORD
config.env.JWT_SECRET = parsed.JWT_SECRET
on('file:preprocessor', cucumber())
on('task', {
pushValue({ name, value }) {
testStore[name] = value
return true
},
getValue(name) {
console.log("getValue",name,testStore)
return testStore[name]
},
})
return config
}

View File

@ -15,7 +15,7 @@
/* globals Cypress cy */ /* globals Cypress cy */
import "cypress-file-upload"; import "cypress-file-upload";
import { GraphQLClient, request } from 'graphql-request' import { GraphQLClient, request } from 'graphql-request'
import config from '../../backend/src/config' import CONFIG from '../../backend/src/config'
const authenticatedHeaders = (variables) => { const authenticatedHeaders = (variables) => {
const mutation = ` const mutation = `
@ -24,7 +24,7 @@ const authenticatedHeaders = (variables) => {
} }
` `
return new Cypress.Promise((resolve, reject) => { return new Cypress.Promise((resolve, reject) => {
request(config.GRAPHQL_URI, mutation, variables).then((response) => { request(CONFIG.GRAPHQL_URI, mutation, variables).then((response) => {
resolve({ authorization: `Bearer ${response.login}` }) resolve({ authorization: `Bearer ${response.login}` })
}) })
}) })
@ -40,7 +40,7 @@ Cypress.Commands.add(
({email, password}) => { ({email, password}) => {
return new Cypress.Promise((resolve, reject) => { return new Cypress.Promise((resolve, reject) => {
authenticatedHeaders({ email, password }).then((headers) => { authenticatedHeaders({ email, password }).then((headers) => {
resolve(new GraphQLClient(config.GRAPHQL_URI, { headers })) resolve(new GraphQLClient(CONFIG.GRAPHQL_URI, { headers }))
}) })
}) })
}) })

View File

@ -1,13 +1,7 @@
import Factory from '../../backend/src/db/factories' import Factory from '../../backend/src/db/factories'
import { getNeode } from '../../backend/src/db/neo4j' import { getNeode } from '../../backend/src/db/neo4j'
const neodeInstance = getNeode()
const neo4jConfigs = {
uri: Cypress.env('NEO4J_URI'),
username: Cypress.env('NEO4J_USERNAME'),
password: Cypress.env('NEO4J_PASSWORD')
}
const neodeInstance = getNeode(neo4jConfigs)
beforeEach(() => cy.then(() => neodeInstance.cypher('MATCH (everything) DETACH DELETE everything;'))) beforeEach(() => cy.then(() => neodeInstance.cypher('MATCH (everything) DETACH DELETE everything;')))
@ -16,7 +10,7 @@ Cypress.Commands.add('neode', () => {
}) })
Cypress.Commands.add( Cypress.Commands.add(
'first', 'firstOf',
{ prevSubject: true }, { prevSubject: true },
(neode, model, properties) => { (neode, model, properties) => {
return neode.first(model, properties) return neode.first(model, properties)

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("the donation info contains goal {string} and progress {string}", (goal, progress) => { When("the donation info contains goal {string} and progress {string}", (goal, progress) => {
cy.get('.top-info-bar') cy.get('.top-info-bar')

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the donation info is {string}", (visibility) => { Then("the donation info is {string}", (visibility) => {
cy.get('.top-info-bar') cy.get('.top-info-bar')

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I open the content menu of post {string}", (title) => { When("I open the content menu of post {string}", (title) => {
cy.contains('.post-teaser', title) cy.contains('.post-teaser', title)

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the post with title {string} has a ribbon for pinned posts", (title) => { Then("the post with title {string} has a ribbon for pinned posts", (title) => {
cy.get(".post-teaser").contains(title) cy.get(".post-teaser").contains(title)

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("there is no button to pin a post", () => { Then("there is no button to pin a post", () => {
cy.get("a.ds-menu-item-link") cy.get("a.ds-menu-item-link")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I see a button with the label {string}", label => { Then("I see a button with the label {string}", label => {
cy.contains("button", label); cy.contains("button", label);

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I select {string} in the language menu", language => { When("I select {string} in the language menu", language => {
cy.get(".locale-menu") cy.get(".locale-menu")

View File

@ -1,5 +1,5 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
import locales from '../../../webapp/locales' import locales from '../../../../webapp/locales'
Then("the whole user interface appears in {string}", language => { Then("the whole user interface appears in {string}", language => {
const { code } = locales.find((entry) => entry.name === language); const { code } = locales.find((entry) => entry.name === language);

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should see only {int} posts on the newsfeed", posts => { Then("I should see only {int} posts on the newsfeed", posts => {
cy.get(".post-teaser") cy.get(".post-teaser")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the page {string} returns a 404 error with a message:", (route, message) => { Then("the page {string} returns a 404 error with a message:", (route, message) => {
cy.request({ cy.request({

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then(`I can't see the moderation menu item`, () => { Then(`I can't see the moderation menu item`, () => {
cy.get('.avatar-menu-popover') cy.get('.avatar-menu-popover')

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then('I can visit the post page', () => { Then('I can visit the post page', () => {
cy.contains('Fake news').click() cy.contains('Fake news').click()

View File

@ -1,9 +1,9 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When('I click on "Report Post" from the content menu of the post', () => { When('I click on "Report Post" from the content menu of the post', () => {
cy.contains('.base-card', 'The Truth about the Holocaust') cy.contains('.base-card', 'The Truth about the Holocaust')
.find('.content-menu .base-button') .find('.content-menu .base-button')
.click({force: true}) .click()
cy.get('.popover .ds-menu-item-link') cy.get('.popover .ds-menu-item-link')
.contains('Report Post') .contains('Report Post')

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When('I click on the author', () => { When('I click on the author', () => {
cy.get('[data-test="avatarUserLink"]') cy.get('[data-test="avatarUserLink"]')

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I click on the avatar menu in the top right corner", () => { When("I click on the avatar menu in the top right corner", () => {
cy.get(".avatar-menu").click(); cy.get(".avatar-menu").click();

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When(/^I confirm the reporting dialog .*:$/, message => { When(/^I confirm the reporting dialog .*:$/, message => {
cy.contains(message) // wait for element to become visible cy.contains(message) // wait for element to become visible

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then('I see all the reported posts including from the user who muted me', () => { Then('I see all the reported posts including from the user who muted me', () => {
cy.get('table tbody').within(() => { cy.get('table tbody').within(() => {

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then('I see all the reported posts including the one from above', () => { Then('I see all the reported posts including the one from above', () => {
cy.get('table tbody').within(() => { cy.get('table tbody').within(() => {

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then('each list item links to the post page', () => { Then('each list item links to the post page', () => {
cy.contains('The Truth about the Holocaust').click(); cy.contains('The Truth about the Holocaust').click();

View File

@ -1,4 +1,4 @@
import { Given } from "cypress-cucumber-preprocessor/steps"; import { Given } from "@badeball/cypress-cucumber-preprocessor";
Given('somebody reported the following posts:', table => { Given('somebody reported the following posts:', table => {
table.hashes().forEach(({ submitterEmail, resourceId, reasonCategory, reasonDescription }) => { table.hashes().forEach(({ submitterEmail, resourceId, reasonCategory, reasonDescription }) => {

View File

@ -1,11 +1,13 @@
import { Given } from "@badeball/cypress-cucumber-preprocessor";
Given("there is an annoying user who has muted me", () => { Given("there is an annoying user who has muted me", () => {
cy.neode() cy.neode()
.first("User", { .firstOf("User", {
role: 'moderator' role: 'moderator'
}) })
.then(mutedUser => { .then(mutedUser => {
cy.neode() cy.neode()
.first("User", { .firstOf("User", {
id: 'user' id: 'user'
}) })
.relateTo(mutedUser, "muted"); .relateTo(mutedUser, "muted");

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I start to write a new post with the title {string} beginning with:", (title, intro) => { When("I start to write a new post with the title {string} beginning with:", (title, intro) => {
cy.get('input[name="title"]') cy.get('input[name="title"]')

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("mention {string} in the text", mention => { When("mention {string} in the text", mention => {
cy.get(".ProseMirror") cy.get(".ProseMirror")

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("open the notification menu and click on the first item", () => { When("open the notification menu and click on the first item", () => {
cy.get(".notifications-menu") cy.get(".notifications-menu")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("see {int} unread notifications in the top menu", count => { Then("see {int} unread notifications in the top menu", count => {
cy.get(".notifications-menu") cy.get(".notifications-menu")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the notification menu button links to the all notifications page", () => { Then("the notification menu button links to the all notifications page", () => {
cy.get(".notifications-menu") cy.get(".notifications-menu")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the unread counter is removed", () => { Then("the unread counter is removed", () => {
cy.get('.notifications-menu .counter-icon') cy.get('.notifications-menu .counter-icon')

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I comment the following:", async text => { When("I comment the following:", async text => {
const comment = text.replace("\n", " ") const comment = text.replace("\n", " ")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should see an abbreviated version of my comment", () => { Then("I should see an abbreviated version of my comment", () => {
cy.get("article.comment-card") cy.get("article.comment-card")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should see my comment", () => { Then("I should see my comment", () => {
cy.get("article.comment-card p") cy.get("article.comment-card p")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should see the entirety of my comment", () => { Then("I should see the entirety of my comment", () => {
cy.get("article.comment-card") cy.get("article.comment-card")

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I type in a comment with {int} characters", size => { When("I type in a comment with {int} characters", size => {
var c=""; var c="";

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("it should create a mention in the CommentForm", () => { Then("it should create a mention in the CommentForm", () => {
cy.get(".ProseMirror a") cy.get(".ProseMirror a")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("my comment should be successfully created", () => { Then("my comment should be successfully created", () => {
cy.get(".iziToast-message").contains("Comment submitted!"); cy.get(".iziToast-message").contains("Comment submitted!");

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the editor should be cleared", () => { Then("the editor should be cleared", () => {
cy.get(".ProseMirror p").should("have.class", "is-empty"); cy.get(".ProseMirror p").should("have.class", "is-empty");

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I choose {string} as the title", async title => { When("I choose {string} as the title", async title => {
const lastPost = {} const lastPost = {}

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the post was saved successfully", async () => { Then("the post was saved successfully", async () => {
cy.task('getValue', 'lastPost').then(lastPost => { cy.task('getValue', 'lastPost').then(lastPost => {

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I add all required fields", () => { Then("I add all required fields", () => {
cy.get('input[name="title"]') cy.get('input[name="title"]')

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should be able to {string} a teaser image", condition => { Then("I should be able to {string} a teaser image", condition => {
// cy.reload() // cy.reload()

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When('my post has a teaser image', () => { When('my post has a teaser image', () => {
cy.get('.contribution-form .image') cy.get('.contribution-form .image')

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the first image should not be displayed anymore", () => { Then("the first image should not be displayed anymore", () => {
cy.get(".hero-image") cy.get(".hero-image")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the post was saved successfully with the {string} teaser image", condition => { Then("the post was saved successfully with the {string} teaser image", condition => {
cy.get(".base-card > .title") cy.get(".base-card > .title")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then('the {string} post was saved successfully without a teaser image', condition => { Then('the {string} post was saved successfully without a teaser image', condition => {
cy.get(".base-card > .title") cy.get(".base-card > .title")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the post shows up on the newsfeed at position {int}", index => { Then("the post shows up on the newsfeed at position {int}", index => {
const selector = `.post-teaser:nth-child(${index}) > .base-card`; const selector = `.post-teaser:nth-child(${index}) > .base-card`;

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I select a post entry", () => { When("I select a post entry", () => {
cy.get(".searchable-input .search-post") cy.get(".searchable-input .search-post")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I select a user entry", () => { Then("I select a user entry", () => {
cy.get(".searchable-input .user-teaser") cy.get(".searchable-input .user-teaser")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should have one item in the select dropdown", () => { Then("I should have one item in the select dropdown", () => {
cy.get(".searchable-input .ds-select-dropdown").should($li => { cy.get(".searchable-input .ds-select-dropdown").should($li => {

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should not see posts without the searched-for term in the select dropdown", () => { Then("I should not see posts without the searched-for term in the select dropdown", () => {
cy.get(".ds-select-dropdown") cy.get(".ds-select-dropdown")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should see posts with the searched-for term in the select dropdown", () => { Then("I should see posts with the searched-for term in the select dropdown", () => {
cy.get(".ds-select-dropdown") cy.get(".ds-select-dropdown")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should see the following posts on the search results page:", table => { Then("I should see the following posts on the search results page:", table => {
table.hashes().forEach(({ title }) => { table.hashes().forEach(({ title }) => {

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should see the following users in the select dropdown:", table => { Then("I should see the following users in the select dropdown:", table => {
cy.get(".search-heading").should("contain", "Users"); cy.get(".search-heading").should("contain", "Users");

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I type {string} and press Enter", value => { When("I type {string} and press Enter", value => {
cy.get(".searchable-input .ds-select input") cy.get(".searchable-input .ds-select input")

View File

@ -1,4 +1,4 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I type {string} and press escape", value => { When("I type {string} and press escape", value => {
cy.get(".searchable-input .ds-select input") cy.get(".searchable-input .ds-select input")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the search field should clear", () => { Then("the search field should clear", () => {
cy.get(".searchable-input .ds-select input") cy.get(".searchable-input .ds-select input")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("the search parameter equals {string}", search => { Then("the search parameter equals {string}", search => {
cy.location("search") cy.location("search")

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I am logged in with username {string}", name => { Then("I am logged in with username {string}", name => {
cy.get(".avatar-menu").click(); cy.get(".avatar-menu").click();

View File

@ -1,11 +1,11 @@
import { When } from "cypress-cucumber-preprocessor/steps"; import { When } from "@badeball/cypress-cucumber-preprocessor";
When("I block the user {string}", name => { When("I block the user {string}", name => {
cy.neode() cy.neode()
.first("User", { name }) .firstOf("User", { name })
.then(blockedUser => { .then(blockedUser => {
cy.neode() cy.neode()
.first("User", {id: "id-of-peter-pan"}) .firstOf("User", {id: "id-of-peter-pan"})
.relateTo(blockedUser, "blocked"); .relateTo(blockedUser, "blocked");
}); });
}); });

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then('I should not see {string} button', button => { Then('I should not see {string} button', button => {
cy.get('.base-card .action-buttons') cy.get('.base-card .action-buttons')

View File

@ -1,4 +1,4 @@
import { Then } from "cypress-cucumber-preprocessor/steps"; import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then("I should see no users in my blocked users list", () => { Then("I should see no users in my blocked users list", () => {
cy.get('.ds-placeholder') cy.get('.ds-placeholder')

Some files were not shown because too many files have changed in this diff Show More