name: Flask API Runtime Test
on:
  schedule:
    - cron: '0 0 */3 * *'
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ['3.10']

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Debug directory structure
        run: |
          echo "Current directory: $(pwd)"
          ls -la

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Install dependencies
        run: |
          cd conversational_agents/chatbot_fullstack_runtime/backend
          pip install --upgrade pip
          pip install -r requirements.txt
          pip install pytest pytest-asyncio

      - name: Run tests
        run: |
          python -m pytest tests/conversational_agents_chatbot_fullstack_runtime_webserver_test.py -v