Complete reference for practising Playwright test automation on the VegCart Fresh Fruits & Vegetables e-commerce app.
VegCart is a single-page e-commerce application for fresh fruits and vegetables. Navigation is entirely tab-based — clicking sidebar buttons swaps visible panels without any page reload. All data is stored in the browser's localStorage, making it ideal for practising automation without a backend.
| Module | Navigation | Key Functionality |
|---|---|---|
| Home | Default tab on load | Hero banner, categories, featured deals, USPs |
| Products | Sidebar → Browse Products | Search, filter, sort, quick view, add to cart |
| Cart | Sidebar → My Cart | View items, update quantities, remove, see totals |
| Checkout | Sidebar → Checkout | Delivery address, payment method, place order |
| Orders | Sidebar → My Orders | Order history, search, filter, details, reorder, cancel |
| Profile | Sidebar → My Profile | Login, signup, logout, edit profile details |
| Wishlist | Sidebar → Wishlist | Save products, add wishlisted item to cart |
| Support | Sidebar → Support | FAQ accordion, contact form, support channels |
priya@example.com | Password — test123. A second user is ravi@example.com / demo123.
The home tab is the landing page of the app. It provides an overview of the store, category shortcuts, and a selection of featured products.
The Products tab is the main catalogue page with 24 items across four categories. It supports full search, sort, and filter capabilities.
The Cart tab displays all items added to the session cart. Changes to quantities update the order summary instantly.
The Checkout tab collects a delivery address and payment method before placing an order. The right panel shows a live order summary matching the cart.
The Orders tab shows the complete order history for the logged-in user. Pre-seeded orders are available immediately without needing to place a new order first.
The Profile tab handles sign-in, new account creation, and logged-in user profile management.
The Wishlist lets users save products for later. Items persist in localStorage across page refreshes.
The Support tab includes contact channel cards, an accordion FAQ, and a contact form.
VegCart exposes 18 tools via the WebMCP browser-native standard, allowing AI agents to interact with the app programmatically — searching for products, managing the cart, placing orders, user authentication, and more — without clicking the UI manually.
Requirements
chrome://flags/#enable-webmcp-testing flag enabled, ORRegistered Tools
| Tool Name | Category | Parameters | What It Does |
|---|---|---|---|
get_product_list |
Products | None | Returns all 24 products with name, price, stock, category, emoji |
searchProducts |
Products | query (string) |
Fills header search box, navigates to Products tab with filtered results |
search_products |
Products | query (string) |
Live search filtering with DOM events and custom event dispatch |
filter_products_by_category |
Products | category (fruits/vegetables/greens/exotic/all) |
Filters products by category and shows Products tab |
get_cart_contents |
Cart | None | Returns cart items, quantities, subtotal, delivery, discount, total |
add_item_to_cart |
Cart | itemName (required)quantity (default 1) |
Adds product by name match, navigates to Cart tab |
remove_from_cart |
Cart | itemName (required) |
Removes item completely from cart by product name |
update_cart_quantity |
Cart | itemName, quantity (both required) |
Updates item quantity (0 to remove item) |
clear_cart |
Cart | None | Removes all items from cart |
get_order_history |
Orders | status (optional)limit (default 10) |
Returns order history filtered by status for current user |
place_order |
Orders | name, phone, address, city, pincode |
Places order with current cart and delivery details |
user_register |
User | name, email, phone (all required) |
Registers new user account with provided details |
user_login |
User | email, password (both required) |
Logs in existing user with email and password |
get_user_info |
User | None | Returns current user info if logged in |
user_logout |
User | None | Logs out current user and navigates to home |
get_wishlist |
Wishlist | None | Returns current user's wishlist items with details |
add_to_wishlist |
Wishlist | itemName (required) |
Toggles product in wishlist by name (add/remove) |
navigate_to_tab |
Navigation | tab (home/products/cart/checkout/orders/profile/wishlist/support) |
Navigates to specified tab/section of the application |
How to Use — Model Context Tool Inspector
http://localhost:4040/testweb/vegcart/ in Chromeget_product_list and click Execute — verify a JSON response with 24 products is returnedsearch_products, set query to carrot, and execute — verify the VegCart UI navigates to Products and shows only matching itemsadd_item_to_cart, set itemName to Spinach and quantity to 2, and execute — verify the Cart tab opens and Spinach × 2 appearsget_cart_contents and execute — verify it returns cart details including subtotal, delivery, and total amountsplace_order with delivery details and execute — verify order is placed and order ID is returnedadd_item_to_cart with a product name that does not exist — verify the tool returns success: false and the cart does not changeexecute() function runs using the arrow-function closure, so this refers directly to the VegCartApp instance. If Chrome runs it in a sandboxed isolate, the code automatically falls back to writing to localStorage and using a BroadcastChannel to signal the live page to refresh its UI.
VegCart features a built-in conversational interface that allows users to perform all shopping activities through natural language chat. The AI assistant interprets user messages and automatically executes appropriate WebMCP tools to fulfill requests.
What You Can Do
Intent Recognition Patterns
| Intent Category | Example Phrases | WebMCP Tool Used |
|---|---|---|
| Product Search | "Search for carrots" "Find all fruits" "Show vegetables" |
search_productsget_product_listfilter_products_by_category |
| Cart Management | "Add 3 tomatoes to cart" "What's in my cart?" "Remove spinach" "Clear my cart" |
add_item_to_cartget_cart_contentsremove_from_cartclear_cart |
| Order Management | "Show my orders" "Place an order" "Order history" |
get_order_historyplace_order |
| User Account | "Who am I?" "My profile" "Log me out" |
get_user_infouser_logout |
| Navigation | "Go to products" "Show me the cart" "Navigate to orders" |
navigate_to_tab |
How to Use — Chat Assistant
Happy Path
Go to Products → Select Vegetables from the category filter → Verify only vegetable items appear in the grid
Search for "spinach" → Locate the result → Click Add → Navigate to Cart → Verify item appears with correct price
Click the eye icon on a product card → Verify the Quick View modal opens with all product details → Close the modal
Add an item to cart → Go to Cart → Increase quantity to 3 using the + button → Verify subtotal = price × 3
Add items until cart subtotal exceeds ₹500 → Verify delivery fee shows FREE in the order summary
Add items → Checkout → Fill delivery form → Select COD → Place Order → Verify success modal and cart resets to 0
Go to Profile → Enter priya@example.com / test123 → Click Sign In → Verify profile panel shows with correct name
Go to Profile → Switch to Create Account tab → Fill all fields → Submit → Verify auto sign-in and profile panel
Heart a product on the Products tab → Go to Wishlist tab → Verify the product card appears in the wishlist grid
Go to Orders → Find a delivered order → Click Reorder → Verify toast and all items appear in the Cart tab
Go to Orders → Click Details on any order → Verify tracker steps, item table, delivery address, and order date in the modal
Go to Support → Click a FAQ question → Verify answer expands → Click a second question → Verify first closes automatically
Fill the contact form → Submit → Verify success toast and form fields are cleared
Go to Products → Select Price: Low to High from the sort dropdown → Verify the first card has the lowest price
On Home tab → Click the Fruits category card → Verify Products tab opens with Fruits already selected in the filter
Negative / Edge Cases
Enter correct email but wrong password → Click Sign In → Verify error toast "Invalid email or password"
Attempt to sign up with priya@example.com → Verify warning toast "Email already registered"
Navigate to Checkout with nothing in cart → Click Place Order → Verify toast "Your cart is empty!"
Fill checkout form but leave PIN Code blank → Click Place Order → Verify validation toast prevents submission
Search for "xyz999" in the Products tab → Verify the empty state "No products found" message appears
Find a Processing order → Click Cancel → Confirm the dialog → Verify status badge changes to Cancelled
Locate a Delivered order → Verify the Cancel button is absent for that card
Add an item → Go to Cart → Click the trash icon → Verify item removed and summary recalculates
Add multiple items → Click Clear Cart → Dismiss the confirm dialog → Verify items remain → Confirm → Verify empty state
Wishlist one item → Go to Wishlist tab → Remove it → Verify the empty state with Browse Products button appears
Add 3 different products → Verify sidebar badge = 3 → Increase one quantity by 2 → Verify badge = 5
Open Quick View modal → Click the × button → Verify closes → Open again → Click the overlay backdrop → Verify closes
Add items to cart and wishlist → Refresh the page → Verify cart and wishlist data are restored from localStorage
Click each sidebar nav button → Verify the clicked item gets the active highlight and the correct tab becomes visible
Login → Change name in profile form → Save → Verify the updated name appears in the sidebar user panel
AI Agent (WebMCP)
Open Model Context Tool Inspector → Execute get_product_list → Verify JSON response contains 24 products with name, price, and category fields
Execute search_products with query "mango" → Verify VegCart navigates to Products tab and grid shows only mango results
Execute add_item_to_cart with itemName "Carrots" and quantity 3 → Verify Cart tab opens automatically and shows Carrots × 3 with correct subtotal
Execute add_item_to_cart with itemName "PineAppleXYZ" → Verify tool returns success: false and cart remains unchanged
Execute add_item_to_cart with itemName "Tomatoes" and quantity 2 → Verify sidebar cart badge increments by 2 without any manual UI interaction
Conversational Interface
Go to Chat Assistant → Type "Show me all fruits" → Verify AI responds and navigates to Products with fruit filter applied
Chat: "Add 2 tomatoes to my cart" → Verify success message and cart update → Chat: "What's in my cart?" → Verify cart contents displayed
Chat: "Find vegetables" → "Add 3 carrots" → "Remove spinach" → "What's my total?" → Verify each step executes correctly with tool results
Chat: "Go to my orders" → Verify navigation → Chat: "Show me the home page" → Verify navigation → Chat: "Take me to products"
Chat: "Book a table for 2" → Verify AI provides helpful fallback message with suggestions for valid actions
Send several messages → Refresh the page → Return to Chat tab → Verify conversation history is retained
Send a message and observe typing indicator appears → Wait for response → Verify typing indicator disappears when response arrives
Click a suggestion button like "What products do you have?" → Verify text fills input → Send message → Verify appropriate response
Chat: "Register me as John Doe with email john@test.com and phone 1234567890" → Verify success → Chat: "Login with john@test.com password test123" → Verify login success
VegCart — Playwright Practice App | Open App