Update Deliverable_3 authored by Hooria Fatima (xcm172)'s avatar Hooria Fatima (xcm172)
......@@ -496,44 +496,37 @@ As GrandGourmetGary, I want to see how my recipes are performing compared to oth
| **TC29 – US3** | New recipe affects score | Create recipe → Update score | Score +15 | Rank updates +15 | Updated by 15 | Pass |
| **TC30 – US3** | View chef score breakdown | Home → Click “\>” | — | Chef score + graph displayed | Score + pie graph shown | Pass |
## Testcases - Aron
## **User Story 3 – AI Recipe Generation (10 Test Cases)**
### User Story:
As Campus Chris, I want to enter specific ingredients I already have, then the system should automatically (using AI) generate a new recipe that adapts to those ingredients, customizing quantities, cooking time, and any missing items with substitutions.
| Test Case ID | Test Scenario | Test Steps | Test Data | Expected Result | Actual Result | Pass/Fail |
|--------------|---------------|------------|-----------|------------------|---------------|-----------|
| **TC-TT-021 – US3** | AI recipe generation happy path | Enter "chicken, rice, garlic" → Click Generate Recipe | ingredients: chicken, rice, garlic | AI returns full customized recipe (quantities + cooking time) | --- | --- |
| **TC-TT-022 – US3** | Validate ingredient field required | Leave ingredient field empty → Click Generate | ingredients: "" | Error: "Please enter at least one ingredient" | --- | --- |
| **TC-TT-023 – US3** | AI handles 1 ingredient | Enter "eggs" → Generate | ingredients: eggs | AI generates simple recipe or suggests missing items | --- | --- |
| **TC-TT-024 – US3** | AI generates substitutions | Enter "pasta, tomato" → Generate | ingredients: pasta, tomato | At least 1 substitution shown | --- | --- |
| **TC-TT-025 – US3** | AI customizes cooking time | Enter ingredients → Generate | ingredients: ground beef, onions | Output includes cooking duration | --- | --- |
| **TC-TT-026 – US3** | AI customizes ingredient quantities | Enter "potatoes, butter" → Generate | ingredients: potatoes, butter | Recipe lists measurable quantities | --- | --- |
| **TC-TT-027 – US3** | AI handles long ingredient list | Enter 12 ingredients → Generate | ingredients: long list | Valid structured recipe still produced | --- | --- |
| **TC-TT-028 – US3** | AI rejects invalid characters | Enter "@@@🔥🔥" → Generate | ingredients: @@@🔥🔥 | Error: "Invalid ingredient input" | --- | --- |
| **TC-TT-029 – US3** | AI handles rare ingredients | Enter "saffron" → Generate | ingredients: saffron | AI gives recipe or alternatives | --- | --- |
| **TC-TT-030 – US3** | Displays loading state during AI fetch | Enter ingredients → Generate | ingredients: chicken, onions | Shows "Loading…" animation during fetch | --- | --- |
---
## **User Story 4 – Favourite Recipes (10 Test Cases)**
### User Story:
As Campus Chris, I want to create a list that contains my favourite recipes.
| Test Case ID | Test Scenario | Test Steps | Test Data | Expected Result | Actual Result | Pass/Fail |
|--------------|---------------|------------|-----------|------------------|---------------|-----------|
| **TC-TT-031 – US4** | Add recipe to favourites happy path | Open recipe → Click "Add to Favourites" | recipeId: 101 | Recipe added + confirmation toast | --- | --- |
| **TC-TT-032 – US4** | Prevent duplicate favourites | Click "Add to Favourites" twice | recipeId: 101 | Error: "Already in favourites" | --- | --- |
| **TC-TT-033 – US4** | Remove recipe from favourites | Open favourites → Click Remove | recipeId: 204 | Item removed, list updates | --- | --- |
| **TC-TT-034 – US4** | Empty favourites list | Navigate to Favourites page | none | Shows "No favourite recipes yet" | --- | --- |
| **TC-TT-035 – US4** | Persistence across sessions | Add favourite → Logout → Login → Check | recipeId: 501 | Favourite still saved | --- | --- |
| **TC-TT-036 – US4** | Favourites load within 2 seconds | Go to Favourites page | none | List loads < 2 seconds | --- | --- |
| **TC-TT-037 – US4** | Requires authentication | Logged out → Click "Add to Favourites" | recipeId: 88 | Redirect to Login page | --- | --- |
| **TC-TT-038 – US4** | Heart icon state correct | View recipe card | recipeId: 303 | Filled heart = favourited, outline = not | --- | --- |
| **TC-TT-039 – US4** | Favourites show recipe details | Open Favourites page | recipeId: random | Displays title, image, cook time, ingredients | --- | --- |
| **TC-TT-040 – US4** | Backend failure handling | Simulate server error → Add favourite | recipeId: 300 | Error toast: "Unable to save favourite" | --- | --- |
## **_Test Cases - Hooria_**
### **User Story - 1**: As AnnaAllergyAware, I can filter recipes by multiple allergens (e.g., nuts, gluten, dairy) so that I only see safe meal options tailored to my dietary needs.
| Test Case ID | Test Scenario | Test Steps | Test Data | Expected Results | Actual Results | Pass/Fail |
|--------------|-----------------------------------------|----------------------------------------------------------------|------------------------------------|------------------------------------------------|----------------|-----------|
| TC31 – US1 | Single allergen filter | Go to Search → Allergens = ["Nuts"] in Exclude Ingredients → Click Search | Allergen = Nuts | Only nut-free recipes displayed | Display recipes without "Nuts"| PASS|
| TC32 – US1 | Multiple Exclude Ingredients | Go to Search → Allergens =["Nuts, Gluten, Dairy"] → Click Search | Allergens = [Nuts, Gluten, Dairy] | Only recipes free of all three allergens shown | Show recipes without the allergens| PASS|
| TC33 – US1 | Exclude Ingredient with no matches | Select rare allergen combination → Click Search | Allergens = [Shellfish, Soy, Eggs] | "No recipes found" message displayed | display recipes without these allergens | PASS|
| TC34 – US1 | Allergen filter preserves other filters | Apply Cuisine = Thai → Add Allergen = Gluten → Search | Cuisine = American , Allergen = Gluten | Only gluten-free American recipes shown |Display American recipes that are gluten free | PASS |
| TC35 – US1 | Clear allergen filters | Apply allergen filters → Click "Clear Allergen Filters" | Select "Nuts" "Dairy" | Allergen filters removed; all recipes shown | recipes without allergens | FAIL|
| TC36 – US1 | Allergen badge display | View recipe with allergens → Check allergen tags | Recipe contains nuts, dairy | Allergen badges clearly visible on recipe card | Show allergen badge(when clicked on recipe)| PASS |
### **User Story - 2**: As AnnaAllergyAware, I want to join a community of like-minded users so that I can exchange tips, ask questions, and discuss healthy, allergy-safe cooking practices.
| Test Case ID | Test Scenario | Test Steps | Test Data | Expected Results | Actual Results | Pass/Fail |
|--------------|---------------|------------|-----------|------------------|----------------|-----------|
| TC39 – US2 | comment to the recipe | Click "comment" on recipe → Type comment → Post | Reply = "Thanks for sharing!" | comment under the original post
| shows the comment under post | PASS |
| TC40 – US2 | Like user's comment | Click "Like" on comment | Like +1 | Like count increments; icon highlights | like should show with the comment| PASS |
| TC41 – US2 | View leaderboard position | Go to Leaderboard → Find own rank | User score = 229 | Rank displayed with score breakdown | Should display score along with rank| PASS|
| TC42 – US2 | Earn points for posting recipe | Create new recipe → Submit | Recipe posted | Score increases by +25 points | shows increase in points| PASS|
| TC43 – US2 | Earn points for rating recipe | Rate another user's recipe → Submit | Rating = 4 | Score increases by +3 points | increases points by 3 | PASS |
| TC44 – US2 | Earn points for commenting | Post comment on recipe → Submit | Comment posted | Score increases by +2 points | increases 2 points | PASS |
| TC45 – US2 | Leaderboard updates after activity | Post recipe → View leaderboard | Score +40 | Rank updates to reflect new score | update rank and score after activity | PASS |
| TC46 – US2 | View score breakdown | Click on own leaderboard entry → View details | — | Creation, performance, engagement points shown | show score breakdown | PASS |
| TC47 – US2 | Filter leaderboard by cuisine | Go to Leaderboard → Select "Italian" filter | Cuisine = Italian | Only users with Italian recipes ranked | should display recipes with filters| PASS |
| TC48 – US2 | View nearby rankings | Load leaderboard | User rank = 45 | Shows ranks 43-47 with user highlighted | only shows top 3 | FAIL|
| TC49 – US2 | Check rank change indicator | View leaderboard after activity | Previous rank = 50, New = 45 | Green arrow showing "+5" improvement | should display changes | FAIL|
| TC50 – US2 | View top contributors | Go to Community → Click "Top Contributors" | — | Top 10 users by score displayed | display top users | PASS |
| TC51 – US2 | Empty leaderboard state | New installation → Load leaderboard | No users with points | "No rankings yet. Start contributing!" shown | should display when no contribution| PASS|
**3. Inspection/Review** **- As a group, customize the code inspection document/checklist (which will be provided in the lecture) and add other appropriate items to fit your product (giving us an exact replica of the checklist will be a zero).**
......@@ -698,8 +691,6 @@ As Campus Chris, I want to create a list that contains my favourite recipes.
| Implementation | Do loops/branches terminate correctly? | Yes. |
| Implementation | Are if-else/switch structures complete and readable? | Yes, with comments when needed |
**_Hiba's Report to Herin_**
| Category | Inspection Question | Answer |
......@@ -747,55 +738,49 @@ As Campus Chris, I want to create a list that contains my favourite recipes.
| **Implementation** | Do loops/branches terminate correctly? | Yes |
| **Implementation** | Are if-else/switch structures complete and readable? | Yes |
## **Aron – Code Review for Hooriya**
| Category | Inspection Question | Answer |
|----------|---------------------|--------|
| **General** | Does the code work as intended for the feature being reviewed (e.g., search, filters, comments, recipe upload, leaderboard)? | Yea |
| **General** | Is the code easy to read and understand without relying on external explanations? | Yea |
| **General** | Does the code follow our team’s conventions (React component naming, consistent indentation, meaningful variable names, clear folder structure)? | Yea |
| **General** | Is there any repeated logic that could be moved into shared utilities (e.g., API error handlers, database queries, form validation)? | Nah |
| **General** | Is the component or function modular, or is it doing more than one responsibility? | Modular |
| **General** | Are there unnecessary global variables or shared state values? | Nah |
| **General** | Is there commented-out code that should be removed? | Yea |
| **General** | Are loops, array maps, and async workflows properly controlled? | Yea |
| **General** | Do variable and function names clearly describe their purpose? | Yea |
| **Performance** | Are there any expensive operations running too often (re-fetches, un-memoized computations)? | Nah |
| **Performance** | Can built-in methods replace custom loops? | Nah |
| **Performance** | Are unnecessary console logs/debugging statements left in the code? | Yea |
| **Performance** | Are API calls grouped efficiently? | Yea |
| **Security** | Are backend inputs validated before being used in queries? | Yea |
| **Security** | Are database queries protected using parameterized queries (pg-pool)? | Yea |
| **Security** | Are errors from third-party tools handled properly? | Yea |
| **Security** | Are invalid parameters rejected with proper error responses? | Yea |
| **Security** | Are protected routes using authentication middleware correctly? | Yea |
| **Documentation** | Are comments meaningful where logic is not obvious? | Yea |
| **Documentation** | Are all API routes documented clearly? | Yea |
| **Documentation** | Are edge cases explained? | Yea |
| **Documentation** | Are third-party libraries used clearly? | Yea |
| **Documentation** | Are TODOs marked clearly? | Yea |
| **Documentation** | Are data structures explained? | Yea |
| **Testing** | Is the code structured to be testable? | Yea |
| **Testing** | Can functions be manually triggered for testing? | Yea |
| **Testing** | Are input validations testable? | Yea |
| **Testing** | Could custom logic be replaced with built-in utilities? | Nah |
| **Implementation** | Are descriptive variable names used consistently? | Yea |
| **Implementation** | Any confusing or similar variable names? | Nah |
| **Implementation** | Are state/backend variables initialized properly? | Yea |
| **Implementation** | Should non-local variables be moved inside functions? | Nah |
| **Implementation** | Should literal values (rating limits, pagination size) be constants? | Nah |
| **Implementation** | Are constants used for repetitive values? | Nah |
| **Implementation** | Are function/handler names descriptive? | Yea |
| **Implementation** | Are parameters validated before use? | Yea |
| **Implementation** | Do functions return correct structures/status codes? | Yea |
| **Implementation** | Any overflow or invalid calculation risks? | Nah |
| **Implementation** | Are parentheses/grouping used correctly? | Yea |
| **Implementation** | Are async operations handled safely? | Yea |
| **Implementation** | Do loops/branches terminate correctly? | Yea |
| **Implementation** | Are conditionals readable and complete? | Yea |
**_Aron's Report to Hooriya_**
**_Hooriya's Report to Aron_**
| Category | Inspection Question | Answer|
| ------ | ------ | ------ |
| **General** |Does the code work as intended for the feature being reviewed? | Yes, login, logout, signup and auth all work as expected |
|**General** |Is the code easy to read and understand? | Mostly yes, well structured and readable |
| **General** |Does the code follow team coding conventions? |Yes its consistent throughout |
| **General** |Any repeated logic that should be moved to shared utilities? | |Yes, email/username/password validation appears multiple times and should be moved to a helper file.
| **General** |Is the component or function modular? | Yes |
|**General** | Any unnecessary global variables or shared state? |No, everything is local to functions. |
|**General** |Any commented-out code that should be removed? | A few bits in frontend but the rest is fine |
|**General** |Are async workflows properly controlled? | Yes, async/wait used correctly. |
|**General** |Do variable/function names clearly describe their purpose? |Yes |
|**Performance** |Any expensive operations running too often? | |No, database queries only run when necessary
|**Performance** | Can built-in methods replace custom loops? | built-in methods are used where suitable |
|**Performance** |Any unnecessary console logs? |A few, mostly in catch blocks(fine for debugging purposes) |
|**Performance** |Are database calls grouped efficiently? |Yes, queries are minimal and well structured. |
|**Security** |Are backend inputs validated before queries? |Mostly, sign up uses strong validation but login checks only presence. |
|**Security** |Are database queries protected (parameterized)? |Yes, all queries are parameterized. |
|**Security** |Are password hashes managed securely? |Yes, bcrypt for comparison, custom encrypt() on signup. |
|**Security** |Are invalid parameters rejected correctly? |Yes. |
|**Security** |Is token generation and cookie handling safe? |Yes. |
|**Documentation** |Are comments meaningful where logic is complex? |Yes. |
|**Documentation** |Are API routes documented? | |Partially
|**Documentation** |Are edge cases explained? | No |
|**Documentation** |Are TODOs marked clearly? |Yes, marked where needed. |
|**Documentation** |Are data structures explained? |No, user object shape relies on database but not documented. |
|**Testing** |Is the code structured to be testable? |Yes. |
|**Testing** |Can functions be manually tested? |Yes |
|**Testing** |Are input validations testable? |Yes |
|**Testing** |Could custom logic be replaced with built-ins? |No, built-ins are already used where needed. |
|**Implementation** |Are variable names descriptive? | Yes |
|**Implementation** |Any confusing or similar variables? |No. |
|**Implementation** |Are variables/state initialized properly? | Yes |
|**Implementation** |Can non-local variables be moved inside functions? | |No issues
|**Implementation** |Should literal values be constants? | Yes, password length, username length should be constants |
|**Implementation** |Are constants reused consistently? |No, validations repeated manually. |
|**Implementation** |Are parameters validated before use? |Mostly. |
|**Implementation** |Do functions return correct structures/status codes? |Yes, they are consistent. |
|**Implementation** |Are async operations handled safely? |Yes. |
|**Implementation** |Any possible overflow/invalid values? |No, numeric checks not used. |
|**Implementation** |Are branching structures readable? | Yes. |
**4. Contributions and Action Plan**
......@@ -806,7 +791,7 @@ Team Contribution Breakdown
| Member | Work Completed | Contribution % |
|--------|----------------|----------------|
| Amna Shakeel | Worked on Deliverable 3: made test cases for my user stories, including search/filtering and commenting and rating. Tested these cases manually. Reviewed the searching/filter for Hiba. | 20% |
| John Aron Calderon | worked on middleware, fixed many auth bugs, error handling, front end ui and other helper functions and logic. | 20% |
| John Aron Calderon | | 20% |
| Hiba Ajaz | reviewed the Recipe creation/editing/deletion, AI recipe generation, frontend recipe forms, image upload handling, recipe display pages. Wrote tests for teh search and filter user stories. | 20% |
| Herin Patel | reviewed the comment and rating section for Amna .wrote and tested the testcases for 3 of my user stories. | 20% |
| Hooria Fatima | . | 20% |
......@@ -826,5 +811,3 @@ Team Contribution Breakdown
Amna's: I used ChatGPT to help format the test cases, clean up wording, and organize sections of this document but all final content reflects my own work and decisions.
Herin's: I used AI to review and help me in formatting my testcases, i also used it to format my suggestion. Wherever I used AI I made sure to review it properly first and tahn add it.
\ No newline at end of file
Aron: I used AI to review and format everything as well as help me brainstorm a few of the test cases.
\ No newline at end of file