Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cypress tests #425

Merged
merged 3 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/ypovoli/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = environ.get("DJANGO_DEBUG", "False").lower() in ["true", "1", "t"]
DOMAIN_NAME = environ.get("DJANGO_DOMAIN_NAME", "localhost")
ALLOWED_HOSTS = [DOMAIN_NAME]
CSRF_TRUSTED_ORIGINS = ["https://" + DOMAIN_NAME]
ALLOWED_HOSTS = [DOMAIN_NAME, "nginx"]
CSRF_TRUSTED_ORIGINS = ["https://" + DOMAIN_NAME, "https://nginx"]

# Application definition
INSTALLED_APPS = [
Expand Down
4 changes: 4 additions & 0 deletions frontend/Dockerfile.cypress
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARG CHROME_VERSION="114.0.5735.133-1"
ARG NODE_VERSION="18.17.1"

FROM cypress/factory
2 changes: 1 addition & 1 deletion frontend/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
baseUrl: 'http://nginx',
baseUrl: 'https://nginx',
specPattern: 'src/test/e2e/**/*.cy.{js,jsx,ts,tsx}',
},
});
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fi
exit_code=0

echo "-----------------"
if [ $vitest_exit -ne 0 ] || [ $django_exit -ne 0 ]; then
if [ $cypress_exit -ne 0 ] || [ $vitest_exit -ne 0 ] || [ $django_exit -ne 0 ]; then
echo "Tests failed:"
if [ $cypress_exit -ne 0 ]; then
echo " - Cypress"
Expand Down
10 changes: 9 additions & 1 deletion test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ services:
command: sh -c "./setup.sh && python manage.py runsslserver 0.0.0.0:8000"
volumes:
- $BACKEND_DIR:/code
depends_on:
- redis

celery:
<<: *common-keys-selab_test
Expand Down Expand Up @@ -89,7 +91,13 @@ services:
cypress:
<<: *common-keys-selab_test
container_name: cypress
image: cypress/included:cypress-12.17.3-node-18.16.0-chrome-114.0.5735.133-1-ff-114.0.2-edge-114.0.1823.51-1
build:
context: $FRONTEND_DIR
dockerfile: Dockerfile.cypress
command: sh -c "npm install && npm run cypress:test"
working_dir: /e2e
volumes:
- ${FRONTEND_DIR}:/e2e
- /e2e/node_modules
depends_on:
- frontend