name: "E2E: Manual suite"
on:
  workflow_dispatch:
    inputs:
      test_suite:
        description: 'Select test suite to run'
        default: 'manual'
        required: true
        type: choice
        options:
          - manual
          - qase
      qase_token:
        description: 'Set Qase token to enable integration'
        required: true
        type: string

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          ref: ${{ github.sha }}
      - name: Set up environment
        id: set_env_values
        run: |
          cat "./kafka-ui-e2e-checks/.env.ci" >> "./kafka-ui-e2e-checks/.env"
      - name: Set up JDK
        uses: actions/setup-java@v3
        with:
          java-version: '17'
          distribution: 'zulu'
          cache: 'maven'
      - name: Build with Maven
        id: build_app
        run: |
          ./mvnw -B -ntp versions:set -DnewVersion=${{ github.sha }}
          ./mvnw -B -V -ntp clean install -Pprod -Dmaven.test.skip=true ${{ github.event.inputs.extraMavenOptions }}
      - name: Run test suite
        run: |
          ./mvnw -B -ntp versions:set -DnewVersion=${{ github.sha }}
          ./mvnw -B -V -ntp -DQASEIO_API_TOKEN=${{ github.event.inputs.qase_token }} -Dsurefire.suiteXmlFiles='src/test/resources/${{ github.event.inputs.test_suite }}.xml' -Dsuite=${{ github.event.inputs.test_suite }} -f 'kafka-ui-e2e-checks' test -Pprod
