|
| 1 | +# Workshop Test Automation |
| 2 | + |
| 3 | +A full-stack application for learning and practicing test automation, built with PocketBase backend and SvelteKit frontend. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) |
| 10 | +- Git |
| 11 | + |
| 12 | +### Running the Application |
| 13 | + |
| 14 | +1. **Clone the repository** |
| 15 | + ```bash |
| 16 | + git clone <repository-url> |
| 17 | + cd workshop-test-automation |
| 18 | + ``` |
| 19 | + |
| 20 | +2. **Start the application** |
| 21 | + ```bash |
| 22 | + docker compose up |
| 23 | + ``` |
| 24 | + |
| 25 | +3. **Access the application** |
| 26 | + - Frontend: http://localhost:3000 |
| 27 | + - Backend API: http://localhost:8080 |
| 28 | + - PocketBase Admin UI: http://localhost:8080/_/ |
| 29 | + |
| 30 | +The application will automatically build and start both services. The backend data will be persisted in `./backend/pb_data/`. |
| 31 | + |
| 32 | +### Stopping the Application |
| 33 | + |
| 34 | +```bash |
| 35 | +docker compose down |
| 36 | +``` |
| 37 | + |
| 38 | +## Development Mode |
| 39 | + |
| 40 | +For development with hot reloading and debugging: |
| 41 | + |
| 42 | +```bash |
| 43 | +docker compose -f compose.yaml -f compose.dev.yaml up |
| 44 | +``` |
| 45 | + |
| 46 | +This enables: |
| 47 | +- Volume mounts for live code changes |
| 48 | +- Access to migration and hook files |
| 49 | +- Development-friendly restart policies |
| 50 | + |
| 51 | +## Architecture |
| 52 | + |
| 53 | +- **Backend**: PocketBase (Go-based backend-as-a-service) |
| 54 | + - REST API with real-time subscriptions |
| 55 | + - Built-in admin dashboard |
| 56 | + - SQLite database |
| 57 | + - Runs on port 8080 |
| 58 | + |
| 59 | +- **Frontend**: SvelteKit application |
| 60 | + - Modern web framework with TypeScript |
| 61 | + - Tailwind CSS for styling |
| 62 | + - Form validation with Zod |
| 63 | + - Runs on port 3000 |
| 64 | + |
| 65 | +## Configuration |
| 66 | + |
| 67 | +### Environment Variables |
| 68 | + |
| 69 | +The application uses these environment variables: |
| 70 | + |
| 71 | +**Frontend**: |
| 72 | +- `PUBLIC_POCKETBASE_URL`: Backend API URL (default: `http://localhost:8080`) |
| 73 | + |
| 74 | +**Backend**: |
| 75 | +- `GOMEMLIMIT`: Memory limit for the Go application (default: `128MiB`) |
| 76 | + |
| 77 | +### Customizing Configuration |
| 78 | + |
| 79 | +To modify the configuration: |
| 80 | + |
| 81 | +1. Copy and edit the compose files |
| 82 | +2. Update environment variables as needed |
| 83 | +3. Restart the services |
| 84 | + |
| 85 | +## Troubleshooting |
| 86 | + |
| 87 | +### Common Issues |
| 88 | + |
| 89 | +**Port conflicts**: |
| 90 | +- If ports 3000 or 8080 are in use, modify the port mappings in `compose.yaml` |
| 91 | + |
| 92 | +**Permission issues**: |
| 93 | +- Ensure Docker has permission to create volumes in the project directory |
| 94 | +- On Linux, you may need to adjust file ownership: `sudo chown -R $USER:$USER backend/pb_data` |
| 95 | + |
| 96 | +**Database issues**: |
| 97 | +- Delete `backend/pb_data/` directory to reset the database |
| 98 | +- Restart the services |
| 99 | + |
| 100 | +### Viewing Logs |
| 101 | + |
| 102 | +```bash |
| 103 | +# All services |
| 104 | +docker compose logs -f |
| 105 | + |
| 106 | +# Specific service |
| 107 | +docker compose logs -f backend |
| 108 | +docker compose logs -f frontend |
| 109 | +``` |
| 110 | + |
| 111 | +## Data Persistence |
| 112 | + |
| 113 | +Application data is stored in: |
| 114 | +- `./backend/pb_data/` - Database and uploaded files |
| 115 | +- `./backend/pb_migrations/` - Database migrations (development) |
| 116 | +- `./backend/pb_hooks/` - Custom backend logic (development) |
| 117 | + |
| 118 | +## Support |
| 119 | + |
| 120 | +If you encounter issues: |
| 121 | + |
| 122 | +1. Check the logs using the commands above |
| 123 | +2. Ensure all prerequisites are installed |
| 124 | +3. Try rebuilding the containers: `docker compose up --build` |
| 125 | +4. Reset the database by removing `backend/pb_data/` directory |
0 commit comments