agentleFS
soilmasssoilmass/motion-design-agent/skills/testing-patterns/SKILL.md

testing-patterns

Skill7 starsChanged 10 months agoMITView on GitHub

Testing strategies for animations and motion. Use for visual regression testing, timing verification, reduced motion compliance, and performance profiling to ensure animations work correctly.

44 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use intelligent-routing, bash-linux and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SKB3002Skill

    intelligent-routing

    Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.

    Also in 5 projects that use this

  • xenitV1Skill

    bash-linux

    Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.

    Also in 6 projects that use this

  • xenitV1Skill

    red-team-tactics

    Red team tactics principles based on MITRE ATT&CK. Attack phases, detection evasion, reporting.

    Also in 6 projects that use this

  • ChrisWilesSkill

    formik-patterns

    Formik form handling with validation patterns. Use when building forms, implementing validation, or handling form submission.

    Also in 3 projects that use this

  • SKB3002Skill

    nextjs-react-expert

    React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.

    Also in 3 projects that use this

  • adybaSkill

    safe-workflow

    SAFe Agentic Workflow orchestrator. Teaches the full SAFe methodology adapted for AI agents: pattern discovery, exit states, quality gates, agent personas, and specs-driven development. Use when setting up a project with SAFe workflow, understanding the multi-agent methodology, or coordinating work across agent personas. Triggers: "SAFe workflow", "agent workflow", "safe harness", "specs-driven", "exit states", "quality gates", "multi-agent workflow".

    Also in 3 projects that use this

  • +4 more from xenitV1

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 29 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Not waiting for animation completion: - Use proper timeouts

    line 163
  2. Distinctive:

    Ignoring reduced motion: - Always test both preferences

    line 164

“Common” is measured: kept by at least 6 in 10 of the 29 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Animation Testing Patterns

Systematic approaches to testing animations for correctness, accessibility, and performance.

Testing Categories

CategoryWhat to TestTools
Visual regressionAnimation appearancePlaywright, Percy
TimingDuration, delays, easingJest timers, Playwright
AccessibilityReduced motion, focusPlaywright, axe
PerformanceFrame rate, paint timesChrome DevTools, Lighthouse

Visual Regression Testing

Playwright Setup

import { test, expect } from '@playwright/test';

test.describe('Button animations', () => {
  test('hover state animation', async ({ page }) => {
    await page.goto('/components/button');
    const button = page.locator('.animated-button');

    await expect(button).toHaveScreenshot('button-idle.png');

    await button.hover();
    await page.waitForTimeout(300);

    await expect(button).toHaveScreenshot('button-hover.png');
  });
});

Timing Verification

Jest Timer Tests

import { render, screen, act } from '@testing-library/react';

describe('Animation timing', () => {
  beforeEach(() => jest.useFakeTimers());
  afterEach(() => jest.useRealTimers());

  test('fade-in completes in 300ms', () => {
    render(<AnimatedComponent />);
    const element = screen.getByTestId('animated-element');

    expect(element).toHaveStyle({ opacity: 0 });

    act(() => jest.advanceTimersByTime(300));

    expect(element).toHaveStyle({ opacity: 1 });
  });
});

Reduced Motion Testing

Playwright Reduced Motion

test.describe('Reduced motion compliance', () => {
  test('respects prefers-reduced-motion', async ({ page }) => {
    await page.emulateMedia({ reducedMotion: 'reduce' });
    await page.goto('/components/animated-list');

    await page.click('[data-add-item]');

    const item = page.locator('.list-item').last();
    const animationDuration = await item.evaluate(
      el => getComputedStyle(el).animationDuration
    );

    expect(animationDuration).toBe('0s');
  });
});

Jest Reduced Motion

describe('Reduced motion', () => {
  beforeEach(() => {
    Object.defineProperty(window, 'matchMedia', {
      writable: true,
      value: jest.fn().mockImplementation(query => ({
        matches: query === '(prefers-reduced-motion: reduce)',
        media: query,
        addEventListener: jest.fn(),
        removeEventListener: jest.fn(),
      })),
    });
  });

  test('uses instant transition when reduced motion preferred', () => {
    render(<AnimatedComponent />);
    const element = screen.getByTestId('animated');
    expect(element).toHaveClass('reduced-motion');
  });
});

Performance Testing

Frame Rate Testing

test('maintains 60fps during animation', async ({ page }) => {
  await page.goto('/components/heavy-animation');

  await page.tracing.start({ categories: ['devtools.timeline'] });

  await page.click('[data-start-animation]');
  await page.waitForTimeout(1000);

  const traceBuffer = await page.tracing.stop();
  const trace = JSON.parse(traceBuffer.toString());

  // Analyze frame times - 60fps = 16.67ms per frame
  const frames = trace.traceEvents
    .filter(e => e.name === 'FrameCommittedInBrowser')
    .map(e => e.ts);

  const frameTimes = frames.slice(1).map((ts, i) => ts - frames[i]);
  const avgFrameTime = frameTimes.reduce((a, b) => a + b, 0) / frameTimes.length;

  expect(avgFrameTime).toBeLessThan(20000); // 20ms average
});

CI Integration

name: Animation Tests
on: [push, pull_request]

jobs:
  visual-regression:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
      - run: npm ci
      - run: npx playwright install --with-deps
      - run: npm run test:animations
      - uses: actions/upload-artifact@v3
        if: failure()
        with:
          name: animation-test-results
          path: test-results/

Common Testing Mistakes

  1. Not waiting for animation completion - Use proper timeouts
  2. Ignoring reduced motion - Always test both preferences
  3. Screenshot timing issues - Capture at consistent animation points
  4. Missing performance baseline - Establish fps expectations
  5. Flaky visual tests - Allow reasonable pixel tolerance

Related Skills

  • motion-audit/ - Comprehensive audit checklists
  • accessibility/ - WCAG compliance requirements
  • remotion/ - Testing Remotion compositions

See references/ for complete Playwright and Jest test examples.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.