A professional-grade QA Automation framework for comprehensive testing of OpenWeatherMap services. This framework demonstrates advanced testing skills using Python, Pytest, and Playwright, supporting UI, API, E2E, and non-functional testing with full CI/CD integration.
- UI Testing: Browser automation with Playwright across multiple browsers
- API Testing: RESTful API testing using Playwright's APIRequestContext
- E2E Testing: Complete user journey validations
- Non-Functional Testing: Performance and accessibility testing
- Page Object Model: Maintainable and scalable UI test architecture
- Data-Driven Testing: Parameterized tests with multiple data sets
- Cross-Browser Testing: Support for Chromium, Firefox, and WebKit
- Parallel Execution: Fast test execution with pytest-xdist
- Rich Reporting: Allure reports with screenshots and videos
- CI/CD Integration: Full GitHub Actions pipeline
- Code Quality: Black formatting, Flake8 linting, MyPy type checking
- Test Coverage: Comprehensive coverage reporting
- Error Handling: Robust error handling and retry mechanisms
- Logging: Structured logging with color-coded output
- Python 3.11 or higher
- Git
- OpenWeatherMap API key (free at openweathermap.org)
-
Clone the repository
git clone https://github.com/username/openweathermap-qa-automation.git cd openweathermap-qa-automation -
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt playwright install
-
Environment setup
cp .env.example .env # Edit .env and add your OpenWeatherMap API key
Create a .env file in the project root:
OPENWEATHER_API_KEY=your_api_key_here
ENVIRONMENT=test
DEBUG=false
BROWSER_NAME=chromium
HEADLESS=true
UI_BASE_URL=https://openweathermap.orgpytest# UI Tests only
pytest tests/ui/ -m ui
# API Tests only
pytest tests/api/ -m api
# E2E Tests only
pytest tests/e2e/ -m e2e
# Performance Tests
pytest tests/non_functional/ -m performance# Critical tests only
pytest -m critical
# Smoke tests
pytest -m smoke# Run tests in parallel with 4 workers
pytest -n 4# Run UI tests in Firefox
pytest tests/ui/ --browser firefox
# Run in headed mode
pytest tests/ui/ --headed# Generate Allure report
allure serve reports/allure-results
# Generate static report
allure generate reports/allure-results -o reports/allure-report# Generate coverage report
pytest --cov=src --cov-report=html
# View coverage report
open reports/coverage/index.htmlopenweathermap-qa-automation/
βββ .cursor/ # Cursor IDE rules
βββ .github/workflows/ # GitHub Actions CI/CD
βββ docs/ # Project documentation
βββ reports/ # Test reports and artifacts
β βββ allure-results/
β βββ coverage/
β βββ html/
βββ src/ # Source code
β βββ api/ # API client modules
β βββ config/ # Configuration management
β βββ pages/ # Page Object Model classes
β βββ utils/ # Utility functions
βββ tests/ # Test suites
β βββ api/ # API tests
β βββ e2e/ # End-to-end tests
β βββ non_functional/ # Performance/accessibility tests
β βββ ui/ # UI tests
βββ pytest.ini # Pytest configuration
βββ pyproject.toml # Project configuration
βββ requirements.txt # Python dependencies
| Variable | Description | Default |
|---|---|---|
OPENWEATHER_API_KEY |
OpenWeatherMap API key | Required |
ENVIRONMENT |
Test environment | test |
BROWSER_NAME |
Browser for UI tests | chromium |
HEADLESS |
Run browser in headless mode | true |
UI_BASE_URL |
Base URL for UI testing | https://openweathermap.org |
PERFORMANCE_THRESHOLD_MS |
Performance threshold | 2000 |
| Marker | Description |
|---|---|
smoke |
Quick smoke tests |
regression |
Regression test suite |
ui |
UI tests |
api |
API tests |
e2e |
End-to-end tests |
performance |
Performance tests |
accessibility |
Accessibility tests |
critical |
Critical functionality tests |
slow |
Slow-running tests |
The framework tests the following OpenWeatherMap APIs:
- Current Weather:
/weather - 5-Day Forecast:
/forecast - Geocoding:
/geo/1.0/direct
- Valid city weather requests
- Invalid city handling
- Coordinates-based weather requests
- City ID-based weather requests
- API key validation
- Rate limiting tests
- Response schema validation
UI tests cover the OpenWeatherMap website functionality:
- Homepage navigation
- City search functionality
- Weather display validation
- Error handling for invalid cities
- Responsive design testing
- Cross-browser compatibility
The GitHub Actions pipeline includes:
-
Code Quality Checks
- Black code formatting
- Flake8 linting
- MyPy type checking
-
Test Execution
- Multi-browser testing
- Parallel test execution
- Coverage reporting
-
Reporting
- Allure report generation
- Test artifacts upload
- GitHub Pages deployment
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PEP 8 code style
- Add type hints to all functions
- Write comprehensive docstrings
- Include unit tests for new features
- Update documentation as needed
@pytest.mark.ui
@pytest.mark.smoke
@allure.title("Verify city search functionality")
async def test_city_search(weather_page):
await weather_page.navigate_to_weather_page()
await weather_page.search_for_city("London")
assert await weather_page.is_weather_info_displayed()@pytest.mark.api
@pytest.mark.regression
@allure.title("Get weather data for valid city")
async def test_get_weather_valid_city(weather_api):
response = await weather_api.get_current_weather("London")
assert response["status"] == 200
assert weather_api.validate_weather_response(response["data"])The framework includes basic performance testing:
- Response time validation
- Load time measurements
- Memory usage monitoring
- Network performance analysis
Accessibility tests ensure compliance with:
- WCAG 2.1 guidelines
- Screen reader compatibility
- Keyboard navigation
- Color contrast validation
- Browser Installation: Run
playwright installif browsers are missing - API Key: Ensure valid OpenWeatherMap API key in
.env - Dependencies: Update requirements with
pip install -r requirements.txt - Permissions: Check file permissions for report directories
# Run tests with debug logging
pytest --log-cli-level=DEBUG
# Run with video recording
pytest --video=on
# Run with headed browser
pytest --headedThis project is licensed under the MIT License - see the LICENSE file for details.
- OpenWeatherMap for providing the weather API
- Playwright for the excellent testing framework
- Pytest for the testing infrastructure
- Allure for beautiful test reporting
For questions and support:
- Create an issue
- Check the documentation
- Review test cases
Built with β€οΈ for QA Excellence