|
| 1 | +# flutter-skill CI/CD — AI E2E Testing |
| 2 | +# Add this to .github/workflows/e2e-test.yml |
| 3 | +# |
| 4 | +# Zero test code needed — AI tests your app automatically. |
| 5 | +# Just describe what to test in the TEST_PROMPT. |
| 6 | + |
| 7 | +name: AI E2E Tests |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: [main] |
| 12 | + pull_request: |
| 13 | + branches: [main] |
| 14 | + |
| 15 | +env: |
| 16 | + # Describe your test in natural language |
| 17 | + TEST_PROMPT: | |
| 18 | + Test the login flow: |
| 19 | + 1. Find the email input and enter "test@example.com" |
| 20 | + 2. Find the password input and enter "password123" |
| 21 | + 3. Tap the login button |
| 22 | + 4. Verify the dashboard appears |
| 23 | +
|
| 24 | +jobs: |
| 25 | + e2e-web: |
| 26 | + name: Web E2E Tests |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Setup Dart |
| 32 | + uses: dart-lang/setup-dart@v1 |
| 33 | + |
| 34 | + - name: Install flutter-skill |
| 35 | + run: dart pub global activate flutter_skill |
| 36 | + |
| 37 | + - name: Start app (customize this) |
| 38 | + run: | |
| 39 | + # Example: npm start, flutter run -d chrome, python -m http.server |
| 40 | + npm start & |
| 41 | + sleep 5 |
| 42 | + working-directory: ./my-app |
| 43 | + |
| 44 | + - name: Run AI E2E tests |
| 45 | + run: | |
| 46 | + flutter-skill serve http://localhost:3000 --headless --port=3001 & |
| 47 | + sleep 5 |
| 48 | +
|
| 49 | + # Discover available tools |
| 50 | + curl -s http://localhost:3001/tools/list | jq '.tools | length' |
| 51 | +
|
| 52 | + # Take snapshot to verify page loaded |
| 53 | + curl -s http://localhost:3001/snapshot | jq '.snapshot' | head -20 |
| 54 | +
|
| 55 | + # Run test via MCP (works with any MCP-compatible AI) |
| 56 | + # Or call tools directly: |
| 57 | + curl -s -X POST http://localhost:3001/tools/call \ |
| 58 | + -H "Content-Type: application/json" \ |
| 59 | + -d '{"name":"fill_email","arguments":{"text":"test@example.com"}}' |
| 60 | +
|
| 61 | + curl -s -X POST http://localhost:3001/tools/call \ |
| 62 | + -H "Content-Type: application/json" \ |
| 63 | + -d '{"name":"tap_login","arguments":{}}' |
| 64 | +
|
| 65 | + # Verify result |
| 66 | + curl -s http://localhost:3001/snapshot | jq '.snapshot' | grep -i "dashboard" |
| 67 | +
|
| 68 | + e2e-flutter: |
| 69 | + name: Flutter E2E Tests |
| 70 | + runs-on: ubuntu-latest |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v4 |
| 73 | + |
| 74 | + - name: Setup Flutter |
| 75 | + uses: subosito/flutter-action@v2 |
| 76 | + with: |
| 77 | + channel: stable |
| 78 | + |
| 79 | + - name: Install flutter-skill |
| 80 | + run: dart pub global activate flutter_skill |
| 81 | + |
| 82 | + - name: Run Flutter web app |
| 83 | + run: | |
| 84 | + flutter run -d chrome --web-port=3000 & |
| 85 | + sleep 30 # Flutter web build takes time |
| 86 | +
|
| 87 | + - name: Run tests |
| 88 | + run: | |
| 89 | + flutter-skill test http://localhost:3000 & |
| 90 | + sleep 5 |
| 91 | + # Use MCP server at default port |
| 92 | +
|
| 93 | + e2e-electron: |
| 94 | + name: Electron E2E Tests |
| 95 | + runs-on: ubuntu-latest |
| 96 | + steps: |
| 97 | + - uses: actions/checkout@v4 |
| 98 | + |
| 99 | + - name: Setup Node.js |
| 100 | + uses: actions/setup-node@v4 |
| 101 | + with: |
| 102 | + node-version: '20' |
| 103 | + |
| 104 | + - name: Install dependencies |
| 105 | + run: npm install |
| 106 | + |
| 107 | + - name: Add flutter-skill SDK |
| 108 | + run: npm install flutter-skill |
| 109 | + |
| 110 | + - name: Start Electron app |
| 111 | + run: | |
| 112 | + npx electron . & |
| 113 | + sleep 5 |
| 114 | +
|
| 115 | + - name: Run tests via bridge |
| 116 | + run: | |
| 117 | + flutter-skill server & |
| 118 | + sleep 3 |
| 119 | + # flutter-skill auto-discovers the running Electron app |
| 120 | +
|
| 121 | + e2e-mobile: |
| 122 | + name: Mobile E2E Tests (Android) |
| 123 | + runs-on: ubuntu-latest |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@v4 |
| 126 | + |
| 127 | + - name: Setup Java |
| 128 | + uses: actions/setup-java@v4 |
| 129 | + with: |
| 130 | + distribution: 'temurin' |
| 131 | + java-version: '17' |
| 132 | + |
| 133 | + - name: Setup Android SDK |
| 134 | + uses: android-actions/setup-android@v3 |
| 135 | + |
| 136 | + - name: Start Android emulator |
| 137 | + uses: reactivecircus/android-emulator-runner@v2 |
| 138 | + with: |
| 139 | + api-level: 34 |
| 140 | + arch: x86_64 |
| 141 | + script: | |
| 142 | + # Install and launch app |
| 143 | + adb install app-debug.apk |
| 144 | + adb shell am start -n com.example.app/.MainActivity |
| 145 | + sleep 10 |
| 146 | +
|
| 147 | + # flutter-skill auto-discovers via bridge |
| 148 | + dart pub global activate flutter_skill |
| 149 | + flutter-skill server & |
| 150 | + sleep 3 |
0 commit comments