OppoGames is a fullstack social-gaming site, showcasing use of the MERN stack, Socket.io and Tailwind CSS.
Users can sign up, log in, and play a number of mini-games 1v1 with other users. Users can see their opponents moves and message in real-time.
This is my personal extension of the Oppo Games - Group 6 final project at Makers Academy.
- Please see Feature Updates below for ongoing feature implementation updates.
OppoGamesDemo-2xspeed-720medqual.mp4
Features
* Users can view a description of each of our games
* Users can register and see errors if they do not have a unique email and username, or if their password does not have a set length and char set
* Users can see a game lobby, filter by game type or open status or ownership
* Users can create a game
* Users can see errors if they try to play without an opponent
* Users can join games, play and message opponents in realtime
* Users can see errors if they try to play out-of-turn or play out-of-bounds moves
* Users can go back to past games to see the last game-state and message history
Click Me
- ✅
spec/utils/TestHelpers.js
: Supportive functions for shorthand Jest testing. Eg.expectNewToken
,expectAuthError
,expectError(code, message)
- ✅ Battleships Backend with TTD
- ✅ Adds TTD'd: Create, Index, FindByID, Join, Delete, Forfeit, SubmitShipPlacement & LaunchMissile
- ✅ Error handling: Out-of-Turn, Awaiting-Opponent, Game-Already-Over, You-Are-Not-In-This-Game, Cannot-Delete-Ongoing-Game, Cannot-Join-Full-Game, Opponent-Not-Ready, Space-Already-Hit
- ✅ Adds: Concealment supportive function
- ✅ Opponents and game-observers get a concealed view that only shows HITs and MISSes on the game board & the full sank status of ships.
- ✅ Opponents and game-observers DO NOT see remaining ship unit locations, remaining ship unit count or initial ship placements.
- ✅ Concealment occurs in the backend to prevent cheating through inspecting the browser.
- ✅ Adds TTD'd: Create, Index, FindByID, Join, Delete, Forfeit, SubmitShipPlacement & LaunchMissile
Jan 28, 2024:
- ✅ Frontend Test E2E coverage with Cypress
- ✅ Landing Page
- ✅ Signup Popup & Signup Page, Login Popup & Login Page
- ✅ Game Intro Pages: TTT, Battleships, RPS
Jan 21 2024:
-
✅ Backend Test coverage with Jest
- ✅ Added 10 test suites and 185 tests for Users, Messages, Authentication & Tictactoe
- ✅ Tictactoe covers: Create, Index, FindbyID, Join, Delete, Forfeit & PlacePiece
- ✅ Error handling: Out-of-Turn, Awaiting-Opponent, Game-Already-Over, You-Are-Not-In-This-Game, Already-A-Piece-There, Cannot-Delete-Ongoing-Game, Cannot-Join-Full-Game
- ✅ TicTacToe game playthrough for 4 scenarios: X-Win, O-Win, Draw, Forfeit, 9th-Turn-Win
- Install Node Version Manager (nvm)
Then follow the instructions to update your
brew install nvm
~/.bash_profile
. - Open a new terminal
- Install the latest version of Node.js, currently
18.1.0
.nvm install 18
- Install MongoDB
Note: If you see a message that says
brew tap mongodb/brew brew install mongodb-community@5.0
If you need to have mongodb-community@5.0 first in your PATH, run:
, follow the instruction. Restart your terminal after this. - Start MongoDB
brew services start mongodb-community@5.0
-
npm install in the three main folders:
; cd api ; npm install ; cd ../frontend ; npm install ; cd ../socket ; npm install
-
Start the server application (in the
api
directory); cd api ; JWT_SECRET=f6d278bb34e1d0e146a80b16ec254c05 npm start
-
Start the front end application (in the
frontend
directory)
In a new terminal session...
; cd frontend
; npm start
You should now be able to open your browser and go to http://localhost:3000/
-
Start the socket (in the
socket
directory)In a new terminal session...
; cd socket
; npm start
Currently, the project has test coverage for the API only via Jest. E2e frontend testing will be implemented in the future, please see future features list below.
- Start the backend server in test mode. Leave this running for all testing.
# Make sure you're in the api directory
; cd api
; JWT_SECRET=f6d278bb34e1d0e146a80b16ec254c05 npm run start:test
-
Running the backend tests.
In a new terminal session...
# Make sure you're in the api directory
; cd api
; JWT_SECRET=f6d278bb34e1d0e146a80b16ec254c05 npm run test
Note: On first run of test suite, you must run the test twice before they pass. This is because the the test database is created and written during these initial test runs.
-
Running the frontend tests.
** Cypress E2e to be implemented**