mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
494cb11c1f
Added complete Playwright-based E2E testing infrastructure with 36 tests covering functional, responsive, accessibility, and performance testing. **Test Infrastructure:** - Playwright config with 7 browser/device configurations - Page Object Model for maintainable test code - npm scripts for various test execution modes **Test Suites (36 tests total):** - homepage.spec.ts: 14 functional tests (navigation, hero, stats, CTAs) - responsive.spec.ts: 5 responsive design tests (mobile, tablet, desktop) - accessibility.spec.ts: 10 WCAG 2.1 AA compliance tests - performance.spec.ts: 7 performance and Web Vitals tests **Documentation:** - E2E-TEST-PLAN.md: Comprehensive 15-section test strategy (700+ lines) - README.md: Complete usage guide (300+ lines) - QUICKSTART.md: 5-minute setup guide - DELIVERABLES.md: Detailed deliverables summary **Key Features:** - Based on real content crawled from live site - TypeScript for type safety - axe-core integration for accessibility testing - Screenshot and video capture on failure - CI/CD ready with GitHub Actions example - Cross-browser: Chrome, Firefox, Safari, Edge, Mobile - Responsive: Mobile (iPhone 12), Tablet (iPad), Desktop **Test Coverage:** ✅ All 7 navigation items ✅ Hero section with community stats (100K+ members) ✅ 4 explore cards (About, Impact, Community, Projects) ✅ 7 Paths of Impact ✅ "What is Agentic AI" section ✅ Community stats (130K+ Reddit, 52K+ LinkedIn, 3K+ Discord) ✅ SEO metadata and Open Graph tags ✅ HTTPS enforcement ✅ Footer and copyright 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
142 lines
4.4 KiB
TypeScript
142 lines
4.4 KiB
TypeScript
import { chromium } from '@playwright/test';
|
|
|
|
async function crawlSite() {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const page = await browser.newPage();
|
|
|
|
console.log('Navigating to https://agentics.org/...');
|
|
await page.goto('https://agentics.org/', { waitUntil: 'networkidle' });
|
|
|
|
// Get page title
|
|
const title = await page.title();
|
|
console.log('\n=== PAGE TITLE ===');
|
|
console.log(title);
|
|
|
|
// Get all text content
|
|
const bodyText = await page.evaluate(() => document.body.innerText);
|
|
console.log('\n=== PAGE TEXT CONTENT ===');
|
|
console.log(bodyText);
|
|
|
|
// Get all links
|
|
const links = await page.evaluate(() => {
|
|
const anchors = Array.from(document.querySelectorAll('a'));
|
|
return anchors.map(a => ({
|
|
text: a.innerText.trim(),
|
|
href: a.href,
|
|
target: a.target
|
|
})).filter(l => l.text || l.href);
|
|
});
|
|
console.log('\n=== LINKS ===');
|
|
console.log(JSON.stringify(links, null, 2));
|
|
|
|
// Get all buttons
|
|
const buttons = await page.evaluate(() => {
|
|
const btns = Array.from(document.querySelectorAll('button, input[type="button"], input[type="submit"]'));
|
|
return btns.map(b => ({
|
|
text: b.textContent?.trim(),
|
|
type: b.getAttribute('type'),
|
|
class: b.className
|
|
}));
|
|
});
|
|
console.log('\n=== BUTTONS ===');
|
|
console.log(JSON.stringify(buttons, null, 2));
|
|
|
|
// Get all forms
|
|
const forms = await page.evaluate(() => {
|
|
const formElements = Array.from(document.querySelectorAll('form'));
|
|
return formElements.map(f => ({
|
|
action: f.action,
|
|
method: f.method,
|
|
inputs: Array.from(f.querySelectorAll('input')).map(i => ({
|
|
name: i.name,
|
|
type: i.type,
|
|
placeholder: i.placeholder
|
|
}))
|
|
}));
|
|
});
|
|
console.log('\n=== FORMS ===');
|
|
console.log(JSON.stringify(forms, null, 2));
|
|
|
|
// Get navigation structure
|
|
const navigation = await page.evaluate(() => {
|
|
const navs = Array.from(document.querySelectorAll('nav, header nav, [role="navigation"]'));
|
|
return navs.map(nav => ({
|
|
html: nav.innerHTML.substring(0, 500)
|
|
}));
|
|
});
|
|
console.log('\n=== NAVIGATION ===');
|
|
console.log(JSON.stringify(navigation, null, 2));
|
|
|
|
// Get all headings
|
|
const headings = await page.evaluate(() => {
|
|
const headingElements = Array.from(document.querySelectorAll('h1, h2, h3, h4, h5, h6'));
|
|
return headingElements.map(h => ({
|
|
level: h.tagName,
|
|
text: h.textContent?.trim()
|
|
}));
|
|
});
|
|
console.log('\n=== HEADINGS ===');
|
|
console.log(JSON.stringify(headings, null, 2));
|
|
|
|
// Get meta tags
|
|
const metaTags = await page.evaluate(() => {
|
|
const metas = Array.from(document.querySelectorAll('meta'));
|
|
return metas.map(m => ({
|
|
name: m.getAttribute('name'),
|
|
property: m.getAttribute('property'),
|
|
content: m.getAttribute('content')
|
|
})).filter(m => m.name || m.property);
|
|
});
|
|
console.log('\n=== META TAGS ===');
|
|
console.log(JSON.stringify(metaTags, null, 2));
|
|
|
|
// Get images
|
|
const images = await page.evaluate(() => {
|
|
const imgs = Array.from(document.querySelectorAll('img'));
|
|
return imgs.map(img => ({
|
|
src: img.src,
|
|
alt: img.alt,
|
|
width: img.width,
|
|
height: img.height
|
|
}));
|
|
});
|
|
console.log('\n=== IMAGES ===');
|
|
console.log(JSON.stringify(images, null, 2));
|
|
|
|
// Get sections/main content areas
|
|
const sections = await page.evaluate(() => {
|
|
const sectionElements = Array.from(document.querySelectorAll('section, main, article, [class*="section"]'));
|
|
return sectionElements.map((s, i) => ({
|
|
index: i,
|
|
tagName: s.tagName,
|
|
className: s.className,
|
|
id: s.id,
|
|
textPreview: s.textContent?.trim().substring(0, 200)
|
|
}));
|
|
});
|
|
console.log('\n=== SECTIONS ===');
|
|
console.log(JSON.stringify(sections, null, 2));
|
|
|
|
// Get page structure
|
|
const structure = await page.evaluate(() => {
|
|
return {
|
|
hasHeader: !!document.querySelector('header'),
|
|
hasFooter: !!document.querySelector('footer'),
|
|
hasNav: !!document.querySelector('nav'),
|
|
hasMain: !!document.querySelector('main'),
|
|
hasSidebar: !!document.querySelector('aside, [class*="sidebar"]')
|
|
};
|
|
});
|
|
console.log('\n=== PAGE STRUCTURE ===');
|
|
console.log(JSON.stringify(structure, null, 2));
|
|
|
|
// Take screenshot
|
|
await page.screenshot({ path: 'screenshot.png', fullPage: true });
|
|
console.log('\n=== SCREENSHOT SAVED ===');
|
|
console.log('screenshot.png');
|
|
|
|
await browser.close();
|
|
}
|
|
|
|
crawlSite().catch(console.error);
|