{"id":49897970,"url":"https://github.com/prashant1507/playwright-behave-allure-ai-framework","last_synced_at":"2026-05-16T01:35:34.213Z","repository":{"id":304458088,"uuid":"1018851704","full_name":"prashant1507/playwright-behave-allure-ai-framework","owner":"prashant1507","description":"Python BDD test framework with Playwright, Behave, Allure and AI","archived":false,"fork":false,"pushed_at":"2025-11-30T15:19:51.000Z","size":103,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-02T22:24:01.307Z","etag":null,"topics":["ai","allure-reports","artificial-intelligence","bdd","behave","parallel-testing","playwright","python3"],"latest_commit_sha":null,"homepage":"https://github.com/prashant1507/playwright-behave-allure-ai-framework","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prashant1507.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-13T07:23:27.000Z","updated_at":"2025-11-30T15:19:55.000Z","dependencies_parsed_at":"2025-07-21T12:28:35.865Z","dependency_job_id":"64d7b3f3-24c4-43a3-8f25-aeef34a721e7","html_url":"https://github.com/prashant1507/playwright-behave-allure-ai-framework","commit_stats":null,"previous_names":["prashant1507/playwright-behave-allure-framework","prashant1507/playwright-behave-allure-ai-framework"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/prashant1507/playwright-behave-allure-ai-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashant1507%2Fplaywright-behave-allure-ai-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashant1507%2Fplaywright-behave-allure-ai-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashant1507%2Fplaywright-behave-allure-ai-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashant1507%2Fplaywright-behave-allure-ai-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prashant1507","download_url":"https://codeload.github.com/prashant1507/playwright-behave-allure-ai-framework/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prashant1507%2Fplaywright-behave-allure-ai-framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33087028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","allure-reports","artificial-intelligence","bdd","behave","parallel-testing","playwright","python3"],"created_at":"2026-05-16T01:35:33.690Z","updated_at":"2026-05-16T01:35:34.207Z","avatar_url":"https://github.com/prashant1507.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Automation Framework with Playwright + Behave + Allure + AI\n\n[![Python](https://img.shields.io/badge/Python-3.12+-blue.svg)](https://python.org)\n[![Playwright](https://img.shields.io/badge/Playwright-Latest-green.svg)](https://playwright.dev)\n[![Behave](https://img.shields.io/badge/Behave-Latest-orange.svg)](https://behave.readthedocs.io)\n[![Allure](https://img.shields.io/badge/Allure-Latest-red.svg)](https://docs.qameta.io/allure/)\n[![AI](https://img.shields.io/badge/AI-Ollama-purple.svg)](https://ollama.ai)\n\nA powerful, scalable automation framework combining **Playwright** for browser automation, **Behave** for BDD testing, **Allure** for reporting, **Page Object Model** for maintainable test structure, and **AI-powered selector healing** for robust test automation.\n\n## 🚀 Quick Start\n\n```bash\n# Clone and set up\ngit clone https://github.com/prashant1507/playwright-behave-allure-framework.git\ncd playwright-behave-allure-framework/\n\n# Install dependencies\npip install -r resources/requirements.txt\nplaywright install\n\n# Install LLM model\nolama pull devstral:24b\n\n# Install Node for checking tracing\nbrew install node\n\n# Run your first test\npython run_tests.py --tags @smoke\n```\n\n---\n\n## 📋 Table of Contents\n\n- [✨ Key Features](#-key-features)\n- [🏗️ Architecture](#️-architecture)\n- [🧠 AI Selector Healing](#-ai-selector-healing)\n- [⚙️ Setup Guide](#️-setup-guide)\n- [🧪 Running Tests](#-running-tests)\n- [📊 Reporting](#-reporting)\n- [🏷️ Tag Filtering](#tag-filtering)\n- [⚙️ Code Organization](#code-organization)\n- [🔍 Investigate Tracing](#investigate-tracing)\n- [📄 Log Files](#log-files)\n\n---\n\n## ✨ Key Features\n\n| Feature                       | Description                                             | Benefits                                        |\n|-------------------------------|---------------------------------------------------------|-------------------------------------------------|\n| 🧠 **AI Selector Healing**    | AI-powered selector recovery using Ollama              | Self-healing tests, reduced maintenance         |\n| 🏗️ **Page Object Model**     | Centralized element selectors and reusable page methods | Maintainable, scalable test structure           |\n| 🚀 **Parallel Execution**     | Multi-worker test execution feature-by-feature          | Faster test execution, efficient resource usage |\n| 🏷️ **Smart Tag Filtering**   | Filter tests by tags (`@smoke`, `@regression`, `@api`)  | Run only relevant tests, reduce execution time  |\n| 📊 **Enhanced Reporting**     | Allure integration with automatic screenshots           | Detailed HTML reports with failure analysis     |\n| ⚙️ **Flexible Configuration** | YAML config + environment variables + command-line args | Easy configuration management                   |\n| 🌐 **Multi-Browser Support**  | Chromium, Firefox, WebKit support                       | Cross-browser testing capabilities              |\n| 🎯 **Clean Output**           | Filtered console output with organized reporting        | Reduced noise, better debugging                 |\n\n---\n\n## 🏗️ Architecture\n\n```\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│   Feature Files │    │  Step Defs      │    │  Page Objects   │\n│   (Gherkin)     │───▶│  (Test Logic)   │───▶│  (Selectors)    │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n         │                       │                       │\n         ▼                       ▼                       ▼\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│   Behave        │    │   Playwright    │    │   Allure        │\n│   (BDD Engine)  │    │   (Browser)     │    │   (Reporting)   │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n         │                       │                       │\n         ▼                       ▼                       ▼\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│   AI Selector   │    │   Ollama        │    │   Selector      │\n│   Healer        │◀──▶│   (AI Model)    │───▶│   Map Cache     │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n```\n\n---\n\n## 🧠 AI Selector Healing\n\nThe framework includes an intelligent **AI-powered selector healing system** that automatically recovers from selector failures using the **Ollama AI model**.\n\n### How It Works\n\n1. **Automatic Detection**: When a selector fails (throws an exception), the system automatically triggers AI healing\n2. **Context Capture**: Captures current page screenshot and HTML content\n3. **AI Analysis**: Uses Ollama (`devstral:24b` model) to analyze the page and suggest new selectors\n4. **Validation**: Validates AI-suggested selectors before using them\n5. **Learning**: Maintains a `selector_map.json` file for future reference\n\n### Features\n\n- **🧠 Intelligent Recovery**: AI analyzes page structure and suggests optimal selectors\n- **📸 Visual Analysis**: Uses screenshots for better element identification\n- **🎯 Confidence Scoring**: AI provides confidence levels for suggested selectors\n- **📚 Historical Learning**: Maintains selector mapping for reuse and learning\n- **🔍 Multiple Selector Types**: Supports XPath, CSS, and text-based selectors\n- **⚡ Automatic Integration**: Seamlessly integrated into Page Object Model\n\n### Example Usage\n\n```python\n# In base_page.py - Automatic AI healing\ndef fill_input(self, selector: str, value: str):\n    try:\n        self.page.locator(selector).wait_for(timeout=5000)\n        self.page.fill(selector, value)\n    except playwright.sync_api.TimeoutError:\n        # AI healing automatically triggered\n        locator = ai_selector_healing(context=self.context, text=selector)\n        locator.fill(value)\n```\n### Benefits\n\n- **🔄 Self-Healing Tests**: Tests automatically recover from selector changes\n- **📉 Reduced Maintenance**: Less manual selector updates required\n- **🎯 Higher Reliability**: AI suggests robust, context-aware selectors\n- **📚 Continuous Learning**: Improves over time with historical data\n- **⚡ Faster Development**: Reduces debugging time for selector issues\n\n### Notes\n- The AI method is ready, and requires the user to adjust base_page.py functions\n- Use the @ai_healing tag to see AI in action\n\n---\n\n## ⚙️ Setup Guide\n\n### 1. Prerequisites\n\n- **Python 3.12+**\n- **Git** (for version control)\n- **Allure** (for reporting)\n- **Ollama** (for AI models)\n\n### 2. Environment Setup\n\n```\n# Create a virtual environment\npython -m venv venv\n\n# Activate virtual environment\n# On macOS/Linux:\nsource venv/bin/activate\n# On Windows:\nvenv\\Scripts\\activate\n\n# Upgrade pip\npip install --upgrade pip\n\n# Install Python packages\npip install -r requirements.txt\n\n# Install Playwright browsers\nplaywright install\n```\n\n### 3. Install Allure\n\n```\n# macOS (using Homebrew)\nbrew install allure\n\n# Windows (using Scoop)\nscoop install allure\n\n# Linux\nsudo apt-add-repository ppa:qameta/allure\nsudo apt-get update\nsudo apt-get install allure\n```\n\n### 4. Install Ollama (Required for AI Selector Healing)\n\n```\n# Install Ollama\nhttps://ollama.ai/\n\n# Pull the required model\nollama pull devstral:24b\n```\n\n### 5. Configuration\n\n#### Set URL in [Config.yaml](resources/config.yaml):\n\n```yaml\nbase_url: https://httpbin.org\n```\n\n**Important:** The `base_url` is **required** in `config.yaml`. The framework will raise an error if it's missing.\n\n### 6. AI Selector Healing Configuration\n\nThe AI selector healing system is automatically configured and ready to use. It will:\n\n- Create `selector_map.json` for historical selector mapping\n- Generate `selector_log.json` for AI interaction logs\n- Capture screenshots in `reports/screenshots/ai-*.png` for AI analysis\n- Use the `devstral:24b` Ollama model by default\n\n### 7. Verify Installation\n\n```bash\n# Run a quick test\npython run_tests.py --tags @smoke --headless\n```\n\n**Note:** The AI selector healing will automatically activate when selectors fail. You can monitor AI interactions in the console output and check the generated logs.\n\n---\n\n## 🧪 Running Tests\n\n### Check Script Usage\n```bash\n    python3 run_tests.py --help\n```\n\n### Basic Test Execution\n\n```bash\n# Run all tests\npython run_tests.py\n\n# Run specific feature files\npython run_tests.py features/login.feature features/forms.feature\n\n# Run tagged tests\npython run_tests.py --tags @smoke\n\n# Run with tracing\npython run_tests.py --tracing\n\n# Run with optimal worker count\npython run_tests.py --parallel\n\n# and so on\n```\n### Advanced Combinations\n\n```bash\n# Parallel execution with a specific browser and headless mode\npython run_tests.py --parallel --browser firefox --headless --workers 4\n\n# Run specific tags with custom configuration\npython run_tests.py --tags @smoke @api --browser webkit --headless\n\n# Run with auto-serve report\npython run_tests.py --tags @smoke --serve-report\n```\n\n---\n\n## 📊 Reporting\n\n### Allure Reports\n\n```bash\n# Generate and serve a report\npython run_tests.py --tags @smoke --serve-report\n\n# Or manually serve the existing report\nallure serve reports/allure-results\n```\n\n### Report Features\n\n- **📊 HTML Reports** - Detailed test results with trends\n- **📸 Screenshots** - Automatic capture on failures\n- **📋 Failing Scenarios** - Clear summary of failed tests\n- **📈 Trends** - Historical test execution data\n- **🔍 Detailed Analysis** - Step-by-step failure analysis\n\n### Report Structure\n\n```\nreports/\n├── allure-results/          # Allure report data\n│   ├── *.json               # Test results\n│   └── *.xml                # Test metadata\n├── screenshots/             # Failure screenshots\n│   └── screenshot_*.png     # Automatic screenshots\n│   └── ai-*.png             # AI screenshots\n└── workers/                 # Parallel execution logs\n    └── worker_*.log         # Worker-specific logs\n```\n\n### Best Practices\n\n1. **Keep selectors in page objects** - Centralized element management\n2. **Keep assertions in step definitions** - Test logic separation\n3. **Use Playwright's `expect()`** - Reliable assertions\n4. **Create reusable page methods** - Reduce code duplication\n\n--- \n## 🏷️ Tag Filtering\n\nAvailable tags in the framework:\n\n- `@smoke` - Quick validation tests\n- `@regression` - Comprehensive test suite\n- `@api` - API testing scenarios\n- `@performance` - Performance testing\n\n---\n\n## ⚙️ Code Organization\n\n1. **Keep step definitions focused**\n   ```python\n   @when(\"the user clicks the login button\")\n   def step_click_login(context):\n       login_page = context.page_factory.get_login_page(context.page)\n       login_page.click_login_button()\n   ```\n\n2. **Use page objects for interactions**\n   ```python\n   def click_login_button(self):\n       self.click_element(self.LOGIN_BUTTON)\n   ```\n\n3. **Use Playwright assertions**\n   ```python\n   expect(context.page).to_contain_text(\"Welcome\")\n   ```\n\n---\n\n## 🔍 Investigate Tracing\n```bash\n# Install Playwright trace viewer\nnpx playwright show-trace reports/traces/FILE_NAME.zip\n\n# Or use the web interface\nnpx playwright show-trace --host 0.0.0.0 --port 8080 reports/traces/FILE_NAME.zip\n```\n---\n\n## 📄 Log Files\n\nCheck log files for detailed error information:\n\n- `reports/test.log` - Detailed test execution logs\n- `reports/workers/` - Parallel execution logs\n- `reports/traces/` - Tracing reports\n\n### AI Selector Healing Logs\n\nMonitor AI selector healing activities:\n\n- `selector_map.json` - Historical selector mappings and AI suggestions\n- `selector_log.json` - Detailed AI interaction logs with confidence scores\n- `reports/screenshots/ai-*.png` - Screenshots captured for AI analysis\n- Console output - Real-time AI healing notifications with emojis\n\n---\n\n*Built with ❤️ using Python, Playwright, Behave, Allure, and AI-powered selector healing*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashant1507%2Fplaywright-behave-allure-ai-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprashant1507%2Fplaywright-behave-allure-ai-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprashant1507%2Fplaywright-behave-allure-ai-framework/lists"}