diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e75a653..52a3bcb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,26 +1,68 @@ -name: UI tests +name: Playwright QA Automation on: push: + branches: [ "main", "master" ] pull_request: + branches: [ "main", "master" ] + workflow_dispatch: jobs: - pytest: + test: + name: UI Tests (Chromium) runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 with: python-version: "3.10" - cache: pip - - run: python -m pip install -r pyenv/requirements.txt - - run: python -m playwright install --with-deps chromium - - name: Run UI tests - run: mkdir -p reports && python -m pytest --html=reports/report.html --self-contained-html --junitxml=reports/junit.xml - - if: always() + cache: "pip" + + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r pyenv/requirements.txt + + - name: Install Playwright Browsers + run: python -m playwright install --with-deps chromium + + - name: Create Reports Directory + run: mkdir -p reports + + - name: Run Pytest Suite with Reports + run: | + python -m pytest \ + --html=reports/report.html \ + --self-contained-html \ + --junitxml=reports/junit.xml \ + -v + env: + CI: "true" + + - name: Upload Test Reports & HTML Dashboard + if: always() uses: actions/upload-artifact@v4 with: - name: test-reports-and-failures - path: | - reports/ - test-results/ + name: playwright-html-report + path: reports/ + retention-days: 30 + + - name: Upload Playwright Failure Traces & Screenshots + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-failure-artifacts + path: test-results/ + retention-days: 30 + + - name: Publish Test Summary + if: always() + run: | + echo "### Test Results Summary" >> $GITHUB_STEP_SUMMARY + if [ -f reports/junit.xml ]; then + echo "JUnit report generated successfully at \`reports/junit.xml\`." >> $GITHUB_STEP_SUMMARY + fi