Skip to content

staging - playwright test execution #62

staging - playwright test execution

staging - playwright test execution #62

Workflow file for this run

name: Test Execution - Playwright
run-name: ${{ github.event_name == 'schedule' && 'staging' || inputs.env }} - playwright test execution
on:
schedule:
- cron: "30 5 * * 1-5"
workflow_dispatch:
inputs:
env:
description: Select Test Environment
type: choice
default: staging
options:
- staging
- prod
cli_args:
description: Additional CLI Arguments (--project "Google Chrome" / -g "Search User")
type: string
required: false
publish_report:
description: Publish Test Report
type: boolean
default: true
permissions:
id-token: write
contents: read
pages: write
env:
TESTENV: ${{ github.event_name == 'schedule' && 'staging' || inputs.env }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
ROLE_VAULT_ENCRYPTION_KEY: ${{ secrets.ROLE_VAULT_ENCRYPTION_KEY }}
PUBLISH_REPORT: ${{ github.event_name == 'schedule' && 'true' || inputs.publish_report }}
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 60
services:
mongo:
image: mongo:7.0
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --eval 'db.adminCommand(\"ping\")'"
--health-interval 10s
--health-timeout 5s
--health-retries 3
rolevault:
image: ghcr.io/nayeemjohny/rolevault:latest
env:
JWT_SECRET: ${{env.JWT_SECRET}}
TESTENV: ${{env.TESTENV}}
MONGODB_URI: mongodb://mongo:27017/${{env.TESTENV}}-rolevault-db
ports:
- 5000:5000
- 5001:5001
options: >-
--user root
steps:
- name: Checkout Test Repo
uses: actions/checkout@v5
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: PreTest - ESLint & TS Compile
run: npm run pretest
- name: Run Playwright tests
run: npx playwright test ${{ inputs.cli_args }}
- name: Generate Allure Report
if: success() || failure()
uses: NayeemJohnY/actions/allure-report-with-history@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
allure-results-dir: ./allure-results
allure-report-dir: ./allure-report
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-results
if-no-files-found: ignore
retention-days: 30
path: |
playwright-report
allure-report
screenshots
test-results
application-logs.log
network-reports
- name: Prepare GitHub Pages Content
id: prepare-pages
if: ${{ (success() || failure()) && env.PUBLISH_REPORT == 'true' }}
uses: NayeemJohnY/actions/prepare-github-pages@main
with:
allure-report-dir: ./allure-report
playwright-report-dir: ./playwright-report
- name: Deploy GitHub Pages
if: ${{ (success() || failure()) && steps.prepare-pages.outcome == 'success' && env.PUBLISH_REPORT == 'true' }}
uses: NayeemJohnY/actions/deploy-github-pages-site@main