Responsive Testing
1. Activate This Skill
- Use this skill when the task involves responsive UI testing, breakpoint validation, viewport coverage, mobile or tablet regressions, layout verification, or responsive test reporting.
- Use this skill when the agent must extend existing Playwright or Cypress coverage across multiple viewport sizes.
- Use this skill when the task requires a reusable viewport strategy or a structured responsive test report.
- Do not use this skill for API-only work, backend-only work, browser-compatibility-only work, or visual design tasks that do not require automated testing.
2. Confirm Preconditions
- Identify the page, flow, or feature under test.
- Identify the target environment:
- local dev server
- preview or staging deployment
- production-like environment approved for testing
- Identify the existing frontend test framework from repository evidence before generating new tests.
- Identify any required authentication, seed data, fixtures, feature flags, or environment variables.
- Identify the requested report formats. Default to
jsonandmarkdownwhen the user does not specify a format. - Identify the source of breakpoint truth:
- design system
- CSS framework config
- product requirement
- fallback matrix from this skill
- If prerequisites are unclear, stop and inspect the repository before writing tests.
3. Search The Repository First
- Search the repository for existing frontend tests before writing any new test.
- Search for framework signals first:
playwright.config.*cypress.config.*package.jsontests/e2e/spec/integration/
- Search for reusable test coverage next:
- feature name
- route name
- component name
mobiletabletviewportdevice
- Prefer reuse in this order:
- parameterize an existing high-value flow
- duplicate a narrowly scoped test and refactor it into a shared responsive pattern
- create one new focused responsive test only when no safe reusable base exists
- Read references/framework-detection.md only when framework detection or test reuse selection is unclear.
4. Select The Execution Strategy
- Reuse the repository's native test runner and conventions.
- Prefer parameterized viewport coverage over duplicating full test files per device class.
- Use existing device profiles, test fixtures, helpers, and artifact settings before introducing new ones.
- Choose the smallest viewport matrix that covers the user request and product risk.
- Start with the repository's official breakpoints when they exist.
- Use the fallback matrix from references/viewport-strategy.md only when the repository does not define breakpoint coverage.
- Expand coverage only when one of these conditions is true:
- layout behavior changes materially between breakpoints
- the page contains navigation, drawers, tables, grids, or dense forms
- the product contract explicitly names supported devices
- a bug report names a specific failing viewport class
5. Implement Or Extend Tests
- Extend an existing test before creating a new test.
- Preserve the original user journey and business assertion intent.
- Add viewport parameters around that journey instead of cloning the entire flow for each size.
- Add responsive assertions that verify behavior, not only appearance.
- Prioritize these assertions:
- primary actions stay visible and reachable
- navigation remains usable in collapsed and expanded states
- dialogs, drawers, menus, and modals fit within the viewport
- critical content does not clip or overlap unexpectedly
- horizontal scrolling does not appear unless intentionally designed
- forms, tables, cards, and sticky elements remain usable
- Capture at least one screenshot for every executed viewport result and preserve extra failure artifacts or traces when available.
- Do not limit screenshots to failures only. Reports must show evidence for passed and failed viewport results alike.
- Name viewport runs consistently with the viewport label.
- Keep responsive-specific assertions isolated enough that failures can be diagnosed quickly.
6. Run The Smallest Useful Scope
- Run only the selected responsive scope first.
- Do not multiply the entire end-to-end suite across every viewport unless the user explicitly requests full-matrix execution.
- Record these run details:
- framework
- command
- application area
- reused tests
- new tests
- viewport matrix
- artifact paths
- pass or fail status per viewport
- If failures occur across all viewports, verify the base journey is stable before diagnosing responsive behavior.
- Capture and record screenshot evidence for every executed result, not only failing ones.
- If failures are viewport-specific, capture enough evidence to explain the regression without rerunning unrelated suites.
7. Produce The Normalized Report
- Build one normalized JSON report before generating human-readable output.
- Use the schema and rendering rules in references/reporting-format.md when the output contract matters.
- Use
scripts/generate_responsive_report.pyto renderjson,markdown, andhtml. - Use assets/report-template.md as the default Markdown template unless the repository intentionally overrides it.
- Include these minimum report fields:
- schema version
- skill name
- generated timestamp
- framework
- target
- command
- reused tests
- new tests
- viewports
- results
- summary
- findings
- artifacts
- next actions
- Ensure every executed result in
resultscontains at least one screenshot artifact so the rendered report shows complete visual evidence across the full matrix. - When multiple scan types or multiple page scopes are produced separately, generate an overview report that links to the individual report bundles with
scripts/generate_responsive_overview.py.
8. Follow The Output Contract
- Return or save:
- changed or created test files
- normalized JSON report path
- rendered Markdown report path when requested
- rendered HTML report path when requested
- Summarize:
- which tests were reused
- which tests were created
- which viewports were covered
- which viewports failed
- which defects were observed
- which follow-up actions are recommended
- If the task only asked for analysis, do not fabricate execution results.
- If tests could not be run, state what blocked execution and still provide the planned matrix plus reusable test candidates.
9. Respect Guardrails
- Do not create a new frontend test stack when the repository already has one.
- Do not generate brand-new tests before checking for reusable coverage.
- Do not duplicate a full spec file per viewport when parameterization is practical.
- Do not rely on screenshots alone as the responsive oracle.
- Do not hardcode brittle pixel-perfect assertions unless the product contract explicitly requires them.
- Do not claim realistic mobile behavior from width-only resizing when touch or device emulation materially changes behavior.
- Do not mix responsive expansion with unrelated browser-matrix expansion unless the user explicitly requests both.
- Do not persist runtime observations as shared memory automatically.
10. Aware of Common Gotchas
- Do not assume a resized browser window behaves identically to a real mobile device; touch targets, hover states, and native scrolling often differ.
- Browser-based viewport resizing does not account for real-world hardware constraints, network throttling, or OS-specific rendering quirks.
- Avoid selectors that depend on layout structures which change between desktop and mobile (e.g., a top-level nav that becomes a hidden hamburger menu).
- Verify that elements "hidden" for mobile are either correctly accessible or intentionally excluded, rather than just visually obscured.
- Be aware that responsive transitions (like drawer slides or modal fades) may require additional wait times or interaction handling compared to static desktop layouts.
- Do not attempt to test every possible device; prioritize the smallest set of breakpoints that cover the most significant layout shifts.
11. Use The Memory Model Deliberately
- Treat the current investigation, grep results, selected viewport matrix, and temporary findings as runtime memory only.
- Persist project-local knowledge only when the repository already has a local place for stable testing conventions, fixtures, or reusable report inputs.
- Do not create cross-agent shared memory inside this skill.
- If broader cross-repository memory is explicitly required, integrate with an external shared-memory skill instead of embedding that concern here.
12. Read Additional References Only When Needed
- Read references/framework-detection.md when framework detection, reuse selection, or mixed-runner decisions are unclear.
- Read references/viewport-strategy.md when you need a default matrix, assertion priorities, or device-emulation guidance.
- Read references/reporting-format.md when you need the normalized report schema or rendering rules.
- Read references/evaluation.md when you need a repeatable quality gate for this skill or a repository using it.
13. Follow These Examples
Example: extend existing Playwright checkout coverage
- Input:
Add responsive coverage for checkout and produce markdown plus json output. - Actions:
- Search for checkout Playwright specs.
- Reuse the checkout happy-path spec.
- Parameterize it across the selected viewport matrix.
- Run only the checkout responsive scope.
- Save
artifacts/responsive-report.json. - Render
artifacts/responsive-report.md.
- Expected output:
Reused tests: tests/checkout.spec.ts New tests: none Reports: artifacts/responsive-report.json, artifacts/responsive-report.md
- Input:
Example: extend existing Cypress dashboard coverage
- Input:
Test the dashboard on mobile, tablet, and desktop and produce json plus html output. - Actions:
- Search for dashboard Cypress specs.
- Reuse the existing dashboard smoke flow.
- Iterate that flow across the requested viewport set.
- Capture screenshots for every executed viewport result.
- Save normalized JSON.
- Render HTML from the normalized data.
- Expected output:
Reused tests: cypress/e2e/dashboard.cy.ts Reports: artifacts/responsive-report.json, artifacts/responsive-report.html Failed viewports: tablet-portrait
- Input:
Example: no reusable tests found
- Input:
Add responsive testing for the pricing page. - Actions:
- Search the repo for pricing coverage.
- Confirm no reusable test exists.
- Create one focused responsive test for the main pricing journey.
- Run the minimum useful matrix.
- Generate normalized JSON and Markdown reports.
- Expected output:
Reused tests: none New tests: 1 Reports: artifacts/responsive-report.json, artifacts/responsive-report.md
- Input:
Example: analysis-only request
- Input:
Audit our current Playwright suite for responsive readiness and tell me what should be reused. - Actions:
- Inspect the repository for reusable specs and helpers.
- Propose a viewport matrix and reuse candidates.
- Do not fabricate run output.
- Expected output:
Reuse candidates: 4 New tests required: 1 Execution: not run
- Input:
14. Troubleshoot Predictably
Problem: framework is unclear
- Fix: inspect
package.json, config files, and test directories. - Fix: read references/framework-detection.md.
- Fix: inspect
Problem: no reusable tests are available
- Fix: create one focused happy-path responsive test for the highest-value journey.
- Fix: keep the new test parameterized by viewport.
Problem: all viewports fail immediately
- Fix: verify the base journey, environment, auth, and seed data at one stable desktop viewport.
- Fix: only resume responsive diagnosis after base stability is confirmed.
Problem: screenshot diffs are noisy
- Fix: prefer DOM, visibility, overflow, and interaction assertions for primary pass-fail logic.
- Fix: keep screenshots as evidence only.
Problem: report output is inconsistent
- Fix: normalize the raw results into one JSON schema first.
- Fix: regenerate final outputs with
scripts/generate_responsive_report.py.
Problem: the task requires broader knowledge sharing
- Fix: keep current findings in runtime memory unless there is an explicit local persistence location.
- Fix: use an external shared-memory skill for cross-agent reuse instead of extending this skill's scope.
15. Complete The Task
- Confirm the repository was searched for reusable tests first.
- Confirm the framework was detected from repository evidence.
- Confirm the viewport matrix was justified.
- Confirm existing tests were reused or adapted where possible.
- Confirm the report was generated in the requested format or explain why execution was blocked.
- Confirm the final output identifies reused tests, new tests, failures, artifacts, and next actions.