TEST-TESTFEATURES-README.mdā¢6.52 kB
# TestFeatures Discovery Test - README
## š Overview
Dit script test de complete Helix architecture navigation en relationship discovery voor de **TestFeatures** feature module. Het valideert dat de Sitecore MCP server correct alle gerelateerde items kan vinden volgens de Helix principes.
## šÆ Wat Dit Script Test
### Phase 1: Template Discovery
- ā
Search in `/sitecore/templates/Feature/TestFeatures`
- ā
Get template folder met item() query
- ā
Get alle children (templates, folders, subfolders)
### Phase 2: Rendering Discovery
- ā
Search in `/sitecore/layout/Renderings/Feature/TestFeatures`
- ā
Get rendering folder met children
- ā
List alle rendering definitions
### Phase 3: Content Resolver Discovery
- ā
Search in `/sitecore/system/Modules/Layout Service/Rendering Contents Resolvers/Feature/TestFeatures`
- ā
Get resolver folder met children
- ā
List alle content resolvers
### Phase 4: Content Item Discovery
- ā
Search alle content items in `/sitecore/content`
- ā
Find items die TestFeatures templates gebruiken
- ā
List alle instanties
### Phase 5: Global Search
- ā
Search entire Sitecore database voor "TestFeatures"
- ā
Group results by location
- ā
Show distribution across paths
### Phase 6: Helix Relationship Validation
- ā
Template-based content discovery
- ā
Validate Feature ā Content relationships
- ā
Confirm Helix architecture compliance
## š Usage
### Option 1: Direct Script Execution (Requires .env)
```powershell
# Ensure .env file exists with credentials
.\test-testfeatures-discovery.ps1
```
**Required .env contents:**
```env
SITECORE_HOST=https://your-sitecore-instance.com
SITECORE_API_KEY=your-api-key-here
```
### Option 2: Via MCP Server (RECOMMENDED)
**In Claude Desktop:**
```
Find all TestFeatures items in Sitecore using the MCP tools:
1. Search templates in /sitecore/templates/Feature/TestFeatures
2. Search renderings in /sitecore/layout/Renderings/Feature/TestFeatures
3. Search content items using TestFeatures templates
4. Show me the complete Helix relationship map
```
**In VS Code Copilot:**
```
@workspace Use sitecore MCP tools to discover all TestFeatures module items:
- Templates
- Renderings
- Resolvers
- Content items
Show the complete inventory
```
## š Expected Output
### Test Statistics
```
Total Tests: 10
Passed: 10
Failed: 0
```
### Discovered Items by Category
```
Templates: X items
Renderings: Y items
Resolvers: Z items
Content Items: N items
Search Results: M items
```
### Complete Item Inventory
Alle gevonden items met:
- ID
- Name
- Path
- Template
- Language
### Helix Relationship Map
```
Feature Module: TestFeatures
Template Location:
/sitecore/templates/Feature/TestFeatures
Items: X
Rendering Location:
/sitecore/layout/Renderings/Feature/TestFeatures
Items: Y
Resolver Location:
/sitecore/system/.../Feature/TestFeatures
Items: Z
Content Items:
/sitecore/content/**/*
Items: N
```
## š What It Validates
### Helix Architecture Compliance
1. ā
Templates are in Feature layer (`/sitecore/templates/Feature/TestFeatures`)
2. ā
Renderings are in Feature layer (`/sitecore/layout/Renderings/Feature/TestFeatures`)
3. ā
Resolvers are in Feature layer (`/sitecore/system/.../Feature/TestFeatures`)
4. ā
Content items reference Feature templates
### MCP Tool Functionality
1. ā
`search()` query works with ContentSearchResult schema
2. ā
`item()` query works with Item schema
3. ā
`children()` query returns correct results
4. ā
Template-based discovery works
5. ā
Path-based filtering works
6. ā
Language defaults are correct ('en' for system items)
### GraphQL Schema Correctness
1. ā
No `url` errors (uses `uri`)
2. ā
No `language { name }` errors (uses `language` String)
3. ā
No `template { id, name }` errors in ContentSearchResult
4. ā
Correct field access patterns
## š Troubleshooting
### Error: "SITECORE_API_KEY not found"
**Solution:**
1. Create `.env` file in project root
2. Add required credentials:
```env
SITECORE_HOST=https://your-sitecore-instance.com
SITECORE_API_KEY=your-api-key-here
```
### Error: "GraphQL Error: Cannot query field..."
**Solution:**
- Run `npm run build` to ensure latest fixes are compiled
- Check `SCHEMA-FIX-COMPLETE.md` for known schema issues
- Verify you're using correct ContentSearchResult fields
### No Items Found
**Possible Reasons:**
1. TestFeatures module doesn't exist in your Sitecore instance
2. Different path structure (not Feature layer)
3. Different naming convention
4. Language mismatch (try 'nl' or other languages)
**Solution:**
- Check if TestFeatures exists: Browse to `/sitecore/templates` in Sitecore
- Modify script paths to match your structure
- Adjust language parameter if needed
## š Customization
### Test Different Feature
Change feature name on line 18:
```powershell
Write-Host "[INFO] Feature: YourFeatureName" -ForegroundColor Yellow
```
Then update all queries to search for `"YourFeatureName"` instead of `"TestFeatures"`.
### Test Different Layers
Modify paths to test Foundation or Project layers:
```graphql
# Foundation
rootItem: "/sitecore/templates/Foundation/YourModule"
# Project
rootItem: "/sitecore/templates/Project/YourProject"
```
### Add More Tests
Add new test at end of Phase 6:
```powershell
$query11 = @"
{
# Your custom GraphQL query
}
"@
$result11 = Invoke-SitecoreGraphQL -Query $query11 -TestName "Your test description"
```
## š Related Documentation
- **HELIX-RELATIONSHIP-DISCOVERY.md** - Helix navigation patterns
- **SCHEMA-FIX-COMPLETE.md** - GraphQL schema reference
- **SEARCH-SCHEMA-FIX.md** - ContentSearchResult schema
- **.github/copilot-instructions.md** - MCP tool usage patterns
## ā
Success Criteria
Script succeeds if:
1. ā
All 10+ tests pass (no GraphQL errors)
2. ā
At least 1 item found in each category (if TestFeatures exists)
3. ā
Helix relationship map shows correct structure
4. ā
No schema mismatch errors
5. ā
Complete item inventory generated
## š Expected Result
```
[SUCCESS] All tests passed! TestFeatures discovery complete.
Total Unique Items: X
- Templates: Y
- Renderings: Z
- Resolvers: N
- Content Items: M
```
If TestFeatures doesn't exist in your Sitecore instance, you'll see:
```
[SUCCESS] All tests passed! TestFeatures discovery complete.
Total Unique Items: 0
```
This is normal - create the TestFeatures module in Sitecore first, or modify the script to test an existing feature.