Skip to content

DandyAkira/CEN5035_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sprint 4

Team members

NAME GITHUB NAME EMAIL DUTY
Ruoyang Xiong KalmanXiong xiongruoyang@ufl.edu Front-End
Yandi Ma DandyAkira yandi.ma@ufl.edu Back-End
Zixuan Feng ErerF zixuan.feng@ufl.edu Front-End
Jiaqi Cheng TR280 jiaqicheng@ufl.edu Back-End

Description

In the project, we designed a project named GatorChat.By using the Web-App, users can add friends by email, and send messages, emojis, and images to their friends. Besides, they can build groups or join groups by id. People in the same group can chat with others.

We implemented the backend by using Golang, and implement the frontend by using NodeJS. We used Cypress and Jtest to test our frontend code.

How to run the app?

The preparatory work

  1. Download the code from main branch
  2. create a new database called "gatorchat" in MySQL by using CREATE DATABASE gatorchat
  3. open database/db.go and modify the configuration statements (name and password) according to your own MySQL settings image

Run Program

  1. run the app by typing
go run main.go
  1. open a browser and jump to http://127.0.0.1 then have fun :)

Demo video functionality

sprint4-demo.mp4

Cypress Test

How to run the test?

  • run Gatorchat
go run main.go
  • execute the following command to open Cypress
yarn run cypress open
  • click on the test file (test.js) to start the test

Cypress Test Demo

Sprint4-Cypress.mp4

Frontend Unit Test (Jest)

How to run Jest?

yarn add --dev jest
yarn test

Testing result

image

Backend Unit Test Demo

unit-test.mp4

API doc for the Program

https://easydoc.net/s/88012132

Project Board Link

https://github.com/DandyAkira/CEN5035_Project/projects

Sprint4 deliverables Link

https://github.com/DandyAkira/CEN5035_Project

Back End Log

Update (April 15 2022)

  • The logic for background parsing of parameters in request messages has been optimized [see model/request/ and utils/parsearg.go]

Update (April 14 2022)

  • Add test cases for adding friends
  • Background HTTP request packet format optimization

test adding friends

the first 2 users are chosen to send add friend request to himself, all other users, and users who already is their friend. image

each of these 2 users should receive several response from server:

{"code":0,"msg":"Add Friend Success"}
{"code":-1,"msg":"you can not add yourself as a friend"}
{"code":-1,"msg":"this user is already your friend"}

and the server's terminal will show serveral info like:

Receive Add Friend Requset from: userid to dstid

The test results showed no errors.

Sprint 3

Functions

  • Register
  • Login
  • Private Chat
  • Group Chat
  • Public Chat (Deleted)
  • Friend System
  • Send Emoji
  • Send Picture
  • Change Nick Name
  • Change Avatar

Possible Future Functions

  • Send Video
  • Voice Chat

How to run the app?

The preparatory work

  1. Download the code from main branch
  2. create a new database called "gatorchat" in MySQL by using CREATE DATABASE gatorchat
  3. open database/db.go and modify the configuration statements (name and password) according to your own MySQL settings image

Run Program

  1. run the app by typing
go run main.go
  1. open a browser and jump to http://127.0.0.1 then have fun :)

Screenshots for the program

Register

image

Login

image

Main Page

image

Change nickname

image

Add Friend

image

Private Chat

image

Create New Group

image

Join Group

image

Group Chat

image

Back End Log

Update (March 30 2022)

  • Add Test Cases of "Change Nickname" and "Create New Group"
  • Optimized some background logic

About Test Cases of "Change Nickname"

Test file source code : test/change_name_test.go

The test file will send 3 requests to change the nickname on behalf of each user in the database, They will request their nickname be changed to NULL, the same name to original one, and a different name, respectively. They each receive three responses from the server, where code = 0 means success and code = -1 means fail:

  • "code":-1,"msg":"new name same to current one"
  • "code":-1,"msg":"illegal nickname"
  • "code":0,"msg":"Change Name Sucess"

The results are as follows, there is no fault during the tests:

image

About Test Cases of "Create New Group"

Test file source code : test/create_group_test.go

The test file will send 7 requests to to create new groups on behalf of each user in the database, since the backend logic limits the number of groups that each user can create to 5, so after there are 5 groups created by the same user, he can not create groups anymore, for each user they will receive responses from server as follows:

  • {"code":0,"msg":"New Group Success","data":{"id":1,"name":"group_sEdQ","ownerid":1,"icon":"/asset/images/community.png","cate":0,"memo":"","createat":"2022-03-30T17:00:00.3993923-04:00"}}
  • {"code":-1,"msg":"you already created too many groups"}

The results of testing create group cases of one user is as follows, no fault happens:

image

Update (March 23 2022)

About Avatars/icons

Now users' default icon is a gator icon, users can also change their icon by using the images under /assets/images, and can be normally and correctly shown on other clients' sides. Fully customed avatar still can not be correctly displayed on other clients.

Update (March 22 2022)

  • Users can change their nickname in profile page
  • Password encryption implemented

Password encryption

Users' password will not be directly saved in database, it will be mixed with a random salt string and will be MD5 encrypted. The salt string will change everytime the user login, so the encrypted password saved in the database will keep changing.

Update (March 21 2022)

  • Add Friend via email (no need to know friend's ID)
  • Increase jump correlation between pages