Nightly Full E2E Tests #150
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Nightly Full E2E Tests | |
| # 真正的端到端测试:从用户界面到PPT导出 | |
| # 这个workflow运行完整的UI驱动E2E测试,验证用户完整流程 | |
| # | |
| # 触发时机: | |
| # 1. 每天凌晨2点自动运行(UTC时间) | |
| # 2. 手动触发(workflow_dispatch) | |
| # | |
| # 注意: | |
| # - 此测试需要10-20分钟 | |
| # - 需要真实AI API密钥 | |
| # - 需要前端和后端都运行 | |
| # - 不适合在PR阶段运行 | |
| on: | |
| schedule: | |
| # 每天UTC 2:00运行(北京时间10:00) | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: # 允许手动触发 | |
| inputs: | |
| skip_ui_e2e: | |
| description: 'Skip UI-driven E2E tests' | |
| required: false | |
| default: 'false' | |
| type: boolean | |
| jobs: | |
| true-e2e-test: | |
| name: True E2E Test (UI-driven) | |
| runs-on: ubuntu-latest | |
| if: github.event.inputs.skip_ui_e2e != 'true' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies and Playwright | |
| run: | | |
| cd frontend | |
| npm ci | |
| npx playwright install --with-deps chromium | |
| - name: Setup environment variables | |
| run: | | |
| chmod +x scripts/setup-env-from-secrets.sh | |
| ./scripts/setup-env-from-secrets.sh | |
| env: | |
| AI_PROVIDER_FORMAT: gemini | |
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
| GOOGLE_API_BASE: ${{ secrets.GOOGLE_API_BASE }} | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE }} | |
| TEXT_MODEL: ${{ secrets.TEXT_MODEL }} | |
| IMAGE_MODEL: ${{ secrets.IMAGE_MODEL }} | |
| LOG_LEVEL: ${{ secrets.LOG_LEVEL }} | |
| FLASK_ENV: ${{ secrets.FLASK_ENV }} | |
| SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
| PORT: ${{ secrets.PORT }} | |
| CORS_ORIGINS: ${{ secrets.CORS_ORIGINS }} | |
| MAX_DESCRIPTION_WORKERS: ${{ secrets.MAX_DESCRIPTION_WORKERS }} | |
| MAX_IMAGE_WORKERS: ${{ secrets.MAX_IMAGE_WORKERS }} | |
| MINERU_TOKEN: ${{ secrets.MINERU_TOKEN }} | |
| MINERU_API_BASE: ${{ secrets.MINERU_API_BASE }} | |
| IMAGE_CAPTION_MODEL: ${{ secrets.IMAGE_CAPTION_MODEL }} | |
| OUTPUT_LANGUAGE: ${{ secrets.OUTPUT_LANGUAGE }} | |
| - name: Build Docker images | |
| run: | | |
| docker compose build --no-cache | |
| - name: Start services | |
| run: | | |
| docker compose up -d | |
| echo "Waiting for services to be ready..." | |
| sleep 30 | |
| - name: Health check | |
| run: | | |
| for i in {1..30}; do | |
| if curl -f http://localhost:5000/health && curl -f http://localhost:3000; then | |
| echo "Services are ready" | |
| break | |
| fi | |
| echo "Waiting for services... ($i/30)" | |
| sleep 2 | |
| done | |
| - name: Run UI-driven E2E tests | |
| run: | | |
| echo "Running UI-driven E2E tests (10-20 minutes)..." | |
| cd frontend | |
| npx playwright test ui-full-flow.spec.ts --workers=1 | |
| env: | |
| CI: true | |
| timeout-minutes: 25 | |
| continue-on-error: false | |
| - name: Upload test report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ui-e2e-report | |
| path: frontend/playwright-report/ | |
| retention-days: 7 | |
| - name: Upload screenshots | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ui-e2e-screenshots | |
| path: frontend/test-results/ | |
| retention-days: 7 | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| docker compose down -v | |