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.
This commit is contained in:
roschaefer 2019-12-02 23:30:11 +01:00
parent 8f0ce19f09
commit 825ad6d266
5 changed files with 8 additions and 23 deletions

View File

@ -12,7 +12,7 @@ install:
- yarn global add wait-on - yarn global add wait-on
# Install Codecov # Install Codecov
- yarn install - yarn install
- cp cypress.env.template.json cypress.env.json - cp backend/.env.template backend/.env
before_script: before_script:
- docker-compose -f docker-compose.yml build --parallel - docker-compose -f docker-compose.yml build --parallel

View File

@ -1,6 +0,0 @@
{
"BACKEND_HOST": "http://localhost:4000",
"NEO4J_URI": "bolt://localhost:7687",
"NEO4J_USERNAME": "neo4j",
"NEO4J_PASSWORD": "letmein"
}

View File

@ -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 among other things. You can copy our template configuration and change the new
file according to your needs. file according to your needs.
Make sure you are at the root level of the project. Then: To start the services that are required for cypress testing, run:
```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:
```bash ```bash
# in the top level folder Human-Connection/ # in the top level folder Human-Connection/

View File

@ -1,16 +1,11 @@
import Factory from '../../backend/src/seed/factories' import Factory from '../../backend/src/seed/factories'
import { getDriver, getNeode } from '../../backend/src/bootstrap/neo4j' import { getDriver, getNeode } from '../../backend/src/bootstrap/neo4j'
import setupNeode from '../../backend/src/bootstrap/neode'
import neode from 'neode' import neode from 'neode'
const backendHost = Cypress.env('SEED_SERVER_HOST') const backendHost = Cypress.env('SEED_SERVER_HOST')
const neo4jConfigs = { const neo4jDriver = getDriver()
uri: Cypress.env('NEO4J_URI'), const neodeInstance = getNeode()
username: Cypress.env('NEO4J_USERNAME'), const factoryOptions = { seedServerHost: backendHost, neo4jDriver, neodeInstance }
password: Cypress.env('NEO4J_PASSWORD')
}
const neo4jDriver = getDriver(neo4jConfigs)
const factoryOptions = { seedServerHost: backendHost, neo4jDriver, neodeInstance: setupNeode(neo4jConfigs)}
const factory = Factory(factoryOptions) const factory = Factory(factoryOptions)
beforeEach(async () => { beforeEach(async () => {
@ -18,7 +13,7 @@ beforeEach(async () => {
}) })
Cypress.Commands.add('neode', () => { Cypress.Commands.add('neode', () => {
return setupNeode(neo4jConfigs) return neodeInstance
}) })
Cypress.Commands.add( Cypress.Commands.add(
'first', 'first',

View File

@ -6,14 +6,15 @@
```bash ```bash
# install all dependencies # install all dependencies
$ cd webapp/
$ yarn install $ yarn install
``` ```
Copy: Copy:
```text ```text
# in webapp/
cp .env.template .env cp .env.template .env
cp cypress.env.template.json cypress.env.json
``` ```
Configure the files according to your needs and your local setup. Configure the files according to your needs and your local setup.