Negash Bekele |
eyob-030 |
berry-k0 |
Lu121921 |
HayatGharad09 |
fiwori |
- Ensure backend is running at
http://localhost:5000 - Install Postman (or use any API testing tool)
- Set up environment:
- Create variable
base_url = http://localhost:5000
- Create variable
POST {{base_url}}/api/auth/register
Content-Type: application/json
{
"username": "testuser",
"email": "test@example.com",
"password": "Test@1234"
}✅ Expected Response (201 Created):
{
"message": "User registered successfully"
}POST {{base_url}}/api/auth/login
Content-Type: application/json
{
"email": "test@example.com",
"password": "Test@1234"
}✅ Expected Response (200 OK):
{
"token": "eyJhbGciOi...",
"userId": 1,
"username": "testuser"
}💡 Save the token for authenticated requests!
GET {{base_url}}/api/products✅ Expected Response (200 OK):
[
{
"id": 1,
"name": "iPhone 13",
"price": 999.99,
"category": "Electronics"
}
]GET {{base_url}}/api/products/1✅ Expected Response (200 OK):
{
"id": 1,
"name": "iPhone 13",
"description": "Latest smartphone",
"price": 999.99,
"category": "Electronics"
}POST {{base_url}}/api/cart
Authorization: Bearer {{token}}
Content-Type: application/json
{
"productId": 1,
"quantity": 2
}✅ Expected Response (200 OK):
{
"message": "Product added to cart"
}GET {{base_url}}/api/cart
Authorization: Bearer {{token}}✅ Expected Response (200 OK):
[
{
"productId": 1,
"name": "iPhone 13",
"price": 999.99,
"quantity": 2
}
]POST {{base_url}}/api/orders
Authorization: Bearer {{token}}
Content-Type: application/json
{
"shippingInfo": {
"address": "123 Main St",
"city": "New York"
},
"paymentMethod": "credit_card"
}✅ Expected Response (201 Created):
{
"orderId": 1,
"message": "Order created successfully"
}GET {{base_url}}/api/orders
Authorization: Bearer {{token}}✅ Expected Response (200 OK):
[
{
"id": 1,
"total": 1999.98,
"status": "pending",
"items": [
{
"productId": 1,
"name": "iPhone 13",
"quantity": 2
}
]
}
]- Register → Login → Add to Cart → Create Order → View Orders
- Browse products without login
- Update cart quantities
- logout
- me
- upload img
- Register with existing username (should fail)
- Add invalid product to cart (should fail)
- Checkout with empty cart (should fail)
for the front-end visit this github here:-https://github.com/eyob-030/E-commerce-Frontend