| name | browser-devtools |
| description | Use when verifying frontend behavior at runtime โ DOM validation, network inspection, performance profiling with browser DevTools |
| metadata | {"category":"testing","agent_type":"general-purpose"} |
Browser DevTools Testing
When to Use
- E2E ํ
์คํธ ์คํจ์ ๊ทผ๋ณธ ์์ธ์ ์ฐพ์ ๋
- API ํธ์ถ์ด ์์๋๋ก ์ด๋ฃจ์ด์ง๋์ง ๊ฒ์ฆํ ๋
- Core Web Vitals์ ์ฑ๋ฅ ์งํ๋ฅผ ์ธก์ ํ ๋
- ์ ๊ทผ์ฑ ๋ฌธ์ ๋ฅผ ๋ฐํ์์์ ํ์ธํ ๋
- Playwright ํ
์คํธ ์์ฑ ์ ๋์์ ์๋์ผ๋ก ํ์ํ ๋
Prerequisites
- ๋ธ๋ผ์ฐ์ ์์ ์ ๊ทผ ๊ฐ๋ฅํ ์คํ ์ค์ธ ์ฑ (๋ก์ปฌ ๋๋ ์คํ
์ด์ง)
- Chrome ๋๋ Edge DevTools ์ ๊ทผ ๊ถํ
- ํ
์คํธํ๋ ค๋ ๊ธฐ๋ฅ ๋๋ ๋ฒ๊ทธ ์ฌํ ๋ฐฉ๋ฒ ํ์
Workflow
1. DOM ์ํ ๊ฒ์ฆ
document.querySelector('[data-testid="submit-button"]') !== null
const btn = document.querySelector('button[type="submit"]');
console.log({
disabled: btn.disabled,
'aria-label': btn.getAttribute('aria-label'),
visible: btn.offsetParent !== null
});
new FormData(document.querySelector('form')).entries().next()
2. ๋คํธ์ํฌ ํญ์ผ๋ก API ๊ฒ์ฆ
ํ์ธ ํญ๋ชฉ:
- ์์ฒญ URL๊ณผ ๋ฉ์๋ (GET/POST/PUT)
- ์์ฒญ ํค๋ (Authorization, Content-Type)
- ์์ฒญ ๋ฐ๋ (์ ํํ payload ํ์)
- ์๋ต ์ํ ์ฝ๋์ ๋ฐ๋
- CORS ํค๋ ์กด์ฌ ์ฌ๋ถ
const originalFetch = window.fetch;
window.fetch = function(...args) {
console.log('fetch:', args[0], args[1]);
return originalFetch.apply(this, args);
};
3. Performance ํญ โ Core Web Vitals ์ธก์
new PerformanceObserver((list) => {
let cls = 0;
list.getEntries().forEach(entry => { if (!entry.hadRecentInput) cls += entry.value; });
console.log('CLS:', cls);
}).observe({ entryTypes: ['layout-shift'] });
new PerformanceObserver((list) => {
const entries = list.getEntries();
const lcp = entries[entries.length - 1];
console.log('LCP:', lcp.startTime, 'ms');
}).observe({ entryTypes: ['largest-contentful-paint'] });
new PerformanceObserver((list) => {
list.getEntries().forEach(entry => {
console.log('Long task:', entry.duration, 'ms');
});
}).observe({ entryTypes: ['longtask'] });
๋ชฉํ์น:
- LCP โค 2.5s
- INP โค 200ms
- CLS โค 0.1
3-A. ์ฌํ ๊ฐ๋ฅํ ์ฑ๋ฅ ๊ฒ์ดํธ๋ก ๊ตณํ๊ธฐ
๋ธ๋ผ์ฐ์ DevTools์์ ๋ณ๋ชฉ์ ์ฐพ์์ผ๋ฉด, ๊ฐ์ ๋ฌธ์ ๋ฅผ CI์์๋ ๋ค์ ์ก์ ์ ์๊ฒ
๋ฐ๋ณต ๊ฐ๋ฅํ ์ธก์ ์ผ๋ก ๊ตณํ๋ค.
npx lighthouse https://example.com --output=json --output-path=./lighthouse-report.json
ํ์ธ ํญ๋ชฉ:
- Lighthouse ๊ฒฐ๊ณผ๋ฅผ ๊ธฐ์ค์ ๊ณผ ๋น๊ตํด ์๊ณ๊ฐ ์ดํ๋ก ๋จ์ด์ง๋ฉด ๋น๋๋ฅผ ์คํจ์ํค๋์ง
- ๋ฒ๋ค ๋ถ์ ๋๊ตฌ๋ก ์ด๊ธฐ ๋ก๋์ ์ํฅ์ ์ฃผ๋ ํฐ ์์ฐ๊ณผ ์ค๋ณต ์์กด์ฑ์ ์ฐพ๋์ง
- ์ฑ๋ฅ ์์ฐ์ด ๋ช
์๋ผ ์๋์ง (์: ํต์ฌ ๊ฒฝ๋ก LCP/INP/CLS, ์ด๊ธฐ JS ๋ฐ์ดํธ ์, ์ด๋ฏธ์ง ์ด๋)
์์น:
- ํน์ ๋น๋ ๋๊ตฌ์ ๊ณผ์ ํฉํ์ง ๋ง๊ณ , ํ์ฌ ์คํ์ ๋ค์ดํฐ๋ธ ๋ฒ๋ค ๋ถ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ๋ค
- "์ ์๊ฐ ๋๋น ๋ณด์ธ๋ค"๊ฐ ์๋๋ผ ์ด๋ค ์์ฐ์ ๋์ผ๋ฉด ์คํจ์ธ์ง ๋ฏธ๋ฆฌ ํฉ์ํ๋ค
- ๋ฐํ์ DevTools ์กฐ์ฌ์ CI ์ธก์ ์ ๊ฐ์ ์ฌ์ฉ์ ํ๋ก์ฐ๋ก ๋ง์ถ๋ค
4. Accessibility ํญ
axe.run().then(results => {
results.violations.forEach(v => {
console.error(v.id, v.description, v.nodes.map(n => n.html));
});
});
5. Playwright ํ
์คํธ๋ก ์ ํ
DevTools์์ ๊ฒ์ฆํ ์ ํ์๋ฅผ Playwright ํ
์คํธ๋ก ๋ณํ:
test('submit button is accessible', async ({ page }) => {
await page.goto('/form');
const btn = page.getByRole('button', { name: 'Submit' });
await expect(btn).toBeVisible();
await expect(btn).toBeEnabled();
await expect(btn).toHaveAttribute('type', 'submit');
});
With Chrome DevTools MCP (Automated)
If Chrome DevTools MCP is configured, Copilot can inspect the live browser runtime
directly. This mode is especially useful for:
- inspecting DOM state
- checking network requests and responses
- collecting console errors
- investigating rendering and performance bottlenecks
Example prompts:
Use Chrome DevTools MCP to inspect the network requests for /api/users
and report any 4xx or 5xx responses.
Use Chrome DevTools MCP to inspect the checkout form DOM state,
verify the submit button accessibility attributes, and summarize any issues.
When available, use automation as an accelerator for reproducing issues and gathering
evidence quickly โ not as a replacement for understanding the manual DevTools workflow.
Additional tips:
- Pair performance investigations with the
Performance panel and
references/performance-checklist.md
- Pair accessibility checks with DevTools accessibility data and
references/accessibility-checklist.md
- If you are unsure about the latest DevTools workflow, fetch the current docs with Context7
How do I use Chrome DevTools to profile React rendering bottlenecks? use context7
Common Rationalizations
| Rationalization | Reality |
|---|
| "์ ๋ ํ
์คํธ๊ฐ ํต๊ณผํ์ผ๋ ๋ธ๋ผ์ฐ์ ์์๋ ๋๋ค" | ๋ ๋๋ง, ๋ ์ด์์, ๋คํธ์ํฌ ํ์ด๋ฐ์ ์ ๋ ํ
์คํธ๋ก ์ก์ ์ ์๋ค. |
| "๋ก์ปฌ์์ ์ ๋๋ฉด ๋๋ค" | ์ฑ๋ฅ ๋ฌธ์ ๋ ์ค์ ๋คํธ์ํฌ ์กฐ๊ฑด์์ ๋ํ๋๋ค. DevTools์ throttling์ ์ฌ์ฉํ๋ค. |
| "์คํฌ๋ฆฐ์ท์ผ๋ก ์ถฉ๋ถํ๋ค" | ์คํฌ๋ฆฐ์ท์ DOM ์ํ, ์ ๊ทผ์ฑ, ์ฑ๋ฅ์ ๋ณด์ฌ์ฃผ์ง ์๋๋ค. |
Red Flags
- ๋คํธ์ํฌ ํญ์ ์ด์ง ์๊ณ API ํตํฉ ๋ฒ๊ทธ๋ฅผ ์์ ํ๋ ค ํจ
- Core Web Vitals๋ฅผ ์ธก์ ํ์ง ์๊ณ "๋น ๋ฅด๋ค"๊ณ ์ฃผ์ฅ
- ์ ๊ทผ์ฑ ์ค๋ฅ๋ฅผ ๋ธ๋ผ์ฐ์ ์์ ํ์ธ ์ ํจ
Verification
Tips
e2e-testing ์คํฌ ์ด์ ๋จ๊ณ๋ก ์ฌ์ฉ: DevTools๋ก ๋จผ์ ํ์ํ ํ Playwright๋ก ์๋ํํ๋ค
references/performance-checklist.md์ references/accessibility-checklist.md๋ฅผ ํจ๊ป ์ฐธ์กฐํ๋ค
- Chrome DevTools์ Recorder ๊ธฐ๋ฅ์ผ๋ก ์ธํฐ๋์
์ ๊ธฐ๋กํ๋ฉด Playwright ์ฝ๋ ์์ฑ์ด ์ฌ์์ง๋ค