A one-to-one realtime chat app.
Note: these setup steps are not necessary when running the code on GitPod. They are only necessary when running the project on your local machine.
Create the PostgreSQL database (these instructions may need to be adapted for your operating system):
psql
CREATE DATABASE messenger;
\q
Create a .env
file in the server directory and add the following variables (make any modifications to fit your local installation):
SECRET_KEY="YourSecretKey"
ENV="development"
POSTGRES_ENGINE="django.db.backends.postgresql_psycopg2"
POSTGRES_HOST="localhost"
POSTGRES_PORT=5432
POSTGRES_DATABASE="messenger"
POSTGRES_USER="user"
POSTGRES_PASSWORD="password"
In the server folder, install dependencies and then seed the database (you may want to use a virtual environment):
Note: if you're running python 3.10, you might run into an issue with the Greenlet dependency. We recommend downgrading to python 3.8 or 3.9 for this project.
cd server
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py shell
from messenger_backend.seed import seed
seed()
exit()
In the client folder, install dependencies:
cd client
npm install
In one terminal, start the front end:
cd client
npm start
In a separate terminal, start the back end:
cd server
python manage.py runserver
cd server
python manage.py test
- Seed the database.
- Start the backend server.
- Start the frontend server with
npm start
inclient
directory. - Open Cypress dashboard with
npx cypress open
inclient
directory. - Click on the test suite to run (e.g.
auth.spec.js
).
- You need to seed the database before each run. Because E2E test cases writes data to the actual database, re-seeding is necessary to assure consistent test results.
- The E2E tests are not comprehensive. There is a test for the authentication pages that should pass with the starting code, and some tests for some of the functionality for some of the tickets you will be assigned.
- When you push your changes to GitHub, E2E tests are automatically executed on GitHub Actions. You can find test results under Pull request > Checks > test > Cypress (see screenshots below).