#!/bin/bash
source ./setup-for-tests.sh

export DATABASE_HOST=postgres
export DATABASE_PORT=5432
export DATABASE_URL=postgres://$DATABASE_USER:$PG_PASSWORD@$DATABASE_HOST:$DATABASE_PORT/$DATABASE_NAME
psql -U $DATABASE_USER -h $DATABASE_HOST -c "drop database $DATABASE_NAME"

npm install --prefix client
#npm run "install:cypress" --prefix client
psql -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME"
python server/manage.py dummy_data
python server/manage.py runserver &
npm run dev --prefix client &
cd client
/node_modules/.bin/cypress run
