Skip to content

JPeetz/agent-skills / skills/qa-testing/playwright-e2e-testing

playwright-e2e-testing

Verified

Use this skill when writing, debugging, or maintaining Playwright end-to-end tests in TypeScript, JavaScript, or Python. Covers test structure and architecture (Page Object Model, fixtures, custom matchers), locator strategy (role-based, test-ID, accessible selectors), auto-waiting and retry, API/network mocking, visual regression, component testing (React, Vue, Svelte), accessibility audits (axe-core), device emulation, authentication and session management (multi-profile, OAuth, 2FA), performance testing (Web Vitals, Lighthouse), CI/CD configuration (GitHub Actions, GitLab CI, sharding), flaky test detection and auto-healing, test data/fixtures, i18n testing, Electron and browser extension testing, security testing (XSS, CSRF, CSP), and WebSocket testing. Designed for agentic platforms β€” Claude Code, Codex, Cursor, Gemini CLI, OpenClaw, GitHub Copilot, Windsurf, OpenCode, and all SKILL.md-compatible agents.

FileKindSize
CHANGELOG.mdmarkdown2.2 KB
LICENSEother1.0 KB
SKILL.mdskill md23.4 KB
evals/evals.jsonconfig5.3 KB
references/ci-cd-patterns.mdmarkdown2.5 KB
references/locator-strategies.mdmarkdown3.0 KB
references/testing-types-matrix.mdmarkdown3.2 KB
scripts/flake-detector.shexecutablescript2.0 KB
scripts/generate-auth-profile.tsscript3.4 KB
scripts/validate-playwright-setup.shexecutablescript2.2 KB

scripts/flake-detector.sh

View on GitHub
#!/bin/bash
# flake-detector.sh β€” Runs a Playwright test suite repeatedly to detect flaky tests
# Usage: ./flake-detector.sh [--runs=10] [--grep="pattern"] [--project="name"]
set -euo pipefail

RUNS=10
GREP_FILTER=""
PROJECT=""
SPEC_FILE="${1:-}"

while [[ $# -gt 0 ]]; do
  case "$1" in
    --runs=*) RUNS="${1#*=}"; shift ;;
    --grep=*) GREP_FILTER="--grep ${1#*=}"; shift ;;
    --project=*) PROJECT="--project ${1#*=}"; shift ;;
    *) SPEC_FILE="$1"; shift ;;
  esac
done

if [ -z "$SPEC_FILE" ]; then
  echo "Usage: ./flake-detector.sh <spec-file> [--runs=10] [--grep=pattern]"
  echo "Example: ./flake-detector.sh e2e/tests/checkout.spec.ts --runs=20"
  exit 1
fi

echo "πŸ”¬ Flake Detector β€” Running '$SPEC_FILE' $RUNS times"
echo "================================================"

PASSES=0
FAILURES=0
FLAKES=0
PREVIOUS_RESULT=""

# Disable retries to expose flakes
export PLAYWRIGHT_RETRIES=0

for i in $(seq 1 $RUNS); do
  printf "Run %2d/%d... " "$i" "$RUNS"

  if npx playwright test "$SPEC_FILE" $GREP_FILTER $PROJECT --reporter=line 2>&1 | tail -1 | grep -q "passed"; then
    RESULT="PASS"
    PASSES=$((PASSES + 1))
  else
    RESULT="FAIL"
    FAILURES=$((FAILURES + 1))
  fi

  echo "$RESULT"

  if [ -n "$PREVIOUS_RESULT" ] && [ "$RESULT" != "$PREVIOUS_RESULT" ]; then
    FLAKES=$((FLAKES + 1))
  fi
  PREVIOUS_RESULT="$RESULT"
done

echo ""
echo "================================================"
echo "πŸ“Š Results for $SPEC_FILE:"
echo "   Passes:   $PASSES/$RUNS"
echo "   Failures: $FAILURES/$RUNS"
echo "   Flakes:   $FLAKES (result changes between runs)"
echo ""

if [ $FLAKES -gt 0 ]; then
  echo "⚠️  FLAKY TEST DETECTED β€” Result changed between runs"
  echo "   Review test for: missing awaits, race conditions, time dependencies"
  echo "   Run with --debug to step through: npx playwright test $SPEC_FILE --debug"
  exit 1
elif [ $FAILURES -gt 0 ]; then
  echo "❌ TEST FAILED consistently β€” Not flaky, genuinely broken"
  exit 1
else
  echo "βœ… TEST IS STABLE β€” $RUNS/$RUNS passed consistently"
fi
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall