# Preparing for Agentic Commerce: Testing, Validation, and Reference Guide source: https://developer.mastercard.com/merchant-cloud/documentation/tutorials-and-guides/agentic-commerce-guide/24/index.md ## Testing, Validation, and Reference Guide for Agentic Commerce {#testing-validation-and-reference-guide-for-agentic-commerce} This section provides structured testing procedures and reference documentation for implementing agentic commerce solutions. You will find validation checklists for structured data, agent authentication, and payment processing, along with links to emerging standards and APIs. Use this resource to verify your implementation works reliably across different agent platforms and to stay current with evolving specifications. ## Testing and Validation {#testing-and-validation} Thorough testing ensures your agentic commerce implementation works reliably across different agent platforms, browsers, and transaction scenarios. This section provides structured approaches to validate each component of your integration. ### Testing with Different Agents {#testing-with-different-agents} Validate your implementation against multiple agent platforms to ensure broad compatibility. Each platform interprets pages differently, so test across the ecosystem. #### Agent Platform Test Matrix {#agent-platform-test-matrix} Test your site against these categories of agents: | Agent Category | Examples | Testing Focus | |-------------------------------|--------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------| | **AI Agent Platforms** | ChatGPT, Claude, Gemini | Conversational commerce, product recommendations, checkout completion | | **Computer Use Models** | ChatGPT Agent Mode (CUA), Anthropic Computer Use | Form filling, navigation, multi-step checkout flows (note: OpenAI Operator was sunsetted mid-2025 and folded into ChatGPT agent mode) | | **Headless Browsers** | Puppeteer, Playwright | DOM parsing, JavaScript rendering, form submission | | **Agentic Browsers** | Atlas, Comet | Visual rendering, autonomous navigation, DOM parsing | | **Accessibility-Tree Agents** | Vercel agent-browser, Playwright MCP | ARIA labels, semantic HTML structure, accessibility tree completeness, stable element targeting | #### Testing Procedure {#testing-procedure} For each agent platform, test the following scenarios based on your implementation level: #### Level 1: Basic Agentic Enablement {#level-1-basic-agentic-enablement} | Test Area | Validation Steps | |--------------------------|--------------------------------------------------------------------------------------------------------| | **Product discovery** | Verify agents find and accurately describe products, pricing, and availability | | **Cart operations** | Add items, modify quantities, remove items | | **Checkout completion** | Complete full transaction including shipping selection and payment | | **Error handling** | Trigger errors (invalid payment, out-of-stock) and verify graceful recovery | | **Policy comprehension** | Confirm agents can access and interpret return policies and terms | | **Basic accessibility** | Verify interactive elements have accessible names (aria-label) and semantic HTML5 elements are present | #### Level 2: Optimized Agentic Experience {#level-2-optimized-agentic-experience} | Test Area | Validation Steps | |-------------------------------------|---------------------------------------------------------------------------------------------------------------| | **Agent identification** | Verify Web Bot Auth signatures are validated, and agents receive appropriate access | | **Consumer recognition** | Test ID token extraction, validation, and linking to customer accounts | | **Loyalty integration** | Confirm loyalty benefits, personalized pricing, and rewards apply to agent transactions | | **Payment credential verification** | Validate payment container signatures, nonce binding, and credential hash matching | | **Structured data consistency** | Compare JSON-LD markup against visible page content for accuracy | | **Agent-optimized checkout** | Test dedicated checkout flow with reduced friction and clear form structure | | **Advanced ARIA** | Verify advanced ARIA attributes (aria-expanded, aria-live, aria-selected) communicate dynamic state to agents | | **Post-purchase flows** | Test order tracking, returns initiation, and dispute data capture via agent requests | #### Level 3: Advanced Programmatic Checkout {#level-3-advanced-programmatic-checkout} | Test Area | Validation Steps | |----------------------------------------|--------------------------------------------------------------------------------------------------------------------| | **API endpoint availability** | Verify dedicated agentic commerce API responds correctly to authenticated agent requests | | **Intent registration and validation** | Test intent creation, constraint enforcement, and rejection of out-of-scope purchase requests | | **Cryptographic credential exchange** | Validate payment credential receipt, signature verification, and processing through payment gateway | | **Protocol compliance** | Test UCP/ACP endpoint responses against protocol specifications; verify correct error codes | | **Agent Card discovery** | Verify `/.well-known/agent-card.json` is accessible, correctly populated, and returns proper capabilities | | **Verifiable Intent chain** | Validate SD-JWT credential chain (L1→L2→L3) if participating in Mastercard Agent Pay | | **Rate limiting and abuse prevention** | Confirm API rate limits are enforced and appropriate error responses returned for exceeded limits | | **Error responses** | Verify API returns proper error codes and human-readable messages for invalid, malformed, or unauthorized requests | ### Testing with Agentic Browsers {#testing-with-agentic-browsers} Agentic browsers like Atlas and Comet navigate your site autonomously using visual interpretation, DOM parsing, and accessibility tree querying. Test all three rendering modes to ensure compatibility. #### Visual Rendering Tests {#visual-rendering-tests} Verify your pages render correctly for screenshot-based agents: 1. **Critical content visibility**: Ensure product names, prices, and add-to-cart buttons appear above the fold 2. **No overlapping elements**: Confirm modals, pop-ups, or chat widgets do not obscure purchase actions 3. **Responsive design**: Test various viewport sizes to ensure mobile and desktop layouts are agent-friendly #### DOM Parsing Tests {#dom-parsing-tests} Validate your HTML structure for agents that parse the DOM directly. Example validation commands: ```bash # Fetch page without JavaScript execution and display critical elements curl -s https://www.example.com/products/widget-pro | grep -E "(price|availability|add-to-cart)" # Verify autocomplete attributes exist in raw HTML curl -s https://www.example.com/checkout | grep -o ' { const browser = await chromium.launch(); const page = await browser.newPage(); await page.goto('https://www.example.com/checkout'); // Modern approach (Playwright v1.59+) --- AI-optimized accessibility snapshot const snapshot = await page.ariaSnapshot({ mode: 'ai' }); console.log(JSON.stringify(snapshot, null, 2)); // Legacy approach (deprecated) --- avoid in new code // const snapshot = await page.accessibility.snapshot(); await browser.close(); })(); ``` Review the snapshot output and verify: | Check | What to Look For | |---------------------------|------------------------------------------------------------------------------------------| | **Named elements** | Every button, input, link, and select has a non-empty `name` property | | **Correct roles** | Elements have appropriate roles (`button`, `textbox`, `combobox`, `link`) | | **No anonymous controls** | No interactive elements appear with `role` but without `name` | | **Minimal noise** | Decorative images, spacers, and layout elements are absent from the tree | | **State properties** | Required fields show `required: true`; expanded/collapsed sections show `expanded` state | | Page Type | Required Without JavaScript | |--------------------|----------------------------------------------------------------------------------------------| | **Product pages** | Name, price, description, images, availability status, variant selection, add-to-cart button | | **Category pages** | Product listings, pagination, filters \& search | | **Cart** | Item list, quantities, totals, checkout link | | **Checkout** | All form fields, shipping, order summary, submit button, policy links | ### Verification Checklists {#verification-checklists} Use these checklists to validate the core components of your agentic commerce implementation. #### Structured Data {#structured-data} | Requirement | Status | |------------------------------------------------------------------------------------------------|--------| | JSON-LD present on all product and policy pages | ☐ | | Markup values match visible page content (price, name, availability) | ☐ | | No validation errors in Schema.org validator or Google Rich Results Test | ☐ | | Semantic HTML5 elements used (`
`, `