GSoC 2026 Proposal: Switch to Playwright Tests for Integration Testing
Applicant
Mohamed Saeed
Information Technology Student, Egyptian E-Learning University
Junior AI & ML Student | Software Developer | ISTQB Foundation Level Certified Tester
Abstract
Django currently relies on Selenium-based browser integration tests. While Selenium has served Django well, its tests are relatively slow, more difficult to maintain, and occasionally flaky because of explicit waits and browser synchronization issues.
This project proposes migrating Django’s browser integration testing infrastructure from Selenium to Playwright. Playwright provides automatic waiting, improved debugging tools, parallel execution, cross-browser consistency, and a simpler API.
The main goal of this project is to create a Playwright-based testing foundation inside Django, migrate the existing Selenium tests incrementally, and ensure the complete suite works reliably in Django’s CI pipeline.
Problem Statement
Django’s current integration tests depend on Selenium and custom browser setup logic. This introduces several limitations:
-
Tests are slower than modern browser automation frameworks.
-
Synchronization often requires explicit waits and brittle timing logic.
-
Debugging failed tests is difficult.
-
Browser tests are more likely to become flaky in CI.
-
Contributors who want to write new integration tests face a higher learning curve.
Playwright addresses these issues through:
-
Automatic waiting for page elements and events.
-
Faster execution and easier parallelization.
-
Built-in support for Chromium, Firefox, and WebKit.
-
Better debugging through traces, screenshots, and videos.
-
Cleaner and more maintainable test code.
Proposed Goals
-
Introduce a new PlaywrightTestCase integrated with Django’s LiveServerTestCase.
-
Create an AdminPlaywrightTestCase equivalent for Django admin integration tests.
-
Add Playwright dependency handling and optional test execution.
-
Migrate existing Selenium-based tests to Playwright gradually.
-
Ensure all migrated tests pass in Django’s GitHub Actions CI.
-
Document the new workflow for future contributors.
-
Remove Selenium-based infrastructure once the migration is complete and stable.
Technical Approach
1. Build Playwright Base Classes
I will implement:
class PlaywrightTestCase(LiveServerTestCase):
...
class AdminPlaywrightTestCase(PlaywrightTestCase):
...
These classes will:
-
Start and stop Playwright automatically during test setup and teardown.
-
Launch browser contexts in isolated sessions.
-
Provide helper methods similar to Django’s existing Selenium test utilities.
-
Support Chromium initially, with future compatibility for Firefox and WebKit.
The design will remain close to the existing Selenium API so that migration requires minimal code changes.
2. Parallel Transition Strategy
Instead of removing Selenium immediately, Playwright will initially coexist with Selenium.
During the transition:
-
Existing Selenium tests will continue to work.
-
New Playwright tests will be introduced incrementally.
-
CI will run both systems until the Playwright version becomes stable.
This reduces risk and avoids breaking Django’s current testing workflow.
3. Migration of Existing Tests
The migration will happen module-by-module.
Priority order:
-
Small and isolated browser tests.
-
Admin integration tests.
-
Popup and JavaScript interaction tests.
-
Remaining Selenium-based modules.
Special attention will be given to:
-
Window and popup handling.
-
JavaScript alerts and confirmations.
-
Form submissions and dynamic page updates.
-
Authentication and admin login flows.
4. CI Integration
I will update Django’s CI pipeline to:
-
Install Playwright browsers automatically.
-
Run Playwright tests in GitHub Actions.
-
Generate useful debugging output when failures occur.
-
Ensure compatibility across supported Python and browser versions.
Example:
python -m playwright install
Expected Deliverables
By the end of the project, Django will have:
-
A fully functional PlaywrightTestCase.
-
Migrated browser integration tests.
-
Playwright support integrated into CI.
-
Documentation for contributors.
-
A clear migration path away from Selenium.
Timeline (175 Hours)
Community Bonding Period
-
Study Django’s current Selenium-based test architecture.
-
Discuss implementation details with mentors.
-
Finalize migration order and project scope.
-
Create a proof-of-concept branch.
Week 1
-
Set up local Playwright environment.
-
Explore Django’s current browser test utilities.
-
Design the PlaywrightTestCase API.
Week 2
Week 3
Week 4
Week 5
Week 6
-
Migrate admin-related integration tests.
-
Handle forms, login, and page interactions.
Week 7
-
Implement popup, multi-window, and JavaScript dialog support.
-
Port the related Selenium tests.
Week 8
Week 9
Week 10
Week 11
Week 12
Risks and Mitigation
| Risk |
Mitigation |
| Some Selenium behaviors do not directly map to Playwright |
Introduce compatibility helper methods and phased migration |
| Browser-specific failures in CI |
Start with Chromium, then test additional browsers gradually |
| Migration takes longer than expected |
Prioritize core tests first and leave optional modules for follow-up |
| Playwright lifecycle conflicts with Django test teardown |
Keep browser initialization inside setUp() / tearDown() to avoid async conflicts |
Why I Am a Good Fit
I have a strong background in Python, testing, and software engineering. I am an ISTQB Foundation Level Certified Tester and have experience with automation, debugging, and structured software development.
Through my academic and project work, I have:
-
Built multiple software projects using Python and web technologies.
-
Worked with testing methodologies and QA practices.
-
Contributed to complex systems involving maintainability and scalability.
-
Studied Django and browser-based testing workflows.
Additionally, my experience as both a software developer and tester allows me to understand the project from two perspectives: improving developer experience and improving test reliability.
Conclusion
This project will modernize Django’s browser integration testing infrastructure and provide a faster, more maintainable, and less flaky alternative to Selenium.
By introducing Playwright carefully and incrementally, Django can adopt a modern testing framework without disrupting the existing ecosystem. The result will be a more reliable contributor experience and stronger long-term testing support for the Django project.