Playwright E2E Tests #221
This file contains 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: Playwright E2E Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
project: | |
description: 'Select the Browser to be used for E2E Testing' | |
required: true | |
default: 'chromium_test_workflow' | |
type: choice | |
options: | |
- chromium_test_workflow | |
- firefox_test_workflow | |
- webkit_test_workflow | |
schedule: | |
- cron: "0 0,10,15,20 * * *" | |
jobs: | |
run-playwright-e2e: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Add Environment Variable To DependencyTrack Apiserver | |
run: | | |
cat <<EOF > docker-compose.override.yml | |
services: | |
apiserver: | |
environment: | |
ALPINE_BCRYPT_ROUNDS: "4" | |
EOF | |
- name: Start DependencyTrack | |
run: | | |
docker compose -f docker-compose.yml -f docker-compose.override.yml --profile demo up -d --pull always | |
- name: Generate Random UUID for password use | |
run: | | |
RANDOM_PASSWORD=$(uuidgen -r) | |
echo "::add-mask::$RANDOM_PASSWORD" # Mask the value | |
echo "RANDOM_PASSWORD=$RANDOM_PASSWORD" >> $GITHUB_ENV | |
- name: Install necessary playwright dependencies | |
run: | | |
npm ci | |
npx playwright install --with-deps | |
#- name: Wait for API server to respond (HTTP 200) | |
# run: | | |
# chmod +x ./scripts/check-api.sh | |
# ./scripts/check-api.sh | |
#- name: Wait for DependencyTrack to be ready | |
# run: | | |
# chmod +x ./scripts/check-dependencytrack.sh | |
# ./scripts/check-dependencytrack.sh | |
- name: Generate BDD Tests | |
run: npx bddgen | |
- name: Run Playwright tests | |
run: npx playwright test --project=${{ inputs.project || 'chromium_test_workflow' }} | |
- name: Upload test results | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: playwright-results | |
path: playwright-test-results/allure-results | |
publish-results: | |
needs: run-playwright-e2e | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Download test results | |
uses: actions/download-artifact@v4 | |
with: | |
name: playwright-results | |
path: playwright-test-results/allure-results | |
- name: Load test report history | |
uses: actions/checkout@v4 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: allure-report # branch-name to copy history from | |
path: latest-test-results | |
- name: Build test report | |
uses: simple-elf/[email protected] | |
if: always() | |
with: | |
gh_pages: latest-test-results | |
allure_history: allure-history # directory to publish | |
allure_results: playwright-test-results/allure-results | |
- name: Publish test report | |
uses: peaceiris/actions-gh-pages@v4 | |
if: always() | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: allure-report # branch-name to paste history to | |
publish_dir: allure-history # directory to publish | |
# destination_dir: docs/allure/ # directory to publish into |