Design a scalable, maintainable browser automation framework using Selenium or Playwright with page object models and robust reporting.
## CONTEXT According to the State of Testing Report, 72% of organizations invest in test automation but only 38% report achieving meaningful ROI, primarily because of poorly designed frameworks that become unmaintainable within 6 to 12 months. The average cost of maintaining a brittle test automation suite exceeds the cost of manual testing by the second year. A well-architected framework using modern patterns like the Page Object Model, fluent waits, and parallel execution transforms automation from a cost center into a force multiplier that enables continuous delivery. ## ROLE You are a test automation architect with 11 years of experience building browser automation frameworks for companies shipping web applications at scale. You have designed Selenium and Playwright frameworks that run over 10,000 tests nightly across 15 browser and device combinations. Your frameworks are known for their low maintenance overhead, typically requiring less than 5% of total QA effort for upkeep. You are a contributor to the Playwright open-source project and have published extensively on automation design patterns. ## RESPONSE GUIDELINES - Provide a complete framework architecture with folder structure, naming conventions, and dependency management - Include code examples for the core patterns including page objects, test utilities, and configuration management - Design for parallel execution from the start, as retrofitting parallelism is extremely costly - Specify the reporting and screenshot capture strategy for debugging failed tests - Do NOT recommend a framework design that hardcodes selectors, URLs, or test data into test scripts - Do NOT skip the retry and wait strategy, as timing issues cause over 60% of flaky automation tests ## TASK CRITERIA 1. **Framework Architecture Selection** — Evaluate the requirements for [INSERT APPLICATION TYPE] and recommend either Selenium WebDriver or Playwright with detailed justification. Consider factors including browser coverage needs, execution speed requirements, language ecosystem, and team expertise. 2. **Project Structure and Organization** — Design the complete folder structure including directories for page objects, test specs, test data, utilities, configuration files, reports, and screenshots. Define naming conventions for every artifact type. 3. **Page Object Model Implementation** — Create the page object architecture with a base page class containing common methods for waits, clicks, inputs, and assertions. Design page-specific classes for at least 3 key pages of the application with element locator strategies. 4. **Configuration Management** — Build a configuration system that supports multiple environments, browsers, and execution modes without code changes. Include environment-specific URLs, credentials handling through environment variables, timeout values, and browser options. 5. **Wait and Retry Strategy** — Design a comprehensive wait strategy that eliminates flaky timing issues. Include implicit waits, explicit waits with custom conditions, retry logic for intermittent failures, and a maximum timeout hierarchy. 6. **Test Data Management** — Define how test data is stored, loaded, and cleaned up. Include strategies for fixture data, factory patterns for dynamic data generation, and database seeding for integration test scenarios. 7. **Reporting and Debugging** — Configure rich HTML reporting with test results, execution time, screenshots on failure, video recording for debugging, and trend analysis across runs. Include integration with your CI/CD tool for report publishing. 8. **Cross-Browser and Parallel Execution** — Design the parallel execution strategy including worker count configuration, test isolation requirements, shared resource management, and the CI pipeline configuration for matrix testing across browsers. 9. **CI/CD Integration Blueprint** — Specify the pipeline stages for automation including dependency installation, test execution with parallelism, report generation, artifact storage, and notification triggers for failures. ## INFORMATION ABOUT ME - My application type and URL pattern: [INSERT APP TYPE — e.g., SPA built with React, multi-page app with server rendering] - My preferred programming language: [INSERT LANGUAGE — e.g., TypeScript, JavaScript, Python, Java] - My browser coverage requirements: [INSERT BROWSERS — e.g., Chrome, Firefox, Safari, Edge, mobile Chrome] - My CI/CD platform: [INSERT PLATFORM — e.g., GitHub Actions, Jenkins, GitLab CI, Azure DevOps] - My team automation experience level: [INSERT LEVEL — e.g., beginner, intermediate, advanced] ## RESPONSE FORMAT - Begin with a framework comparison table if both Selenium and Playwright are viable - Present the folder structure as a visual directory tree - Include code snippets for the base page object, a sample page object, and a sample test - Provide a configuration file example for multi-environment support - Include a CI/CD pipeline configuration file example - End with a framework adoption roadmap showing weekly milestones for the first month
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[INSERT APPLICATION TYPE]