Discovery Session Best Practices
Discovery sessions are the foundation for automated flow generation. Well-planned sessions capture high-quality visual contexts that translate into reliable test flows.
Planning Your Discovery Strategy
Defining Discovery Scope
Balance exploration breadth against credit consumption and result quality:
| Scope | Best For | Credit Impact |
|---|---|---|
| Targeted | Specific feature areas | Low (20-50 steps) |
| Moderate | Product section or user journey | Medium (50-100 steps) |
| Broad | Full application mapping | High (100+ steps) |
When to use targeted discovery:
- Testing a new feature in isolation
- Re-exploring after UI changes
- Building flows for specific user journeys
When to use broad discovery:
- Initial application onboarding
- Quarterly coverage audits
- Major redesign verification
Start with targeted discoveries for immediate needs. Run broad discoveries periodically to maintain comprehensive coverage.
Pre-Discovery Preparation
Prepare before starting to maximize session value:
1. Set up browser profiles
For authenticated areas, create a browser profile with active sessions:
- Log in manually using the profile
- Save cookies and session state
- Select this profile when starting discovery
See Browser Profiles for setup instructions.
2. Identify key user journeys
List the flows you want to generate:
- Core authentication paths
- Primary conversion funnels
- Frequently used features
3. Plan exclusion patterns
Identify URLs to skip:
- Admin panels and internal tools
- Third-party embedded content
- Logout and session-ending pages
- Marketing or promotional popups
4. Write custom instructions
Guide the AI agent's exploration focus:
Good: "Focus on the checkout flow and payment options.
Skip promotional banners and newsletter popups."
Avoid: "Explore everything" (too vague)
Optimizing Visual Context Capture
Understanding Context Types
Discovery captures three types of visual contexts:
| Type | Description | Flow Generation Value |
|---|---|---|
| Page | Full page views | Primary test flow sources |
| Component | Reusable UI elements | Shared validation patterns |
| State | Application states (error, success, loading) | Edge case and assertion sources |
Maximize capture diversity:
- Run discoveries at different times (morning vs. evening traffic)
- Use different user accounts (new vs. returning user)
- Trigger various application states (empty cart, full cart, errors)
Maximizing Context Quality
Capture dynamic content:
- Allow time for lazy-loaded elements
- Interact with expandable sections
- Trigger form validation messages
Capture error states:
- Submit invalid data intentionally
- Access restricted pages
- Test with expired sessions
Handle forms thoughtfully:
- Include form interactions in custom instructions
- Capture both empty and filled states
- Trigger and capture validation errors
Visual contexts are deduplicated by (URL pattern, context type). Running multiple discoveries of the same pages won't create duplicates—it updates existing contexts with fresher data.
Discovery Session Configuration
URL Filtering Best Practices
Use exclusion patterns to focus exploration and save credits:
Common exclusion patterns:
# Administrative areas
https://example.com/admin/**
https://example.com/internal/**
# Authentication endpoints that end sessions
https://example.com/logout
https://example.com/signout
# External services
https://docs.example.com/**
https://help.example.com/**
# Marketing and promotional content
https://example.com/promo/**
https://example.com/campaign/**
Pattern syntax:
**matches any path segments*matches within a single segment- Exact URLs match exactly
Project-level vs. session-level exclusions:
- Project-level: Persistent exclusions for areas you never want to explore
- Session-level: Temporary exclusions for specific discovery goals
Custom Instructions
Write concise, outcome-focused instructions:
Effective examples:
"Prioritize the account settings and profile editing flows.
Capture error states when saving invalid data."
"Focus on the product catalog and filtering options.
Skip the blog and support sections."
"Explore the checkout process thoroughly.
Include guest checkout and registered user paths."
Instruction tips:
- Keep under 200 characters for clarity
- Specify what to include AND what to skip
- Mention specific features or pages by name
- Request specific states to capture (errors, empty states)
Browser Profile Selection
Match profiles to discovery goals:
| Goal | Profile Choice |
|---|---|
| Public pages | Default (temporary) |
| Authenticated user flows | User account profile |
| Admin functionality | Admin account profile |
| Different user roles | Create profile per role |
Using the wrong profile wastes credits. If discovery can't access authenticated areas, it explores only public pages and misses valuable contexts.
Monitoring and Managing Sessions
Real-Time Monitoring
Watch these metrics during discovery:
| Metric | What It Tells You | Action If Concerning |
|---|---|---|
| Steps | Credit consumption rate | Stop if progressing too slowly |
| Visual Contexts | Valuable captures | Good if growing steadily |
| Agent Focus | Current exploration area | Verify it matches your goals |
| Last Action Result | Success/failure status | Stop if repeatedly failing |
Signs to stop early:
- Agent stuck in a loop (visiting same pages repeatedly)
- Authentication expired (redirecting to login)
- High step count with few visual contexts
- Agent exploring excluded or irrelevant areas
Interpreting Session Results
After discovery completes, evaluate results:
Good session indicators:
- Visual contexts cover target areas
- Mix of page, component, and state types
- Agent reasoning shows logical exploration
- Reasonable step-to-context ratio
Poor session indicators:
- Few visual contexts despite many steps
- Contexts only from login or error pages
- Agent stuck on single page or section
- Missing expected application areas
Static vs. Dynamic Analysis
Static Analysis Capabilities
Discovery begins with static analysis:
- robots.txt parsing: Respects crawl directives
- XML sitemap discovery: Uses sitemap URLs for initial exploration
- Template detection: Identifies repeated components (headers, footers, nav)
Leverage static analysis:
- Ensure your sitemap is current and complete
- Use robots.txt to guide (not block) the agent
- Template detection reduces redundant captures
Dynamic AI-Powered Crawling
After static analysis, AI explores dynamically:
How the agent explores:
- Analyzes visible elements and interactions
- Clicks links, buttons, and interactive elements
- Fills forms with reasonable test data
- Captures visual contexts at significant states
- Follows navigation patterns like a real user
Single Page Application (SPA) considerations:
- Agent handles client-side routing
- May need longer timeouts for initial load
- Custom instructions can guide through app sections
JavaScript-heavy applications:
- Agent waits for dynamic content to load
- Complex interactions may need custom instructions
- Consider targeted discoveries for complex features
Post-Discovery Workflow
Visual Context Review
Before generating flows, review captured contexts:
Quality checklist:
- Contexts cover intended application areas
- Mix of page types (not just homepage)
- Includes interactive states (forms filled, menus open)
- Error states captured for edge case flows
- No irrelevant or duplicate contexts
Organizing contexts:
- Note which contexts map to planned flows
- Identify gaps requiring additional discovery
- Mark high-priority contexts for immediate flow generation
Flow Generation Strategy
When to generate flows immediately:
- Contexts cover a complete user journey
- Testing deadline requires quick turnaround
- Baseline coverage needed urgently
When to delay flow generation:
- Missing key application areas
- Planning additional discovery sessions
- Need team review of contexts first
Generation approach:
- Generate flows from ALL contexts in the project
- Review and refine generated flows (1 credit per refinement)
- Prioritize flows for critical user journeys
Common Discovery Pitfalls
Pitfall 1: Scope Too Broad
Problem: Discovery explores entire site, consuming hundreds of credits with unfocused results.
Solution: Use targeted scope with URL exclusions. Run multiple focused discoveries instead of one massive session.
Pitfall 2: Missing Authentication
Problem: Discovery captures only public pages; authenticated areas produce no contexts.
Solution: Create and select a browser profile with active login session before starting discovery.
Pitfall 3: No URL Exclusions
Problem: Agent wastes steps on admin panels, logout pages, or external links.
Solution: Define exclusion patterns for irrelevant areas. Add project-level exclusions for persistent rules.
Pitfall 4: Single Role Discovery
Problem: Discovery with one user role misses features available to other roles.
Solution: Run separate discoveries with different browser profiles for each user role (customer, admin, guest).
Pitfall 5: Ignoring Session Metrics
Problem: Session runs to completion despite poor progress, wasting credits.
Solution: Monitor metrics in real-time. Stop early if step-to-context ratio is poor or agent is stuck.
Discovery Session Metrics
Use these benchmarks to evaluate session quality:
| Metric | Good | Concerning | Action |
|---|---|---|---|
| Visual Contexts / Steps | > 0.3 | < 0.1 | Refine scope, check auth |
| Steps to first context | < 10 | > 25 | Check start URL, exclusions |
| Context type diversity | All 3 types | Only 1 type | Adjust custom instructions |
| Coverage of target areas | > 80% | < 50% | Run additional targeted discovery |
Next Steps
- Discovery Sessions User Guide - Full feature reference
- Flow Design Best Practices - Design effective test flows
- Credit Optimization - Minimize discovery costs
- Browser Profiles - Set up authenticated discovery