No description
|
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
|
||
|---|---|---|
| .woodpecker | ||
| android | ||
| integration_test | ||
| ios | ||
| lib | ||
| linux | ||
| macos | ||
| test | ||
| test_driver | ||
| ui_drafts | ||
| web | ||
| windows | ||
| .gitignore | ||
| .metadata | ||
| analysis_options.yaml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| pubspec.lock | ||
| pubspec.yaml | ||
| README.md | ||
WaiterOrder Frontend
Flutter web application for ordering waiters at restaurants.
🚀 Quick Start
Deploy to olli.info (default)
docker compose up -d
Frontend will be available at: http://localhost:16180
Default backend: https://waiterorderbackend.olli.info
Deploy with local backend
BACKEND_URL=http://localhost:16181 docker compose up -d
Local Testing (CI-style)
Run tests exactly as they run in CI:
# Format check
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "flutter pub get && dart format --set-exit-if-changed --output=none ."
# Lint check
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "flutter pub get && flutter analyze --fatal-infos"
# Unit/Widget tests
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "flutter pub get && flutter test"
# Build web
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "flutter pub get && flutter build web --release"
🐳 Docker Configuration
The docker-compose.yml file supports flexible backend configuration:
services:
frontend:
build:
context: .
args:
BACKEND_URL: ${BACKEND_URL:-https://waiterorderbackend.olli.info}
Usage examples:
# Production (olli.info backend - default)
docker compose up -d
# Local backend
BACKEND_URL=http://localhost:16181 docker compose up -d
# Custom backend
BACKEND_URL=https://custom-backend.example.com docker compose up -d
🔄 Update Deployment
# cd /mnt/Data/Apps/HM_SE/WaiterOrder/frontend
git pull
docker compose down
docker compose build --no-cache
docker compose up -d
🛠️ Environment Variables
BACKEND_URL- Backend API URL (default: https://waiterorderbackend.olli.info)
🔬 CI/CD
Mirror: https://git.olli.info/Oliver/WaiterOrder_Frontend
CI Pipeline: https://ci.olli.info/repos/2
Pipeline steps:
- Format check (
dart format --set-exit-if-changed) - Lint check (
flutter analyze --fatal-infos) - Unit/Widget tests (
flutter test) - Integration tests (Chrome + ChromeDriver)
- Web build (
flutter build web --release)
📁 Project Structure
frontend/
├── lib/
│ ├── main.dart # App entry point & main UI
│ ├── config/ # Configuration files
│ └── services/
│ └── api_service.dart # Backend API client & DTOs
├── test/
│ └── widget_test.dart # Unit/Widget tests
├── integration_test/
│ ├── integration_test.dart # Integration test suite
│ └── order_submission_test.dart # Order flow tests
├── web/ # Web-specific files
├── ui_drafts/ # Design assets
├── Dockerfile # Multi-stage Docker build
└── docker-compose.yml # Container orchestration
🧪 Development
Prerequisites
- Flutter SDK (stable channel)
- Dart SDK
- Chrome (for web testing)
- Docker (optional)
Run locally
# Install dependencies
flutter pub get
# Run in Chrome
flutter run -d chrome --web-port 8080
# Or run in your default browser
flutter run -d web-server --web-port 8080
Run tests
# Unit/Widget tests
flutter test
# Integration tests (requires backend running)
flutter drive --driver=test_driver/integration_test.dart \
--target=integration_test/integration_test.dart \
-d chrome
Format and lint code
# Auto-format code
dart format .
# Check formatting
dart format --set-exit-if-changed --output=none .
# Run linter
flutter analyze --fatal-infos
Development with Docker
# Build for development with default backend (creates build/web/)
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "flutter pub get && flutter build web"
# OR build with custom backend
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "flutter pub get && flutter build web --dart-define=BACKEND_URL=http://localhost:16181"
# Then serve the built app with Python
cd build/web && python3 -m http.server 8080 ; cd ../..
# Run all tests
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "flutter pub get && flutter test"
# Format code
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "dart format -o write ."
# Check formatting
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "dart format --set-exit-if-changed --output=none ."
# Run linter
docker run --rm -v "$PWD":/app -w /app ghcr.io/cirruslabs/flutter:stable sh -c "flutter pub get && flutter analyze"
# Run integration tests (exactly as CI does)
docker run --rm -v "$PWD":/workspace -w /workspace ghcr.io/cirruslabs/flutter:stable bash -c 'flutter pub get && chmod +x .woodpecker/frontend/ci_connect_and_run.sh && chmod +x .woodpecker/frontend/download_chromedriver.sh && apt-get update -qq && apt-get install -y -qq wget unzip xvfb jq curl && wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && apt-get install -y -qq ./google-chrome-stable_current_amd64.deb && rm google-chrome-stable_current_amd64.deb && .woodpecker/frontend/download_chromedriver.sh && .woodpecker/frontend/ci_connect_and_run.sh'
