diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 3ed619cb..a2d89b41 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -59,10 +59,9 @@ aliases: - psql -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME" - python server/manage.py dummy_data - python server/manage.py runserver 2>&1 > /dev/null & - - npm run dev --prefix client 2>&1 > /dev/null & - - cd client + - npm run build --prefix client - curl http://localhost:8000/beta-login - - npm run test:cypress + - npm run --prefix client test:cypress - &jest-test name: run jest tests caches: diff --git a/server/core/settings.py b/server/core/settings.py index bfbcf284..d9b41d4d 100644 --- a/server/core/settings.py +++ b/server/core/settings.py @@ -34,6 +34,7 @@ SIGNING_SECRET = os.environ.get('SIGNING_SECRET') DEBUG = bool_value(os.environ.get('DEBUG', '')) TEST = 'test' in sys.argv ENABLE_SILKY = bool_value(os.environ.get('ENABLE_SILKY', '')) +SERVE_VIA_WEBPACK = bool_value(os.environ.get('SERVE_VIA_WEBPACK', DEBUG)) ALLOWED_HOSTS = ['*'] diff --git a/server/core/views.py b/server/core/views.py index 5a47cb2a..e9040ba5 100644 --- a/server/core/views.py +++ b/server/core/views.py @@ -21,7 +21,7 @@ class PrivateGraphQLView(LoginRequiredMixin, GraphQLView): @ensure_csrf_cookie def home(request): - if settings.DEBUG: + if settings.SERVE_VIA_WEBPACK: try: return HttpResponse(requests.get('http://localhost:8080/{}'.format(request.get_full_path())).text) except Exception as e: diff --git a/setup-for-tests.sh b/setup-for-tests.sh index 7c38bf8d..8a33df12 100755 --- a/setup-for-tests.sh +++ b/setup-for-tests.sh @@ -2,10 +2,11 @@ export SECRET_KEY=abcd1234 export DATABASE_HOST=localhost export DATABASE_USER=postgres -export PG_PASSWORD=postgres +export PGPASSWORD=postgres export DATABASE_NAME=skillbox_test export DATABASE_PORT=5432 -export DATABASE_URL=postgres://$DATABASE_USER:$PG_PASSWORD@$DATABASE_HOST:$DATABASE_PORT/$DATABASE_NAME +export DATABASE_URL=postgres://$DATABASE_USER:$PGPASSWORD@$DATABASE_HOST:$DATABASE_PORT/$DATABASE_NAME export DEBUG=True export USE_AWS=False +export SERVE_VIA_WEBPACK=False pipenv install --dev --system