From 825ad6d26632dfbfd27f647251bb84c37b0e151a Mon Sep 17 00:00:00 2001 From: roschaefer Date: Mon, 2 Dec 2019 23:30:11 +0100 Subject: [PATCH] Fix cypress tests Since `dotenv` in the backend now loads configuration from a file relative to the current file, we don't have to duplicate the neo4j configuration settings here. --- .travis.yml | 2 +- cypress.env.template.json | 6 ------ cypress/README.md | 7 +------ cypress/support/factories.js | 13 ++++--------- webapp/README.md | 3 ++- 5 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 cypress.env.template.json diff --git a/.travis.yml b/.travis.yml index a2aae3cdb..0a73c5baf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ install: - yarn global add wait-on # Install Codecov - yarn install - - cp cypress.env.template.json cypress.env.json + - cp backend/.env.template backend/.env before_script: - docker-compose -f docker-compose.yml build --parallel diff --git a/cypress.env.template.json b/cypress.env.template.json deleted file mode 100644 index 8eda47154..000000000 --- a/cypress.env.template.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "BACKEND_HOST": "http://localhost:4000", - "NEO4J_URI": "bolt://localhost:7687", - "NEO4J_USERNAME": "neo4j", - "NEO4J_PASSWORD": "letmein" -} diff --git a/cypress/README.md b/cypress/README.md index 2adcff925..662d0b51c 100644 --- a/cypress/README.md +++ b/cypress/README.md @@ -16,12 +16,7 @@ First, you have to tell cypress how to connect to your local neo4j database among other things. You can copy our template configuration and change the new file according to your needs. -Make sure you are at the root level of the project. Then: -```bash -# in the top level folder Human-Connection/ -$ cp cypress.env.template.json cypress.env.json -``` -To start the services that are required for cypress testing, run this: +To start the services that are required for cypress testing, run: ```bash # in the top level folder Human-Connection/ diff --git a/cypress/support/factories.js b/cypress/support/factories.js index 20c4bbdc8..d90afecba 100644 --- a/cypress/support/factories.js +++ b/cypress/support/factories.js @@ -1,16 +1,11 @@ import Factory from '../../backend/src/seed/factories' import { getDriver, getNeode } from '../../backend/src/bootstrap/neo4j' -import setupNeode from '../../backend/src/bootstrap/neode' import neode from 'neode' const backendHost = Cypress.env('SEED_SERVER_HOST') -const neo4jConfigs = { - uri: Cypress.env('NEO4J_URI'), - username: Cypress.env('NEO4J_USERNAME'), - password: Cypress.env('NEO4J_PASSWORD') -} -const neo4jDriver = getDriver(neo4jConfigs) -const factoryOptions = { seedServerHost: backendHost, neo4jDriver, neodeInstance: setupNeode(neo4jConfigs)} +const neo4jDriver = getDriver() +const neodeInstance = getNeode() +const factoryOptions = { seedServerHost: backendHost, neo4jDriver, neodeInstance } const factory = Factory(factoryOptions) beforeEach(async () => { @@ -18,7 +13,7 @@ beforeEach(async () => { }) Cypress.Commands.add('neode', () => { - return setupNeode(neo4jConfigs) + return neodeInstance }) Cypress.Commands.add( 'first', diff --git a/webapp/README.md b/webapp/README.md index 185557fc7..897bb56ca 100644 --- a/webapp/README.md +++ b/webapp/README.md @@ -6,14 +6,15 @@ ```bash # install all dependencies +$ cd webapp/ $ yarn install ``` Copy: ```text +# in webapp/ cp .env.template .env -cp cypress.env.template.json cypress.env.json ``` Configure the files according to your needs and your local setup.