- ✅ Checks: Content is not empty
- ❌ Missing: Actual content verification
Fix: Add assertions like:
// Verify content contains the actual page title
expect(text).to.include('How does VTEX support work')
// Verify content has substantial length (not just header)
expect(text.length).to.be.greaterThan(500)
// Verify it's actually markdown, not HTML
expect(text).to.not.include('<div')
expect(text).to.not.include('<p>')- ❌ Missing: Direct API endpoint testing
Fix: Add API tests:
it('Should return valid content from API endpoint', () => {
cy.request({
url: '/api/llm-content',
qs: { section: 'tutorials', slug: 'how-does-vtex-support-work', locale: 'en' }
}).then((response) => {
expect(response.status).to.equal(200)
expect(response.body.content).to.exist
expect(response.body.content).to.include('# ')
})
})- ❌ Only tests one tutorial page
Fix: Test multiple content types:
const testPages = [
{ section: 'tutorials', slug: 'some-tutorial', type: 'tutorial' },
{ section: 'faq', slug: 'some-faq', type: 'faq' },
{ section: 'announcements', slug: 'some-announcement', type: 'announcement' },
]- ❌ What happens when things fail?
Fix: Add negative tests:
it('Should handle API errors gracefully', () => {
// Intercept API and make it fail
cy.intercept('/api/llm-content*', { statusCode: 500 }).as('apiError')
cy.visit(tutorialUrl)
cy.contains('button', 'Copy for LLM').click()
// Verify user gets appropriate feedback
})
it('Should handle missing content', () => {
cy.visit('/docs/tutorials/nonexistent-page')
// Should show 404 or appropriate message
})- ❌ Just checks for any markdown character
Fix: Validate actual structure:
// Should have frontmatter-like metadata (even if removed in future)
expect(text).to.match(/title:/i)
expect(text).to.match(/locale:/i)
// Should have meaningful headings
const headings = text.match(/^#+\s+.+$/gm)
expect(headings).to.have.length.greaterThan(1)
// Should preserve code blocks
if (text.includes('```')) {
expect(text).to.match(/```[\s\S]+?```/)
}- ✅ Checks: Content differs between languages
- ❌ Missing: Content is actually in the correct language
Fix: Add language detection:
// Simple heuristics for language validation
it('Should have Spanish-specific content', () => {
const spanishIndicators = ['cómo', 'qué', 'cuál', 'más', 'también']
const hasSpanish = spanishIndicators.some(word =>
copiedContents.es.toLowerCase().includes(word)
)
expect(hasSpanish).to.be.true
})- ❌ What if content is 10MB?
Fix: Add sanity checks:
// Content shouldn't be suspiciously large or small
expect(text.length).to.be.within(100, 100000)- Add API endpoint tests
- Test multiple content types (tutorials, FAQ, etc.)
- Validate actual content includes page title/key phrases
- Add error handling tests
- Test special cases (code blocks, images, tables)
- Add language-specific content validation
- Test different viewport sizes
- Performance/load testing
- Accessibility testing
- Cross-browser testing
- Snapshot Testing: Save expected output for key pages and compare
- Contract Testing: Define API response schema and validate
- Integration Tests: Test the full flow from GitHub fetch to clipboard
- Visual Regression: Screenshot tests to catch UI breaking changes