# CS180 Project5: Marketplace Messaging App -- Testing This document contains test cases for our Project 5 Program. ### Test 1: User Sign Up #### Steps: 1. User launches application 2. User hits the "sign up" button 3. User enters a valid name 4. User enters a valid email 5. User enters a valid password 6. User enters the password again to confirm 7. User choose the user type from a dropdown manu (seller/customer) 8. User hits the "Sign Up!" button #### Expected Result: Application verifies the user's information, shows "Sign Up Success" message, and store user's information into ```loginDetails.txt```. After user clicks "OK" on the dialog box, program returns to the initial log in page. #### Test Result: PASS ### Test 2: Invalid name when signing up #### Steps: 1. User launches application 2. User hits the "sign up" button 3. User enters an invalid name (empty or contains special character) 4. User hits the "Sign UP!" button #### Expected Result: Application shows an error message box indicating a name error and goes back to the sign up page when user hits "OK" button or close the error message. #### Test Result: PASS ### Test 3: Invalid email when signing up #### Steps: 1. User launches application 2. User hits the "sign up" button 3. User enters a valid name 4. User enters an invalid email (not following email format or email being occupied) 5. User hits the "Sign UP!" button #### Expected Result: Application shows an error message box indicating an email error and goes back to the sign up page when user hits "OK" button or close the error message. #### Test Result: PASS ### Test 4: Invalid password when signing up #### Steps: 1. User launches application 2. User hits the "sign up" button 3. User enters a valid name 4. User enters a valid email 5. User enters an invalid password (less than 3 characters long or contains ",") 6. User hits the "Sign UP!" button #### Expected Result: Application shows an error message box indicating a password error and goes back to the sign up page when user hits "OK" button or close the error message. #### Test Result: PASS ### Test 5: Password doesn't match when signing up #### Steps: 1. User launches application 2. User hits the "sign up" button 3. User enters a valid name 4. User enters a valid password 5. User re-enter the password that doesn't match the previously entered password 6. User hits the "Sign UP!" button #### Expected Result: Application shows an error message box indication that the two passwords entered doesn't match and goes back to the sign up page when user hits "OK"button or close the error message. #### Test Result: PASS ### Test 6: Sign in #### Steps: 1. User launches application 2. User enters their email and password 3. User hits the "Sign In" button #### Expected Result: The program checks for login details and show the main manu according to the role type (seller or customer) of the account. #### Test Result: PASS ### Test 7: Sign in with incorrect email #### Steps: 1. User launches application 2. User enters an email that's not signed up 3. User hits the "Sign In" button #### Expected Result: The program pops up an error message of "email not found" and returns to the sign in page when the user hits OK or closes the window. #### Test Result: PASS ### Test 8: Sign in with incorrect password #### Steps: 1. User launches application 2. User enters an email that's signed up 3. User enters incorrect password for that account #### Expected Result: The program pops up an error message of "incorrect password" and returns to the sign in page when the user hits OK or closes the window. #### Test Result: PASS ### Test 9: Log out in the main menu for seller #### Steps: 1. User launches application 2. User logs in as a seller 3. User hits the "log out" button on the main menu #### Expected Result: The application logs the user out and return to the sign in page. #### Test Result: PASS ### Test 10: Log out in the main menu for customer #### Steps: 1. User launches application 2. User logs in as a customer 3. User hits the "log out" button on the main menu #### Expected Result: The application logs the user out and return to the sign in page. #### Test Result: PASS ### Test 11: Seller creates a new store #### Steps: 1. User launches application 2. User logs in as a seller 3. User hits the "Create new store" button 4. User enters a valid new store name and new store description 5. User hits the "Create Store!" button #### Expected Result: The application creates a new store for that seller and returns to the seller's main menu. #### Test Result: PASS ### Test 12: Seller trying to create a store with empty store name #### Steps: 1. User launches application 2. User logs in as a seller 3. User hits the "Create new store" button 4. User hits the "Create Store!" button without entering the store name #### Expected Result: The application opens a message panel showing error message **"the name field cannot be empty!"** and returns to the create new store page when user hits "OK" or "X" #### Test Result: PASS ### Test 13: Seller trying to create a store with empty store description #### Steps: 1. User launches application 2. User logs in as a seller 3. User hits the "Create new store" button 4. User enters a valid store name 5. User hits the "Create Store!" button without entering the store description #### Expected Result: The application opens a message panel showing error message **"the description field cannot be empty!"** and returns to the create new store page when user hits "OK" or "X". #### Test Result: PASS ### Test 14: Seller views messages with customers #### Steps: 1. User launches application 2. User logs in as a seller 3. User clicks "View Customers" 4. User chooses the customer to view message and the store to use for messaging from the drop-down menu 5. User clicks "Next" Button #### Expected Result: Application shows the **messaging interface** which shows all the chat history between the seller and the customer(if any) and provides a series of buttons for different functions. #### Test Result: PASS ### Test 15: User goes back to main menu from messaging interface #### Steps: 1. User launches the application 2. User login as a seller 3. User goes to **messaging interface** following steps in test 14 4. User clicks on "Back" button in the lower right corner 5. User clicks on "Back" button again on the next frame #### Expected Result: Application returns to the main seller menu #### Test Result: PASS ### Test 16: Seller send normal typed message #### Steps: 1. User launches application 2. User logs in as a seller 3. User hits the "View Customers" button 4. User chooses the customer to message and the store to use for messaging from the drop-down menu 5. User hits "Next" button 6. User hits the "Send Message" button 7. User chooses "Typed Message" from the first drop-down menu 8. User chooses "Message" from the second drop-down menu 9. User write the message content to the text field 10. User hits "Send" button #### Expected Result: The program goes back to the messaging window, shows the messaging history, a "NEW MESSAGES BELOW" divider, and the message just sent below the divider. It also stores the message information in a text file for the other end to read. #### Test Result: PASS ### Test 17: Seller send an empty message #### Steps: 1. User launches application 2. User logs in as a seller 3. User goes to **messaging interface** following steps in test 14 4. User clicks "Send Message" button 5. User chooses "Typed Message" from the first drop-down menu 6. User chooses "Message" from the second drop-down menu 7. User hits "Send" button without input in the "Write Message" text field #### Expected Result: An error message "You cannot send an empty message" pops up and the program returns to send message page when user hits "OK" or "X". #### Test Result: PASS ### Test 18: Seller edit message #### Steps: 1. User launches application 2. User logs in as a seller 3. User goes to **messaging interface** following steps in test 14 4. User clicks "Edit Message" button 5. User chooses the message to be edited from the dropdown menu 6. User enters the new message content into the text field below 7. User clicks on "Edit" button #### Expected Result: The message is edited. The application returns to the **messaging interface** and shows the updated chat history. #### Test Result: PASS ### Test 19: Seller editing a message to an empty one #### Steps: 1. User launches application 2. User logs in as a seller 3. User goes to **messaging interface** following steps in test 14 4. User clicks "Edit Message" button 5. User chooses the message to be edited from the dropdown menu 6. User hits "Edit" button without entering anything in the text field #### Expected Result: Program pops up an error message "You cannot edit the message to an empty message", and returns to the **messaging interface** when user hits "OK" or "X". #### Test Result: PASS ### Test 20: Seller export conversation history to a .csv file #### Steps: 1. User launches application 2. User logs in as a seller 3. User goes to **messaging interface** following steps in test 14 4. User hits "Export Message" button #### Expected Result: The application exports the current conversation history to a .csv file and store that in the current file directory. It also pops up a messaging panel showing "You have successfully downloaded the conversation history with this customer". #### Test Result:PASS ### Test 21: Seller export conversation history that doesn't exist to a .csv file 1. User launches application 2. User logs in as a seller 3. User selects a customer with no conversation history and goes to **messaging interface** following steps in test 14 4. User hits "Export Message" button #### Expected Result: The application doesn't export anything and shows an error message "You have no conversation history with this customer", then go back to the **messaging interface** after user hits "OK" or "X". #### Test Result: PASS ### Test 22: Seller deleting a message #### Steps: 1. User launches application 2. User logs in as a seller 3. User goes to **messaging interface** following steps in test 14 4. User hits **Delete Message** button 5. User chooses the message to be deleted from the drop-down menu on the next page 6. User hits **Delete** button #### Expected Result: The application deletes that message from the chat history only for this user. It then returns to the **messaging interface** with the updated chat history. Upon checking the message interface for the receiver, the deleted message will still appear in their message history as the message is only deleted for the user who initiated the delete. #### Test Result: PASS ### Test 23: Seller blocking a customer #### Steps: 1. User launches application 2. User logs in as a seller 3. User goes to **messaging interface** following steps in test 14 with a customer that's not blocked 4. User hits **Block Customer** button at the top #### Expected Result: The application blocks the customer of the current conversation and shows a panel with message "You have successfully blocked this customer!" The **Block Customer** button automatically turns to **Unblock Customer**. After the user hits "OK" or "X", the application returns to **messaging interface**. Using the blocked customer's account to message the seller will result in the error: **You have been blocked by this seller and won't be able to send messages to any of their stores until they unblock you.** #### Test Result: PASS ### Test 24: Seller unblocking a customer #### Steps: 1. User launches application 2. User logs in as a seller 3. User goes to **messaging interface** following steps in test 14 with a customer that's blocked 4. User hits **Unblock Customer** button at the top #### Expected Result: The application unblocks the customer of the current conversation and shows a panel with message "You have successfully unblocked this customer!" The **Unlock Customer** button automatically turns to **Block Customer**. After the user hits "OK" or "X", the application returns to **messaging interface**. The customer can now send messages to the seller. #### Test Result: PASS ### Test 25: Seller become invisible to customer #### Steps: 1. User launches application 2. User logs in as a seller 3. User goes to **messaging interface** following steps in test 14 with a customer set to be visible 4. USer hits **Become Invisible to Customer** button #### Expected Result: The application sets the current seller to become invisible to the customer in current conversation and shows a panel with message "You have successfully became invisible to this customer!" and returns to the **message interface** after user hits "OK" or "X". The **Become Invisible to Customer** button automatically turns to **Become Visible to Customer**. Upon trying to search for the seller in the customer's page, the seller's name would not appear as a search result. #### Test Result: PASS ### Test 26: Seller become visible to customer #### Steps: 1. User launches application 2. User logs in as a seller 3. User goes to **messaging interface** following steps in test 14 with a customer set to be invisible 4. USer hits **Become Visible to Customer** button #### Expected Result: The application sets the current seller to become visible to the customer in current conversation and shows a panel with message "You have successfully became visible to this customer!" and returns to the **message interface** after user hits "OK" or "X". The **Become Visible to Customer** button automatically turns to **Become Invisible to Customer**. The seller's name now becomes visible when searching for them. #### Test Result: PASS ### Test 27: Seller searching a customer with empty text field input #### Steps: 1. User launches the application 2. User logs in as a seller 3. User hits **Search Customers** button 4. On the next frame, user hits **Next** button without inputting anything into the text field #### Expected Result: The program shows a message panel with message "The search field cannot be empty!" and returns to the previous frame when user hits "OK" or "X" #### Test Result: PASS ### Test 28: Seller searching a customer to contact #### Steps: 1. User launches the application 2. User logs in as a seller 3. User hits **Search Customers** button 4. On the next frame, user enters a customer name that's signed up to be searched 5. User hits **Next** button #### Expected Result: The program opens a new frame with a dropdown box for stores and dropdown box for customer names that matches the word for searching from user. #### Test Result: PASS ### Test 29: Seller choosing from the result of searching customers (Following Test 28) #### Steps: 1. Follow steps from test 28 to the search result frame 2. User chooses from the store for contacting on the first dropdown box 3. User chooses a customer that matches the search input 4. User hits **Next** button #### Expected Result: The program opens the **messaging interface** between the user and the chosen customer #### Test Result: PASS ### Test 30: Seller searches for a customer name that doesn't exist #### Steps: 1. User launches the application 2. User logs in as a seller 3. User hits **Search Customers** button 4. On the next frame, user enters a customer name that's not signed up to be searched 5. User hits **Next** button #### Expected Result: The program opens a new frame with a dropdown box for stores and an empty dropdown box for search results, as there's no matching name. If user hits **Next** button on this page, the application shows a panel with information "There are no customers matching your search!" and return to the previous frame after user hits "OK" or "X". #### Test Result: PASS ### Test 31: Seller modify account menu #### Steps: 1. User launches application 2. User logs in as a seller 3. User hits the **Modify Account** button #### Expected Result: Program opens a new frame and shows the login information of the current account, including name, email and password. It also provides four buttons at the bottom: **back**, **edit**, **save**, and **delete account** #### Test Result: PASS ### Test 32: Seller editing account information (Following test 31) #### Steps: 1. Go to modify account panel following steps in test 31 2. User hits the **Edit** button 3. User edits the account information on the next frame 4. User hits the **Save** button #### Expected Result: Program checks for the changed account information. If there's no error, the program save the changes and shows an information panel "Changes Saves". It then returns to modify account panel after user hits "OK" or "X". #### Test Result: PASS ### Test 33: Seller editing account with invalid information #### Steps: 1. Go to modify account panel following steps in test 31 2. User hits the **Edit** button 3. User edits the account with invalid information 4. User hits **Save** button #### Expected Result: An error message pops up indicating the error in input, then goes back to the editing account page after user hits "OK" or "X" #### Test Result: PASS ### Test 34: Seller deleting account #### Steps: 1. Go to modify account panel following steps in test 31 2. User hits the **Delete Account** button #### Expected Result: A farewell message pops up saying "We are sorry to see you go :(", then deletes all the account information, including login information, all message histories, all the stores creates, etc. The program then returns to the login page. #### Test Result: PASS ### Test 35: Customer views new messages with sellers #### Steps: 1. User launch the application 2. User logs in as a customer 3. User hits **View Stores** button 4. User selects the store to contact from the drop-down menu 5. User hits **Next** button #### Expected Result: The program enters the **message interface** with the selected store with all buttons working properly #### Test Result: PASS ### Test 36: Customer searches for seller #### Steps: 1. User launch the application 2. User logs in as a customer 3. User hits **Search Sellers** button 4. User enters the name of the seller to be searched 5. User press the **Next** button #### Expected Result: Program checks for the information that matches the customer's input, then shows a dropdown box including all stores of the seller that matches user's input. If customer choose from the results and hit **Next Button**, the application enters the **messaging interface** with the chosen store. #### Test Result: PASS ### Test 37: Customer searches for seller with invalid information #### Steps: 1. User launch the application 2. User logs in as a customer 3. User hits **Search Sellers** button 4. User enters a seller's name that does not exist or has no stores 5. User hits **Next** button #### Expected Result: There's no store matching the user's input, so the dropdown box will be empty. If the user hits **Next** button, the program will show an error message "There ar no stores matching the sellers you search..." and goes back to the previous page after user hits "OK" or "X" #### Test Result: PASS ### Test 38: Customer searches for seller with empty string #### Steps: 1. User launch the application 2. User logs in as a customer 3. User hits **Search Sellers** button 4. User leaves an empty string in the text field 5. User hits **Next button #### Expected Result: An error message "The search field cannot be empty" pops up and the program returns to the search seller page after user hits "OK" or "X". #### Test Result: PASS ### Test 39: Customer modify account panel #### Steps: 1. User launch the application 2. User logs in as a customer 3. User hits **Modify Account** button #### Expected Result: **Modify account** panel will appear showing the account information of the user that's currently logged in (Name, email, and password). Four buttons will appear at the bottom: **Back**, **Edit**, **Save** and **Delete Account**. #### Test Result:PASS ### Test 40: Customer modifying account #### Steps: 1. User enters the **Modify account** panel following steps in test 39 2. User hits **Edit** button 3. The information will turn into text field format 4. User enters the account information they want to modify to 5. User hits **Save** button #### Expected Result: The program checks for user's input to make sure everything works, then changes the user's account information and shows a message "Changes Saved!" #### Test Result: PASS ### Test 41: Customer deleting account #### Steps: 1. User enters **modify account** panel following steps in test 39 2. User hits **Delete Account** button #### Expected Result: A farewell message pops up saying "We are sorry to see you go :(", then deletes all the account information, including login information, all message histories, block and invisible information, etc. The program then returns to the login page. #### Test Result: PASS ### Test 42: Seller viewing new message #### Steps: 1. User launches the application 2. User logs in as a seller 3. User hits the **New Message** button #### Expected Result: Before hitting the **New Message** button, the button displays the number of new messages; after hitting the button, the program displays every customer that has a new message, along with the number of new messages, in a dropdown menu. After user chooses a specific store and hit **Next**, the program enters the **message interface** with that store. #### Test Result: PASS ### Test 43: Seller viewing new message when there's no new message #### Steps: 1. User launches the application 2. User logs in as a seller 3. User hits the **New Message** button when there's no new message (shown as "New Message(0)" on the button) #### Expected Result: The program enters a new frame with an empty dropdown menu because there's no new messages. If the user tries to hit **Next**, the program shows an error message "there are no new messages!" #### Test Result: PASS ### Test 44: Customer viewing new message #### Steps: 1. User launches the application 2. User logs in as a customer 3. User hits the **New Message** button #### Expected Result: Before hitting the **New Message** button, the button displays the number of new messages; after hitting the button, the program displays the every store that has a new message in a dropdown menu, along with the number of new messages. After user chooses a specific store and hit **Next**, the program enters the **message interface** with that store. #### Test Result: PASS ### Test 45: Customer viewing new message when there's no new message #### Steps: 1. User launches the application 2. User logs in as a customer 3. User hits the **New Message** button when there's no new message (shown as "New Message(0)" on the button) #### Expected Result: The program enters a new frame with an empty dropdown menu because there's no new messages. If the user tries to hit **Next**, the program shows an error message "there are no new messages!" #### Test Result: PASS ### Test 46: Seller viewing store statistics #### Steps: 1. User launches the application 2. User logs in as a seller 3. User hits the **View Statistics** button 4. User chooses the store to view statistics from a dropdown menu and hits **Next** #### Expected Result: The program opens a new frame showing the statistics of the corresponding store, with the top 10 most common words displayed at the left and number of messages from each customer at the right, sorted in default order (by each user's registration time). #### Test Result: PASS ### Test 47: Seller sorting store statistics (Following test 46) #### Steps: 1. User enters the seller statistics panel following steps in test 46 2. User hits the "Increasing statistics" or "Decreasing statistics" button #### Expected Result: The statistics of messages on the right side are sorted in an increasing order("Increasing statistics") or decreasing order("Decreasing statistics") of messages received from top to bottom #### Test Result: PASS ### Test 48: Customer viewing message statistics #### Steps: 1. User launches the application 2. User login in as a customer 3. User hits the **View Statistics** button #### Expected Result: The program opens a new frame showing the statistics of all chats of the user, with counts for messages sent to stores at the left and number of messages received from each customer at the right, sorted in default order (by each user's registration time). #### Test Result: PASS ### Test 49: Customer sorting message statistics #### Steps: 1. User enters the customer statistics panel following steps in test 48 2. User hits the "Increasing statistics" or "Decreasing statistics" button on the left #### Expected Result: The statistics of messages sent to stores on the left side are sorted in an increasing order("Increasing statistics") or decreasing order("Decreasing statistics") of messages received from top to bottom #### Test Result: PASS ### Test 50: Customer sorting message statistics #### Steps: 1. User enters the customer statistics panel following steps in test 47 2. User hits the "Increasing statistics" or "Decreasing statistics" button on the right #### Expected Result: The statistics of messages received from stores on the left side are sorted in an increasing order("Increasing statistics") or decreasing order("Decreasing statistics") of messages received from top to bottom #### Test Result: PASS ### Test 51: Concurrency #### Steps: 1. User launches 2 instances of MessagingClient after starting MessagingServer. 2. User logs in as a seller in one instance and as a customer in the other. 3. For both instances of client, user navigates to the messaging interface to send a message. #### Expected Result: Both instances of client can proceed concurrently, and are independent of one another. The client instance that sends the message first would have their message displayed earlier in the chat history. #### Test Result: PASS ### Test 52: File import #### Steps: 1. User (Seller/Customer) navigates to the message interface. 2. User clicks on Send Message button 3. User chooses "File Import" in the dropdown box on how the message will be received. 4. User inputs the name of a valid .txt in their working directory. #### Expected Result: The messages in the file appear in the message history. Each line of text in the file represents one message, i.e., if the file has 5 lines of text, there will be 5 new messages sent. #### Test Result: PASS ### Test 53: Disappearing Messages #### Steps: 1. User (Seller/Customer) navigates to the message interface. 2. User clicks on Send Message button 3. User chooses "Disappearing Message" in the dropdown box on the type of message to send. 4. User inputs the text in the JTextField. #### Expected Result: The disappearing message appears in the message history with a "(Disappearing)" mark. Upon seeing the disappearing message and exiting the messaging interface, the disappearing message will disappear. This applies for both sender and receiver. #### Test Result: PASS