test: add comprehensive tests for capture module #30
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| # Fast unit tests + lint (no browser required) | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev,cli]" | |
| - name: Lint with ruff | |
| run: ruff check . | |
| - name: Run unit tests | |
| run: pytest -m "not integration" --cov=har_capture --cov-report=term-missing | |
| # Full test suite with Playwright - uploads combined coverage | |
| coverage: | |
| runs-on: ubuntu-latest | |
| needs: test # Only run if unit tests pass | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev,cli,capture]" | |
| - name: Install Playwright browsers | |
| run: playwright install chromium --with-deps | |
| - name: Run unit tests with coverage | |
| run: pytest -m "not integration" --cov=har_capture --cov-report= | |
| - name: Run integration tests with coverage (append) | |
| run: pytest -m "integration" --cov=har_capture --cov-append --cov-report=xml -v | |
| - name: Upload combined coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| fail_ci_if_error: false |