This project is a user-friendly web portal designed to accelerate the creation of end-to-end tests by leveraging the power of Generative AI. Users can input a web address and a natural language test scenario, and the application will automatically generate the necessary Python code, following the industry-standard Page Object Model (POM).
In modern software development, end-to-end testing is crucial for ensuring quality. However, writing and maintaining these tests is often a time-consuming and repetitive process. QA Engineers and SDETs spend a significant amount of time on boilerplate tasks:
- Manually inspecting the DOM to find stable element locators.
- Writing locator definitions and interaction methods for a Page Object.
- Structuring the test script to import the page object and execute the steps.
This manual effort slows down the development cycle and can be a barrier to achieving comprehensive test coverage, especially for teams under tight deadlines.
This tool addresses the bottleneck by automating the most tedious parts of test script creation. By simply describing a test scenario in plain English, a QA engineer can get a complete, well-structured first draft of their test in seconds.
How AI Accelerates the QA Routine:
- From Intent to Code: The AI acts as a translator, converting a high-level user story (e.g., "Add two items to the todo list and mark one as complete") into precise, executable Playwright code.
- Automated POM Generation: The AI analyzes the request and generates a clean Page Object class, complete with robust locators (prioritizing user-facing ones like
get_by_role) and interaction methods. This saves significant time and promotes a maintainable, reusable test architecture from the start. - Rapid Prototyping: Engineers can quickly generate tests for new features or bug fixes, getting immediate feedback and a solid foundation to build upon. This allows them to focus their expertise on more complex logic, edge cases, and overall test strategy rather than on repetitive coding.
To provide immediate insight into the quality of the generated code, the application includes a "Generation Analysis" section that visualizes key metrics after each generation:
- Code Breakdown (Doughnut Chart): This chart displays the ratio of code lines between the Page Object file and the Test Script file. It offers a quick overview of the code's structural balance.
- Locator Strategy (Bar Chart): This chart analyzes and counts the different types of Playwright locators (e.g.,
get_by_role,get_by_text) used in the generated code. This provides an at-a-glance assessment of the selectors' quality and adherence to best practices, favoring more robust, user-facing locators.
These visualizations help engineers quickly evaluate the AI's output before diving into the code.
It is crucial to understand that this project is a simple prototype and a proof-of-concept. It is not a production-ready product.
The goal is to demonstrate the potential of AI in the QA space. The generated code should be seen as a powerful starting point or a "smart assistant," but it always requires review, and potentially modification, by a qualified engineer before being integrated into a production test suite.
- Frontend: React, TypeScript, Tailwind CSS
- AI Integration: Google Gemini API (
gemini-2.5-flash), OpenAI API (gpt-4o) - Generated Code: Python, Playwright, Pytest
Once you've generated and downloaded the page_object.py and test_script.py files:
-
Setup Your Environment: Make sure you have Python installed, then install the necessary packages.
# Install Playwright, Pytest, and the plugin pip install playwright pytest pytest-playwright # Download the necessary browser binaries playwright install
-
Run the Test: Navigate to the directory where you saved the files and run Pytest.
pytest test_script.py