1. View Expenses
Scenario: User views expense dashboard
- Given the User is on the Expenses Page
- Then the User can see the Total Expense summary at the top
- And the User can see a list of all expenses in a table
- And the expenses table shows Category, Amount, Description, Branches, Created At, and Actions columns
- And the User can see the total number of results displayed at the bottom
Scenario: User filters expenses
- Given the User is on the Expenses Page
- When the User enters 'Pen in the Search field
- Or the User selects a specific Category (E.g: Pen) from the dropdown
- Or the User selects a specific Branch (E.g: Oxygen) from the dropdown
- Or the User specifies a Price Range (E.g: 10)
- Then the expense list will update to show only matching results
Scenario: User sets a price range filter
- Given the User is on the Expenses Page
- When the User clicks on the Price Range filter
- Then a price range selector appears with a slider and input fields
- When the User adjusts the slider or inputs specific minimum and maximum values
- Then the expense list will update to show only expenses within the specified price range
2. Add Expense
Scenario: User adds a new expense
- Given the User is on the Expenses Page
- When the User clicks the Add new expense button
- Then an Add new expense modal will appear
- When the User enters "45" in the Amount field
- And the User selects "Office Supplies" from the Category dropdown
- And the User selects "Downtown Branch" from the Branch dropdown
- And the User enters "Printer ink cartridges" in the Description field
- And the User clicks the Submit button
- Then the modal will close
- And the new expense for "Printer ink cartridges" will be added to the expense list
- And the Total Expense amount will be updated to include the additional 45
- When the User enters "ink" in the Search field
- Then the "Printer ink cartridges" expense appears in the filtered results
- And the expense details show "45" under the Amount column and "Office Supplies" under the Category column
Scenario: User attempts to add an expense with missing required fields
- Given the User is on the Add new expense modal
- When the User leaves the Amount field empty
- Or the User does not select a Category
- Or the User does not select a Branch
- And the User attempts to submit the form
- Then the form will not be submitted
- And the User will be notified that these fields are required
3. Edit Expense
Scenario: User edits an existing expense
- Given the User is on the Expenses Page
- When the User clicks the Edit action for a specific expense
- Then an Edit modal will appear pre-filled with the expense details
- When the User modifies any of the fields
- And the User clicks the Submit button
- Then the modal will close
- And the expense details will be updated in the expense list
- And the Total Expense amount will be updated if the Amount was changed
Scenario: User attempts to save an edit with missing required fields
- Given the User is on the Edit modal for an expense
- When the User clears the Amount field
- Or the User clears the Category selection
- Or the User clears the Branch selection
- And the User attempts to submit the form
- Then the form will not be submitted
- And the User will be notified that these fields are required
4. Delete Expense
Scenario: User deletes an expense
- Given the User is on the Expenses Page and sees a list of recorded expenses, including an item "Pen" with a cost of 25.
- When the User clicks the Delete button next to the "Pen" expense, a confirmation dialog appears.
- And the User confirms the deletion by clicking "Yes, Delete" in the dialog.
- Then the "Pen" expense is removed from the expense list.
- And the total expense amount is updated, reducing by 25.
- And the dialog automatically closes after successful deletion.
- And when the User searches for "Pen" in the expense list, it does not appear.