|
1 | 1 | # Cypress E2E Tests |
2 | 2 | # |
3 | | -# Single job: builds the Decision Engine, starts all services, runs all specs. |
| 3 | +# Single job, three parallel workers (background processes). |
| 4 | +# Mirrors `just cypress-parallel` locally — same split, same runner. |
| 5 | +# |
| 6 | +# Workers: |
| 7 | +# worker-1 — general UI specs |
| 8 | +# worker-2 — euclid rule-builder specs |
| 9 | +# worker-3 — API specs |
4 | 10 | # |
5 | 11 | # Caching layers: |
6 | 12 | # - Docker BuildKit layers → GHA cache, scoped per branch. |
@@ -110,43 +116,37 @@ jobs: |
110 | 116 | BASE_URL: http://localhost:8080 |
111 | 117 | ADMIN_SECRET: test_admin |
112 | 118 |
|
113 | | - # ── Start UI dev server ─────────────────────────────────────────────── |
114 | | - # Use the Vite dev server, NOT vite build + vite preview. |
115 | | - # |
116 | | - # vite preview has no proxy, so API calls from the browser go directly to |
117 | | - # http://localhost:8080 — a different origin (cross-origin from port 5173). |
118 | | - # The decision engine does not emit CORS headers for localhost:5173, so the |
119 | | - # browser blocks every API call and the app renders blank. |
120 | | - # |
121 | | - # The Vite dev server proxies /decision-engine-api/* → http://localhost:8080 |
122 | | - # (same origin, no CORS). It also uses base '/' so routes are at the root — |
123 | | - # no /decision-engine prefix in CYPRESS_UI_BASE_URL needed. |
124 | | - - name: Start UI dev server |
125 | | - run: npx vite --port 5173 & |
| 119 | + # ── Build + serve UI ───────────────────────────────────────────────── |
| 120 | + # Build first so import/compile errors (e.g. missing React hooks) fail |
| 121 | + # fast with a clear message before Cypress even starts. |
| 122 | + # vite preview has a proxy configured in vite.config.ts (same routes as |
| 123 | + # the dev server), so API calls are forwarded to http://localhost:8080 |
| 124 | + # without CORS issues. |
| 125 | + - name: Build UI |
| 126 | + run: npx vite build |
| 127 | + working-directory: website |
| 128 | + |
| 129 | + - name: Start UI preview server |
| 130 | + run: npx vite preview --port 5173 --host & |
126 | 131 | working-directory: website |
127 | 132 |
|
128 | 133 | - name: Wait for UI |
129 | 134 | run: | |
130 | 135 | timeout 60 bash -c \ |
131 | 136 | 'until curl -sf http://localhost:5173; do sleep 2; done' |
132 | 137 |
|
133 | | - # ── Run all Cypress specs ───────────────────────────────────────────── |
134 | | - # Includes: all UI tests + all API tests. |
135 | | - # Excludes: cypress/e2e/runtime/ — runtime-smoke.cy.js calls |
136 | | - # waitForRuntimeSurface() which requires the Mintlify docs server. |
137 | | - # Mintlify is only present in the dashboard-* compose profiles, |
138 | | - # not in postgres-local. Add it here if that profile is adopted. |
| 138 | + - name: Install just |
| 139 | + run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin |
| 140 | + |
| 141 | + # ── Run all Cypress specs across 3 parallel workers ─────────────────── |
| 142 | + # Delegates to `just cypress-parallel` — identical to local runs. |
139 | 143 | - name: Run Cypress |
140 | | - run: | |
141 | | - npx cypress run \ |
142 | | - --spec "cypress/e2e/ui/**/*.cy.js,cypress/e2e/api/**/*.cy.js" \ |
143 | | - --headless |
| 144 | + run: just cypress-parallel |
144 | 145 | env: |
145 | 146 | CYPRESS_API_BASE_URL: http://localhost:8080 |
146 | 147 | CYPRESS_UI_BASE_URL: http://localhost:5173 |
147 | 148 | CYPRESS_RUNTIME_MODE: ci |
148 | 149 |
|
149 | | - |
150 | 150 | - name: Upload screenshots on failure |
151 | 151 | uses: actions/upload-artifact@v4 |
152 | 152 | if: failure() |
|
0 commit comments