Skip to content
Agentmart
Submit a tool

frontend-testing

Frontend testing guide — unit, integration, visual regression, accessibility, E2E for UI

Skill by amas-nghia

IndexedMIT★ 2
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/amas-nghia-frontend-testing

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Frontend testing guide — unit, integration, visual regression, accessibility, E2E for UI

Use cases: design, frontend, testing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/frontend-testing

What's inside

Skill name
frontend-testing
Description
Frontend testing guide — unit, integration, visual regression, accessibility, E2E for UI
License
MIT
Instructions
113 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • name: "frontend-testing" does not match folder "skill-frontend-testing"

Files (2)

  • SKILL.md
  • package.json

SKILL.md (first lines)

# Frontend Testing Skill

## Thứ tự ưu tiên test

1. **E2E critical paths** — happy path của user journey quan trọng nhất
2. **Integration tests** — component với real API/state
3. **Unit tests** — utilities, hooks, pure functions
4. **Visual regression** — screenshot comparison cho UI quan trọng
5. **Accessibility audit** — automated a11y check

## Unit Test (Vitest / Jest)

### Cái gì nên unit test

- Pure utility functions (date format, validation, transform)
- Custom hooks (dùng `renderHook`)
- Complex business logic trong component
- Error boundary behavior

### Pattern

```ts
// Arrange
const input = { ... }
// Act
const result = fn(input)
// Assert
expect(result).toEqual(expected)
```

- Test behavior, không test implementation
- Mock tối thiểu — chỉ mock external services, không mock internal modules
- Tên test mô tả behavior: `"returns empty array when no results match"`

## Component / Integration Test (Testing Library)

```ts
render(<TaskCard task={mockTask} />)
// Query bằng role/label — không dùng test-id trừ khi cần
expect(screen.getByRole('heading', { name: 'Fix bug' })).toBeVisible()
await userEvent.click(screen.getByRole('button', { name: 'Claim' }))
expect(mockClaim).toHaveBeenCalledWith(taskId)
```

### Query priority (ưu tiên từ cao xuống thấp)

1. `getByRole` — accessible name
2. `getByLabelText` — form fields
3. `getByText` — visible text
4. `getByTestId` — last resort

## E2E Test (Playwright)

### Checklist viết test

- [ ] Test happy path trước
- [ ] Dùng `page.getByRole` thay selectors CSS
- [ ] Waitfor selector/network idle thay `sleep`
- [ ] Screenshot assertion cho visual-critical pages
- [ ] Test trên mobile viewport (375px) nếu có responsive

```ts
test('user can claim a task', async ({ page }) => {
  await page.goto('/board')
  await page.getByRole('button', { name: 'Claim' }).first().click()
  await expect(page.getByText('In Progress')).toBeVisible()
})
```

### Tránh flaky tests

- Không hardcode timeout — dùng `waitForSelector` / `waitForResponse`
- Không test timing animations
- Isolate test data — mỗi test tự tạo data riêng hoặc reset state

## Visual Regression

- Screenshot các breakpoint: 375, 768, 1280, 1920
- Test cả light và dark mode nếu project có
- Chạy sau mỗi UI change đáng kể
- Review diff trước khi approve snapshot update

## Accessibility Testing

```ts
import { axe } from 'jest-axe'
const { container } = render(<Component />)
const results = await axe(container)
expect(results).toHaveNoViolations()
```

- Keyboard navigation: Tab qua tất cả interactive elements
- Screen reader test với VoiceOver (Mac) hoặc NVDA (Windows)
- Focus trap trong modal/dialog

## Coverage targets

| Loại | Minimum |
|---|---|
| Utility functions | 95% |
| Hooks | 85% |
| Components (branch) | 80% |
| Critical user paths (E2E) | 100% |

## Khi test fail

1. Reproduce locally trước khi sửa
2. Đọc error message đầy đủ
3. Kiểm tra xem test sai hay implementation sai
4. Không disable test — fix root cause
5. Nếu flaky: xác định race condition và fix bằng proper wait

From amas-nghia/relayhq, MIT.

More from amas-nghia/relayhq

Signals

Stars
2
Forks
0
Open issues
1
Last commit (this folder)
May 5, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from amas-nghia

Cite this page

frontend-testing skill. Agent Mart. https://agentmart.dev/skills/amas-nghia-frontend-testing (last updated 2026-10-24)