# ASF TestArena

A full-stack web application to manage automated software test jobs.

## Features
- **Login System**: Admin and User roles.
- **Dashboard**: Real-time job monitoring with WebSocket.
- **Job Submission**: Wizard to submit jobs based on git branches.
- **Results**: HTML reports generated and served automatically.
- **Cleanup**: Automatic deletion of results older than 7 days.

## Architecture
- **Backend**: FastAPI (Python)
- **Frontend**: React + Vite (TypeScript)
- **Database**: PostgreSQL
- **Reverse Proxy**: Caddy
- **Containerization**: Docker Compose

## Deployment Instructions

### Prerequisites
- Docker and Docker Compose installed on the server.
- Domain `testarena.nabd-co.com` pointing to the server IP.

### Steps
1. **Clone the repository** to your VPS.
   ```bash
   git clone <repo_url>
   cd testarena
   ```

2. **Configure Environment**
   - Edit `docker-compose.yml` if you need to change database passwords.
   - Edit `backend/app/auth.py` to change the `SECRET_KEY`.

3. **Run with Docker Compose**
   ```bash
   docker-compose up -d --build
   ```

4. **Verify**
   - Open `https://testarena.nabd-co.com` in your browser.
   - Login with default credentials:
     - Username: `admin`
     - Password: `admin123`

### Scripts Integration
- The mock scripts are located in `backend/scripts/`.
- Replace `get_scenarios.sh` and `run_tests.sh` with your actual implementation.
- Ensure the scripts are executable (`chmod +x`).

### Troubleshooting
- Check logs: `docker-compose logs -f`
- Restart services: `docker-compose restart`
