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
# 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

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
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/

View File

@ -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',

View File

@ -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.