Skip to main content
bash TV

Quality Gate in Playwright pipeline | Fail pipeline on threshold | Gitlab

PrinceAutomationDestination

86 views3 Oct 2026

YouTube

🚦 Playwright + GitLab CI: Implement Quality Gates with JUnit Reports By default, a Playwright test failure causes the GitLab CI pipeline to fail. But what if we want the entire test suite to execute first, collect all test results, and then decide whether the pipeline should pass or fail based on the overall test quality? In this video, we introduce a Quality Gate stage in GitLab CI that evaluates the Playwright test results using the JUnit report. πŸ” What We Are Building Instead of immediately failing the pipeline when a Playwright test fails, we will: 1. ▢️ Execute all Playwright tests 2. πŸ“„ Generate a JUnit test report 3. βœ… Allow the Playwright test stage to continue even when tests fail 4. πŸ“Š Add a separate **Quality Gate** stage 5. πŸ”Ž Read the JUnit report and calculate the test pass/failure percentage 6. 🚦 Decide whether the pipeline should ultimately pass or fail 🎯 Quality Gate Rule For this example, we will use a **90% pass-rate threshold**: βœ… Pass the pipeline β†’ Pass percentage is **more than 90%** ❌ Fail the pipeline β†’ Failure percentage reaches **10% or more** This separates test execution from the final quality decision. 🧩 GitLab CI Pipeline Flow Playwright Tests ↓ JUnit Report ↓ Quality Gate ↓ Pass / Fail Pipeline This approach is particularly useful when you don't want the first failed test to stop the execution of the remaining tests, but you still want the pipeline to enforce a defined quality standard. πŸ“Œ Topics Covered Playwright test execution in GitLab CI allow_failure JUnit Reporter JUnit XML test results GitLab CI artifacts Quality Gate stage Calculating pass/failure percentage Pipeline pass/fail based on test quality Separating test execution from quality validation If you're working with Playwright, GitLab CI/CD, Test Automation, or Quality Engineering, this is a practical pattern you can apply to your automation pipelines. πŸ‘ If you find this useful, Like, Share & Subscribe to PrinceAutomationDestination for more content on Playwright, Automation, CI/CD, GenAI and Agentic AI.

Join the discussion

Sign in to join the discussion

Sign in