Skip to content
Asia/Kolkata
ProjectsNovember 28, 2025

Automating Playwright Test Generation from Pull Requests

image
Automated generation of Playwright test cases using AI, driven entirely by Pull Request (PR) merges. This system analyzes code changes in real time and produces relevant end-to-end tests without any human intervention, ensuring test coverage evolves alongside the application.
  • PR-Driven Test Generation: Automatically triggers when a Pull Request is merged into the main branch of the application repository, ensuring tests are always aligned with the latest changes.
  • Diff-Based Intelligence: Extracts the diff between the latest merged PR and the previous main branch state, sending only the relevant changes to the AI model for precise test generation.
  • AI-Generated Playwright Tests: Uses Google Gemini to generate Playwright .spec.ts files based solely on code changes, minimizing redundant or outdated tests.
  • Decoupled Test Repository: Commits generated tests to a separate Playwright repository, keeping application code and test automation cleanly separated.
  • Fully Automated Execution: A secondary GitHub Action in the Playwright repository automatically runs the newly generated tests against the application.
  • Zero Manual Test Writing: Eliminates repetitive test authoring while maintaining strong regression coverage in the CI/CD pipeline.
  • Node.js: For scripting automation logic and integrating with AI APIs.
  • GitHub Actions: To orchestrate workflows on PR merge, test generation, commits, and execution.
  • Playwright: For robust, end-to-end browser testing.
  • Google Gemini AI: To intelligently generate test cases based on code diffs.
  • Git & GitHub: For version control and repository orchestration.
A key challenge was ensuring AI-generated tests were both relevant and reliable when based only on diffs. This was addressed by carefully structuring the prompt sent to Gemini and normalizing diffs to focus on user-impacting changes. Another learning was designing a clean multi-repo workflow that avoids circular triggers while keeping automation fully hands-off. This setup delivers continuously evolving test coverage with minimal maintenance overhead. Test generation now scales naturally with feature development, CI remains fast and reliable, and the overall development workflow benefits from faster feedback and higher confidence in changes. The result is a smarter, more autonomous testing pipeline powered by AI and automation.
More work

Related projects

Cross-Platform Mobile E2E Testing with mobilewright

Cross-Platform Mobile E2E Testing with mobilewright

Configured and maintained a 19-test mobile E2E suite using mobilewright covering alerts, animation, calendar, forms, gestures, lists, media, signature, profile, and login flows — all passing on both iOS and Android. Contributed two upstream bug fixes to the mobilewright framework.

Adya — From SwiftUI Prototype to Cross-Platform Rewrite

A minimal daily task manager, first validated as a native SwiftUI/iOS prototype, then rebuilt from scratch in Expo/React Native (New Architecture) to ship one codebase across iOS and Android.

QuantForge — Multi-Agent Market Intelligence & Algorithmic Trading Platform

A multi-agent market intelligence platform for Indian markets (NSE/BSE) built on Zerodha Kite Connect — 13 independent AI agents surface probabilistic signals, with a Risk Agent holding veto power and every strategy required to clear a Backtest → Out-of-Sample → Paper Trading → Risk Review gate before it can touch capital.