Change how static files for cypress tests are served

This commit is contained in:
Ramon Wenger 2021-02-10 15:36:49 +01:00
parent 92fad1003b
commit 9f81082f12
4 changed files with 7 additions and 6 deletions

View File

@ -59,10 +59,9 @@ aliases:
- psql -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME" - psql -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME"
- python server/manage.py dummy_data - python server/manage.py dummy_data
- python server/manage.py runserver 2>&1 > /dev/null & - python server/manage.py runserver 2>&1 > /dev/null &
- npm run dev --prefix client 2>&1 > /dev/null & - npm run build --prefix client
- cd client
- curl http://localhost:8000/beta-login - curl http://localhost:8000/beta-login
- npm run test:cypress - npm run --prefix client test:cypress
- &jest-test - &jest-test
name: run jest tests name: run jest tests
caches: caches:

View File

@ -34,6 +34,7 @@ SIGNING_SECRET = os.environ.get('SIGNING_SECRET')
DEBUG = bool_value(os.environ.get('DEBUG', '')) DEBUG = bool_value(os.environ.get('DEBUG', ''))
TEST = 'test' in sys.argv TEST = 'test' in sys.argv
ENABLE_SILKY = bool_value(os.environ.get('ENABLE_SILKY', '')) ENABLE_SILKY = bool_value(os.environ.get('ENABLE_SILKY', ''))
SERVE_VIA_WEBPACK = bool_value(os.environ.get('SERVE_VIA_WEBPACK', DEBUG))
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']

View File

@ -21,7 +21,7 @@ class PrivateGraphQLView(LoginRequiredMixin, GraphQLView):
@ensure_csrf_cookie @ensure_csrf_cookie
def home(request): def home(request):
if settings.DEBUG: if settings.SERVE_VIA_WEBPACK:
try: try:
return HttpResponse(requests.get('http://localhost:8080/{}'.format(request.get_full_path())).text) return HttpResponse(requests.get('http://localhost:8080/{}'.format(request.get_full_path())).text)
except Exception as e: except Exception as e:

View File

@ -2,10 +2,11 @@
export SECRET_KEY=abcd1234 export SECRET_KEY=abcd1234
export DATABASE_HOST=localhost export DATABASE_HOST=localhost
export DATABASE_USER=postgres export DATABASE_USER=postgres
export PG_PASSWORD=postgres export PGPASSWORD=postgres
export DATABASE_NAME=skillbox_test export DATABASE_NAME=skillbox_test
export DATABASE_PORT=5432 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 DEBUG=True
export USE_AWS=False export USE_AWS=False
export SERVE_VIA_WEBPACK=False
pipenv install --dev --system pipenv install --dev --system