Manual testing is slow, error-prone, and doesn't scale. Here's how we set up Playwright at iDev.
Why Playwright Over Cypress/Selenium
- Tri-engine support: Chromium, Firefox, WebKit in one framework
- Auto-waiting: No manual sleep/wait calls needed
- Multi-page testing: Tabs, popups, iframes all supported
- Codegen recorder: Record interactions, auto-generate test code
- Speed: 3-5x faster than Selenium
What We Test
For our admin dashboard, core test cases include:
- Login flow: Correct credentials -> verify Dashboard redirect
- Create article: Fill title + content -> save -> verify in list
- Edit article: Modify title -> save -> verify change
- Delete article: Confirm delete -> verify removal from list
- Pagination: Navigate pages -> verify data changes
CI Integration
Playwright runs in GitHub Actions on every PR:
- Tests must pass before merge is allowed
- Failed tests auto-capture screenshots of the failure state
- Test reports uploaded as artifacts
Best Practices We Follow
- Independent test data: Clean up before each test to avoid cross-test interference
-
Selector strategy: Always use
data-testidattributes, never CSS classes or XPath - Parallel execution: Multiple workers run tests simultaneously. 30 tests finish in 2 minutes
- Visual regression: Playwright's screenshot comparison catches unintended UI changes
- Retry on flake: Configure 1 retry for known flaky tests, but fix the root cause ASAP
Getting Started
The fastest path: install Playwright, run npx playwright codegen to record a test, then refine the generated code. You'll have your first E2E test running in under 10 minutes.
Small team, big output. iDev builds web apps, AI solutions and custom systems with startup speed and enterprise quality. Based in Malaysia, serving Southeast Asia. Free consultation.
Top comments (0)