The application uses:
mavento build the projectthymeleaffor templatingflywayto managepostgresdb migrationsseleniumfor feature testingfakerto generate fake names for testingjunit4for unit testingauth0andspring-securityfor authentication and user managementlombokto generate getters and setters for us
- Fork and clone this repository to your machine
- Open the codebase in an IDE like InteliJ or VSCode
- If using IntelliJ, accept the prompt to install the Lombok plugin (if you don't get prompted, press command and comma to open the Settings and go to Plugins and search for Lombok made by Jetbrains and install).
- Create two new Postgres databases:
- Run 'createdb moshpit_dev'
- Run 'createdb moshpit_test'
- Install Maven
brew install maven - Check nothing else runs on port 8080
lsof -i :8080 - Build the app and start the server, using the Maven command
mvn spring-boot:run
The database migrations will run automatically at this point
- Visit
http://localhost:8080/artists/{id}
- Install chromedriver using
brew install chromedriver - Start the server in a terminal session
mvn spring-boot:run -Dspring-boot.run.profiles=test - Open a new terminal session and navigate to the team-moshpit-project directory
- Check nothing else runs on port 8080
lsof -i :8080 - Run your tests in the second terminal session with
mvn test
All the tests should pass. If one or more fail, read the next section.
For the feature tests to execute properly, you'll need to have the server running in one terminal session and then use a second terminal session to run the tests.
Selenium uses Chromedriver to interact with the Chrome browser. If you're on a Mac, Chromedriver needs to be in /usr/local/bin. You can find out where it is like this which chromedriver. If it's in the wrong place, move it using mv.
Your Mac might refuse to open Chromedriver because it's from an unidentified developer. If you see a popup at that point, dismiss it by selecting Cancel, then go to System Preferences, Security and Privacy, General. You should see a message telling you that Chromedriver was blocked and, if so, there will be an Open Anyway button. Click that and then re-try your tests.