UCSB Dining Hall Menus and Reviews
Note: CMPSC 156 Student teams should not change the prod/qa links below to match their team's links; you should maintain the README.md file so that it can be merged into the https://github.com/ucsb-cs156/proj-dining/ repo at the end of the quarter.
| Deployment | URL |
|---|---|
| production | https://dining.dokku-00.cs.ucsb.edu |
| qa | https://dining-qa.dokku-00.cs.ucsb.edu |
Sprint Planning Doc:
- Java: 21
- node: 22.18.0 See docs/versions.md for more information on upgrading versions.
Before running the application for the first time,
you need to do the steps documented in docs/oauth.md.
Otherwise, when you try to login for the first time, you will likely see an error such as:
You will also need a value for UCSB_API_KEY; you can obtain a value for that by following the instructions at this link: https://ucsb-cs156.github.io/topics/apis/apis_ucsb_developer_api.html
- Open two separate terminal windows
- In the first window, start up the backend with:
mvn spring-boot:run - In the second window:
cd frontend npm install # only on first run or when dependencies change npm start
Then, the app should be available on http://localhost:8080
If it doesn't work at first, e.g. you have a blank page on http://localhost:8080, give it a minute and a few page refreshes. Sometimes it takes a moment for everything to settle in.
If you see the following on localhost, make sure that you also have the frontend code running in a separate window.
Failed to connect to the frontend server... On Dokku, be sure that PRODUCTION is defined. On localhost, open a second terminal window, cd into frontend and type: npm install; npm start";
See: /docs/dokku.md
To access the swagger API endpoints, use:
Or add /swagger-ui/index.html to the URL of your dokku deployment.
- cd into frontend
- use: npm run storybook
- This should put the storybook on http://localhost:6006
- Additional stories are added under frontend/src/stories
For documentation on React Storybook, see:
- https://ucsb-cs156.github.io/topics/storybook/
- https://ucsb-cs156.github.io/topics/chromatic/
- https://storybook.js.org/
On localhost:
- The SQL database is an H2 database and the data is stored in a file under
target - Each time you do
mvn cleanthe database is completely rebuilt from scratch - You can access the database console via a special route, http://localhost:8080/h2-console
- For more info, see docs/h2-database.md
On Dokku, follow instructions for Dokku databases:
- To run all unit tests, use:
mvn test - To run only the tests from
FooTests.javause:mvn test -Dtest=FooTests
Unit tests are any methods labelled with the @Test annotation that are under the /src/test/java hierarchy, and have file names that end in Test or Tests
To run only the integration tests, use:
INTEGRATION=true mvn test-compile failsafe:integration-test
To run only the integration tests and see the tests run as you run them, use:
INTEGRATION=true HEADLESS=false mvn test-compile failsafe:integration-test
To run a particular integration test (e.g. only HomePageWebIT.java) use -Dit.test=ClassName, for example:
INTEGRATION=true mvn test-compile failsafe:integration-test -Dit.test=HomePageWebIT
or to see it run live:
INTEGRATION=true HEADLESS=false mvn test-compile failsafe:integration-test -Dit.test=HomePageWebIT
Integration tests are any methods labelled with @Test annotation, that are under the /src/test/java hierarchy, and have names starting with IT (specifically capital I, capital T).
By convention, we are putting Integration tests (the ones that run with Playwright) under the package src/test/java/edu/ucsb/cs156/example/web.
Unless you want a particular integration test to also be run when you type mvn test, do not use the suffixes Test or Tests for the filename.
Note that while mvn test is typically sufficient to run tests, we have found that if you haven't compiled the test code yet, running mvn failsafe:integration-test may not actually run any of the tests.
This repo has support for partial pitest runs
For example, to run pitest on just one class, use:
mvn pitest:mutationCoverage -DtargetClasses=edu.ucsb.cs156.dining.controllers.RestaurantsController
To run pitest on just one package, use:
mvn pitest:mutationCoverage -DtargetClasses=edu.ucsb.cs156.dining.controllers.\*
To run full mutation test coverage, as usual, use:
mvn pitest:mutationCoverage
The frontend/nvm-pj.sh script reads the required Node version from frontend/package.json and uses nvm to switch to that version.
Because the script modifies your current shell environment, you must source it rather than run it directly:
cd frontend
source ./nvm-pj.sh
or equivalently:
cd frontend
. ./nvm-pj.sh
Running it without sourcing (e.g. ./nvm-pj.sh) will not affect your current shell session.
