Back to App

VegCart — Automation Testing Guide

Complete reference for practising Playwright test automation on the VegCart Fresh Fruits & Vegetables e-commerce app.

Playwright End-to-End 50+ Scenarios E-Commerce SPA WebMCP / AI Agents

App Overview & Architecture

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
HomeDefault tab on loadHero banner, categories, featured deals, USPs
ProductsSidebar → Browse ProductsSearch, filter, sort, quick view, add to cart
CartSidebar → My CartView items, update quantities, remove, see totals
CheckoutSidebar → CheckoutDelivery address, payment method, place order
OrdersSidebar → My OrdersOrder history, search, filter, details, reorder, cancel
ProfileSidebar → My ProfileLogin, signup, logout, edit profile details
WishlistSidebar → WishlistSave products, add wishlisted item to cart
SupportSidebar → SupportFAQ accordion, contact form, support channels
Demo credentials: Email — priya@example.com  |  Password — test123. A second user is ravi@example.com / demo123.

1. Home

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.

  • 1Observe the hero banner with a headline, description, and two action buttons — Shop Now and Track Order
  • 2Find the four stats cards showing Fresh Products, Happy Customers, Orders Delivered, and Customer Rating
  • 3Locate the Shop by Category section with four cards: Fruits, Vegetables, Greens & Herbs, and Exotic Produce
  • 4Click any category card to jump directly to the Products tab with that category pre-filtered
  • 5Observe the Today's Deals section showing a grid of featured products with high ratings
  • 6Click View All next to Today's Deals to navigate to the full products list
  • 7Add any featured product to cart directly from the home tab by clicking its Add button
  • 8Observe the USP strip at the bottom showing Express Delivery, 100% Organic, Quality Guarantee, and 24/7 Support cards
  • 9Use the global header search bar to type a product name and verify the app navigates to Products with results filtered

2. Product Browsing

The Products tab is the main catalogue page with 24 items across four categories. It supports full search, sort, and filter capabilities.

  • 1Click Browse Products in the sidebar to navigate to the products catalogue
  • 2Observe the product count badge in the card header showing the number of products currently visible
  • 3Locate the search box in the toolbar and type a product name such as "mango" — observe the grid filters in real time
  • 4Clear the search to restore all products, then type a name that doesn't exist and verify the empty state message appears
  • 5Locate the Category dropdown in the toolbar and change it to Vegetables — verify only vegetable products are shown
  • 6Try each category option (Fruits, Greens & Herbs, Exotic Produce) and verify the grid updates each time
  • 7Open the Sort dropdown and select Price: Low to High — verify the cheapest item appears first in the grid
  • 8Select Price: High to Low and verify the most expensive item is first
  • 9On any product card, click the heart icon to add it to the wishlist — observe the toast notification
  • 10Click the eye icon on a product card to open the Quick View modal with full product details
  • 11Inside the Quick View modal, verify the product emoji, name, price, unit, rating, stock status, and category are displayed
  • 12Click Add to Cart inside the Quick View modal — verify the modal closes and the cart badge increments
  • 13Click the Add button directly on a product card and verify the toast notification appears
  • 14For products where you have already added to cart, notice the button reads Add More

3. Cart Management

The Cart tab displays all items added to the session cart. Changes to quantities update the order summary instantly.

  • 1Click My Cart in the sidebar; if no items have been added, the empty state illustration and a Start Shopping button appear
  • 2Add one or more products from the Products tab, then return to the Cart tab to see the item rows
  • 3Each cart row shows the product emoji, name, category, unit price, a quantity stepper, line subtotal, and a remove button
  • 4Click the + button on the quantity stepper to increase an item's quantity by one and verify the subtotal updates
  • 5Click the button and verify the quantity cannot go below 1
  • 6Type a number directly into the quantity input field and verify the subtotal recalculates
  • 7Observe the Order Summary panel on the right showing Subtotal, Delivery fee, and Total
  • 8Add items until the subtotal reaches ₹500 or more — verify the delivery fee changes to FREE
  • 9Click the trash icon on an item row to remove it — verify the row disappears and the summary recalculates
  • 10Click Clear Cart in the card header and confirm the dialog — verify all items are removed and the empty state reappears
  • 11Click Proceed to Checkout to navigate to the Checkout tab

4. Checkout Flow

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.

  • 1Click Checkout in the sidebar or the Proceed to Checkout button from the Cart tab
  • 2Observe the Delivery Address form with fields: Full Name, Phone, Address Line, City, State, PIN Code, and Delivery Slot
  • 3If a user is logged in, notice the form fields are pre-populated with the saved address
  • 4Fill in all required fields — Full Name, Phone, Address Line, City, and PIN Code are mandatory
  • 5Select a preferred Delivery Slot from the dropdown (Express, Morning, Afternoon, Evening)
  • 6Observe the four Payment Method options: Cash on Delivery, UPI, Credit/Debit Card, and VegCart Wallet
  • 7Select a payment method and verify the radio option highlights the selected card
  • 8Verify the Order Summary panel shows the correct subtotal, delivery fee, and grand total
  • 9Click Place Order with a form field left empty — verify the validation toast appears and the order is not placed
  • 10Fill the form completely and click Place Order — verify the success modal appears with a confirmation message
  • 11Verify the cart badge in the sidebar resets to 0 after the order is placed
  • 12Observe the app automatically navigates to the Orders tab after a short delay

5. Order Tracking

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.

  • 1Click My Orders in the sidebar to navigate to the order history page
  • 2Observe the order cards; each shows the order ID, date, product chips, total amount, and a colour-coded status badge
  • 3Verify the status badge colours: Processing (yellow), Confirmed (blue), Out for Delivery (light blue), Delivered (green), Cancelled (red)
  • 4Locate the search box in the toolbar, type an order ID such as ORD-10021, and verify only matching orders appear
  • 5Clear the search, then use the status filter dropdown to show only Delivered orders
  • 6Try each filter option and verify the list updates; select All Orders to restore the full list
  • 7Click the Details button on an order card to open the Order Detail modal
  • 8In the Details modal, observe the order tracker steps showing the order's progress through the pipeline
  • 9Verify the item table in the modal lists every product, its quantity, price, and row total
  • 10Close the modal using the × button or by clicking outside it
  • 11Click the Reorder button on a delivered order to add all its items back to the cart
  • 12Find a Processing order and click the Cancel button; confirm the dialog and verify the status changes to Cancelled
  • 13Verify that a Delivered or Cancelled order does not show the Cancel button

6. User Profile & Authentication

The Profile tab handles sign-in, new account creation, and logged-in user profile management.

  • 1Click My Profile in the sidebar; when not signed in, the authentication panel appears with two tabs: Sign In and Create Account
  • 2On the Sign In tab, enter a valid email and password, then click Sign In — verify the success toast and the profile panel renders
  • 3Enter incorrect credentials and verify the error toast "Invalid email or password" appears without logging in
  • 4Submit the Sign In form with an empty email field and observe native browser validation
  • 5Switch to the Create Account tab, fill in Full Name, Phone, Email, and Password, then submit
  • 6Verify the success toast "Account created!" appears and the user is automatically signed in
  • 7Attempt to sign up with an email address that already exists — verify the warning toast "Email already registered"
  • 8When logged in, observe the profile card on the left showing the avatar initials, name, email, order count, and wishlist count
  • 9Locate the edit profile form on the right and change the Full Name or Phone number
  • 10Click Save Changes and verify the success toast and the updated name reflected in the profile card and sidebar
  • 11Click the Logout button in the profile card and verify the auth panel reappears and the sidebar shows "Guest"

7. Wishlist

The Wishlist lets users save products for later. Items persist in localStorage across page refreshes.

  • 1Navigate to the Products tab and click the heart icon on any product card — observe the success toast “Added to wishlist”
  • 2Verify the heart icon on the card turns pink/filled to indicate the item is wishlisted
  • 3Observe the Wishlist badge count in the sidebar increment each time a new item is wishlisted
  • 4Click Wishlist in the sidebar to navigate to the wishlist page
  • 5Verify that all wishlisted product cards are displayed in the grid
  • 6Click the Add button on a wishlist card to add it to the cart and verify the cart badge increments
  • 7Verify that adding a wishlisted product to the cart does not remove it from the wishlist automatically
  • 8Click the heart icon again on a wishlisted product (either in the Products tab or Wishlist tab) to remove it
  • 9Verify the toast “Removed from wishlist” appears and the item disappears from the Wishlist grid
  • 10Remove all wishlisted items and verify the empty state with a Browse Products button appears
  • 11Refresh the page and verify that previously wishlisted items are still present (localStorage persistence)

8. Support & FAQ

The Support tab includes contact channel cards, an accordion FAQ, and a contact form.

  • 1Click Support in the sidebar to navigate to the support page
  • 2Observe the four support channel cards at the top: Call Us, Email Support, WhatsApp, and Live Chat
  • 3Verify each support card shows an icon, title, contact details, and availability hours
  • 4Locate the Frequently Asked Questions card containing six collapsible FAQ items
  • 5Click any FAQ question row to expand it — verify the answer panel becomes visible and the chevron icon rotates
  • 6Click a second FAQ question and verify it opens while the first one automatically closes (accordion behaviour)
  • 7Click the currently open FAQ again and verify it collapses
  • 8Locate the Send Us a Message contact form on the right side
  • 9Fill in the Name, Email, Subject dropdown, and Message fields, then click Send Message
  • 10Verify the success toast “Your message has been sent!” appears and all form fields are cleared
  • 11Attempt to submit the contact form without filling required fields and observe native browser validation

9. AI Agent Tools — WebMCP

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 146+ with chrome://flags/#enable-webmcp-testing flag enabled, OR
  • Model Context Tool Inspector Chrome extension (recommended — works immediately, no flag needed)

Registered 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

  • 1Install the Model Context Tool Inspector extension from the Chrome Web Store
  • 2Open VegCart at http://localhost:4040/testweb/vegcart/ in Chrome
  • 3Click the Model Context Tool Inspector extension icon — it should list all 18 tools registered by VegCart
  • 4Select get_product_list and click Execute — verify a JSON response with 24 products is returned
  • 5Select search_products, set query to carrot, and execute — verify the VegCart UI navigates to Products and shows only matching items
  • 6Select add_item_to_cart, set itemName to Spinach and quantity to 2, and execute — verify the Cart tab opens and Spinach × 2 appears
  • 7Select get_cart_contents and execute — verify it returns cart details including subtotal, delivery, and total amounts
  • 8Select place_order with delivery details and execute — verify order is placed and order ID is returned
  • 9Try add_item_to_cart with a product name that does not exist — verify the tool returns success: false and the cart does not change
Execution Context: The execute() 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.

10. Conversational Shopping Interface

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

  • Ask questions: "What products do you have?"
  • Add to cart: "Add 2 tomatoes to my cart"
  • Search products: "Show me all fruits"
  • Check cart: "What's in my cart?"
  • Place orders: "Place an order to 123 Main St"
  • View orders: "Show my recent orders"
  • Navigate: "Go to the products page"

Intent Recognition Patterns

Intent Category Example Phrases WebMCP Tool Used
Product Search "Search for carrots"
"Find all fruits"
"Show vegetables"
search_products
get_product_list
filter_products_by_category
Cart Management "Add 3 tomatoes to cart"
"What's in my cart?"
"Remove spinach"
"Clear my cart"
add_item_to_cart
get_cart_contents
remove_from_cart
clear_cart
Order Management "Show my orders"
"Place an order"
"Order history"
get_order_history
place_order
User Account "Who am I?"
"My profile"
"Log me out"
get_user_info
user_logout
Navigation "Go to products"
"Show me the cart"
"Navigate to orders"
navigate_to_tab

How to Use — Chat Assistant

  • 1Click Chat Assistant in the sidebar to open the conversational interface
  • 2Type natural language requests like "Add 2 apples to my cart" or "Register me as John with email john@test.com"
  • 3Watch as the AI assistant interprets your request and executes the appropriate actions
  • 4Try complex requests like "Show me all vegetables under ₹50" or "Login with my email and place an order"
  • 5Use suggestion buttons for quick common actions
  • 6Check the tool execution results displayed in the chat for debugging
Smart Features: The chat assistant automatically saves conversation history, provides typing indicators, and falls back to manual tool execution if WebMCP tools are unavailable. Perfect for testing conversational commerce implementations!

Test Scenarios

Happy Path

TC-001: Browse Products by Category

Go to Products → Select Vegetables from the category filter → Verify only vegetable items appear in the grid

TC-002: Search and Add to Cart

Search for "spinach" → Locate the result → Click Add → Navigate to Cart → Verify item appears with correct price

TC-003: Quick View a Product

Click the eye icon on a product card → Verify the Quick View modal opens with all product details → Close the modal

TC-004: Update Cart Quantity

Add an item to cart → Go to Cart → Increase quantity to 3 using the + button → Verify subtotal = price × 3

TC-005: Free Delivery Threshold

Add items until cart subtotal exceeds ₹500 → Verify delivery fee shows FREE in the order summary

TC-006: Complete Checkout

Add items → Checkout → Fill delivery form → Select COD → Place Order → Verify success modal and cart resets to 0

TC-007: User Login

Go to Profile → Enter priya@example.com / test123 → Click Sign In → Verify profile panel shows with correct name

TC-008: Create New Account

Go to Profile → Switch to Create Account tab → Fill all fields → Submit → Verify auto sign-in and profile panel

TC-009: Wishlist Add and View

Heart a product on the Products tab → Go to Wishlist tab → Verify the product card appears in the wishlist grid

TC-010: Reorder a Past Order

Go to Orders → Find a delivered order → Click Reorder → Verify toast and all items appear in the Cart tab

TC-011: View Order Details

Go to Orders → Click Details on any order → Verify tracker steps, item table, delivery address, and order date in the modal

TC-012: FAQ Accordion

Go to Support → Click a FAQ question → Verify answer expands → Click a second question → Verify first closes automatically

TC-013: Contact Form Submission

Fill the contact form → Submit → Verify success toast and form fields are cleared

TC-014: Sort Products by Price

Go to Products → Select Price: Low to High from the sort dropdown → Verify the first card has the lowest price

TC-015: Category Card Navigation from Home

On Home tab → Click the Fruits category card → Verify Products tab opens with Fruits already selected in the filter

Negative / Edge Cases

TC-016: Invalid Login Credentials

Enter correct email but wrong password → Click Sign In → Verify error toast "Invalid email or password"

TC-017: Duplicate Email Signup

Attempt to sign up with priya@example.com → Verify warning toast "Email already registered"

TC-018: Checkout with Empty Cart

Navigate to Checkout with nothing in cart → Click Place Order → Verify toast "Your cart is empty!"

TC-019: Checkout Missing Required Field

Fill checkout form but leave PIN Code blank → Click Place Order → Verify validation toast prevents submission

TC-020: Product Search No Results

Search for "xyz999" in the Products tab → Verify the empty state "No products found" message appears

TC-021: Cancel an Order

Find a Processing order → Click Cancel → Confirm the dialog → Verify status badge changes to Cancelled

TC-022: Cancel Button on Delivered Order

Locate a Delivered order → Verify the Cancel button is absent for that card

TC-023: Remove Item from Cart

Add an item → Go to Cart → Click the trash icon → Verify item removed and summary recalculates

TC-024: Clear Cart Confirmation

Add multiple items → Click Clear Cart → Dismiss the confirm dialog → Verify items remain → Confirm → Verify empty state

TC-025: Wishlist Remove and Empty State

Wishlist one item → Go to Wishlist tab → Remove it → Verify the empty state with Browse Products button appears

TC-026: Cart Badge Count Accuracy

Add 3 different products → Verify sidebar badge = 3 → Increase one quantity by 2 → Verify badge = 5

TC-027: Modal Close Behaviour

Open Quick View modal → Click the × button → Verify closes → Open again → Click the overlay backdrop → Verify closes

TC-028: Data Persistence on Refresh

Add items to cart and wishlist → Refresh the page → Verify cart and wishlist data are restored from localStorage

TC-029: Sidebar Active State

Click each sidebar nav button → Verify the clicked item gets the active highlight and the correct tab becomes visible

TC-030: Profile Update Reflects in Sidebar

Login → Change name in profile form → Save → Verify the updated name appears in the sidebar user panel

AI Agent (WebMCP)

TC-031: Get Product List via AI

Open Model Context Tool Inspector → Execute get_product_list → Verify JSON response contains 24 products with name, price, and category fields

TC-032: AI Search Updates Product Grid

Execute search_products with query "mango" → Verify VegCart navigates to Products tab and grid shows only mango results

TC-033: AI Add Item to Cart

Execute add_item_to_cart with itemName "Carrots" and quantity 3 → Verify Cart tab opens automatically and shows Carrots × 3 with correct subtotal

TC-034: AI Add Non-Existent Product

Execute add_item_to_cart with itemName "PineAppleXYZ" → Verify tool returns success: false and cart remains unchanged

TC-035: Cart Badge Updates After AI Add

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

TC-036: Natural Language Product Search

Go to Chat Assistant → Type "Show me all fruits" → Verify AI responds and navigates to Products with fruit filter applied

TC-037: Conversational Cart Management

Chat: "Add 2 tomatoes to my cart" → Verify success message and cart update → Chat: "What's in my cart?" → Verify cart contents displayed

TC-038: Multi-step Shopping Conversation

Chat: "Find vegetables" → "Add 3 carrots" → "Remove spinach" → "What's my total?" → Verify each step executes correctly with tool results

TC-039: Voice-like Navigation Commands

Chat: "Go to my orders" → Verify navigation → Chat: "Show me the home page" → Verify navigation → Chat: "Take me to products"

TC-040: Unrecognized Intent Handling

Chat: "Book a table for 2" → Verify AI provides helpful fallback message with suggestions for valid actions

TC-041: Chat History Persistence

Send several messages → Refresh the page → Return to Chat tab → Verify conversation history is retained

TC-042: Typing Indicators

Send a message and observe typing indicator appears → Wait for response → Verify typing indicator disappears when response arrives

TC-043: Suggestion Button Usage

Click a suggestion button like "What products do you have?" → Verify text fills input → Send message → Verify appropriate response

TC-044: Conversational User Registration & Login

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