name: Playwright Tests
on:
  # push:
  #   branches: [ main, master ]
  # pull_request:
  #   branches: [ main, master ]
  workflow_dispatch:
    inputs:
      IMAGE_VER:
        description: "version for build image"
        type: string
# act workflow_dispatch --reuse -W .github/workflows/ui-tests.yaml 
jobs:
  test:
    env:
      working-directory: UI_tests
    # defaults:
    #   run:
    #     working-directory: ${{ env.working-directory }}
    timeout-minutes: 60
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: actions/setup-node@v3
      with:
        node-version: 20
    - name: test pwd
      run: ls
    - name: Install dependencies
      run: cd UI_Tests && npm ci
    - name: Install Playwright Browsers
      run: cd UI_Tests && npx playwright install --with-deps
    - name: Run Playwright tests
      run: cd UI_Tests && npx playwright test
    - uses: actions/upload-artifact@v3
      if: always()
      with:
        name: playwright-report
        path: UI_Tests/playwright-report/
        retention-days: 30