Skip to content

Commit f60a075

Browse files
Frooodlejbrunton96
andauthored
Add Playwright/bootRun/test.sh tasks (Stirling-Tools#6244)
## Description Consolidates Playwright running under cohesive Task namespaces, isolates Playwright state from the developer's local working tree, and swaps CI's frontend webserver from `vite` dev to `vite preview` against a pre-built `dist/`. ### `e2e:*` namespace Renames `.taskfiles/testing.yml` to `.taskfiles/e2e.yml` and consolidates everything Playwright-related under one `e2e:` namespace: - `e2e:stubbed` / `e2e:live` / `e2e:enterprise` / `e2e:cross-browser`: project-specific runners - `e2e:check` (no-Docker subset) and `e2e:check:all` (full) - `e2e:oauth:up` / `:down`, `e2e:saml:up` / `:down`: symmetric lifecycle for the keycloak compose stacks - `e2e:install`: Playwright browser install - `docker:test`: full Docker integration suite The redundant `frontend:test:e2e:*` project shortcuts are removed. CI workflows (`e2e-stubbed.yml`, `e2e-live.yml`, `build-enterprise.yml`, `nightly.yml`) are updated to call the new task names. ### Isolated Playwright state New `STIRLING_BASE_PATH` (and `-Dstirling.base-path=`) override in `InstallationPathConfig` redirects the entire state tree (configs, backups, customFiles, pipeline, logs) at startup. `task e2e:live` points it at `.test-state/playwright/` (purged on every invocation) so the suite never touches the developer's local DB, settings.yml or backups. `task e2e:live` auto-spawns gradle, waits for `/api/v1/info/status` to come up, runs Playwright, then tears down the whole backend process tree. ### CI runs Playwright against `vite preview` Builds the frontend up-front with `VITE_BUILD_FOR_PREVIEW=1` (forces absolute base so deep SPA routes resolve `/assets/...`) and the playwright `webServer` now uses `vite preview --port 5173 --strictPort` in CI. Avoids the per-page on-demand transform cost that was blowing the 30s navigation timeout under `--workers=3` on `all-tool-pages-load.spec.ts`. Local dev keeps `vite` dev for HMR. ### OAuth/SAML compose helpers `start-oauth-test.sh` and `start-saml-test.sh` gain a `--license-key <KEY>` (`-k`) flag so CI and scripted runs can skip the interactive license prompt. `start-oauth-test.sh` also moves from `for arg in "$@"` to a `while`-with-`shift` arg loop to support multi-arg flags consistently with the SAML script. ### Backend gradlew unification Drops the per-platform `cmd /c gradlew.bat` branches from `backend.yml` and routes every gradle invocation through `bash gradlew`. Works uniformly on Linux/macOS and Windows-with-Git-Bash. ### Compare.tsx flake fix (re-land of [Stirling-Tools#6316](Stirling-Tools#6316)) Piggybacks Anthony's never-merged fix from Stirling-Tools#6316. Without it, `e2e:stubbed` continues to flake under `--workers=3` on `compare.spec.ts`'s second-upload case via a React "Maximum update depth exceeded" infinite loop in the Compare auto-fill effect. CI traces from recent failed runs match exactly; 10 local runs of `compare.spec.ts` with `CI=1 --workers=3` pass cleanly with the fix applied. --------- Co-authored-by: James Brunton <jbrunton96@gmail.com>
1 parent c059e13 commit f60a075

16 files changed

Lines changed: 399 additions & 152 deletions

File tree

.github/workflows/build-enterprise.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ jobs:
6363
- name: Install Task
6464
uses: go-task/setup-task@3be4020d41929789a01026e0e427a4321ce0ad44 # v2.0.0
6565
- name: Install Playwright (chromium only)
66-
run: task frontend:test:e2e:install -- chromium
66+
run: task e2e:install -- chromium
67+
- name: Build frontend (needed for playwright's vite preview webServer)
68+
# Enterprise tests target :8080 (Spring Boot's bundled frontend), but
69+
# playwright's webServer config still launches `vite preview --port 5173`
70+
# before any test run, which needs dist/ to exist. VITE_BUILD_FOR_PREVIEW
71+
# forces absolute asset paths so vite preview can serve deep SPA routes.
72+
env:
73+
VITE_BUILD_FOR_PREVIEW: "1"
74+
run: task frontend:build
6775

6876
- name: Resolve kubernetes.docker.internal to localhost
6977
# The compose stacks set KC_HOSTNAME=kubernetes.docker.internal so
@@ -140,7 +148,7 @@ jobs:
140148
wait_for_backend
141149
- name: Run enterprise OAuth Playwright tests
142150
id: oauth-tests
143-
run: task frontend:test:e2e -- --project=enterprise --grep "OAuth"
151+
run: task e2e:enterprise -- --grep "OAuth"
144152
- name: Stop backend + tear down OAuth Keycloak
145153
if: always()
146154
run: |
@@ -213,7 +221,7 @@ jobs:
213221
wait_for_backend
214222
- name: Run enterprise SAML Playwright tests
215223
id: saml-tests
216-
run: task frontend:test:e2e -- --project=enterprise --grep "SAML"
224+
run: task e2e:enterprise -- --grep "SAML"
217225
- name: Stop backend + tear down SAML Keycloak
218226
if: always()
219227
run: |
@@ -243,7 +251,7 @@ jobs:
243251
wait_for_backend
244252
- name: Run enterprise feature Playwright tests
245253
id: feature-tests
246-
run: task frontend:test:e2e -- --project=enterprise --grep "Enterprise license"
254+
run: task e2e:enterprise -- --grep "Enterprise license"
247255
- name: Print backend log on failure
248256
if: failure()
249257
run: |

.github/workflows/e2e-live.yml

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -34,58 +34,26 @@ jobs:
3434
- name: Install Task
3535
uses: go-task/setup-task@3be4020d41929789a01026e0e427a4321ce0ad44 # v2.0.0
3636
- name: Install Playwright (chromium only)
37-
run: task frontend:test:e2e:install -- chromium
38-
- name: Start Spring Boot backend (background)
37+
run: task e2e:install -- chromium
38+
- name: Build frontend (production bundle for vite preview)
3939
env:
40-
# Suppress the analytics opt-in modal that fires on first admin login when
41-
# enableAnalytics is null (see Onboarding.tsx). The modal renders a Mantine
42-
# overlay that intercepts pointer events on every tool page until dismissed,
43-
# which causes every "click run button" assertion in the live suite to fail.
44-
SYSTEM_ENABLEANALYTICS: "false"
45-
# NOTE: SECURITY_INITIALLOGIN_USERNAME/PASSWORD are intentionally NOT set.
46-
# The live-setup project's bootstrap spec performs the real first-login
47-
# flow against the backend's default admin/stirling user, exercising the
48-
# forced-password-change UI and leaving the DB at admin/adminadmin for
49-
# the rest of the live suite. This is both real coverage of the first-
50-
# login flow and a stronger seed than env-var-driven user creation.
51-
run: |
52-
nohup ./gradlew :stirling-pdf:bootRun > /tmp/backend.log 2>&1 &
53-
echo $! > /tmp/backend.pid
54-
- name: Wait for backend to become ready
55-
run: |
56-
start=$SECONDS
57-
# 300 iterations × 2s = 10 minute ceiling
58-
for i in $(seq 1 300); do
59-
if curl -fsS http://localhost:8080/api/v1/info/status >/dev/null 2>&1; then
60-
echo "Backend up after $((SECONDS - start))s"
61-
exit 0
62-
fi
63-
sleep 2
64-
done
65-
echo "Backend did not become ready in $((SECONDS - start))s"
66-
tail -200 /tmp/backend.log || true
67-
exit 1
40+
VITE_BUILD_FOR_PREVIEW: "1"
41+
run: task frontend:build
6842
- name: Run live E2E tests (chromium)
6943
id: live-tests
70-
run: task frontend:test:e2e -- --project=live
44+
run: task e2e:live
7145
- name: Print backend log on failure
7246
if: failure() && steps.live-tests.conclusion == 'failure'
7347
run: |
7448
echo "::group::Spring Boot backend log (last 500 lines)"
75-
tail -500 /tmp/backend.log || echo "no backend log found"
49+
tail -500 .test-state/playwright/backend.log || echo "no backend log found"
7650
echo "::endgroup::"
77-
- name: Stop backend
78-
if: always()
79-
run: |
80-
if [ -f /tmp/backend.pid ]; then
81-
kill "$(cat /tmp/backend.pid)" 2>/dev/null || true
82-
fi
8351
- name: Upload backend log
8452
if: always()
8553
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
8654
with:
8755
name: backend-log-live-${{ github.run_id }}
88-
path: /tmp/backend.log
56+
path: .test-state/playwright/backend.log
8957
retention-days: 7
9058
- name: Upload Playwright report
9159
if: always()

.github/workflows/e2e-stubbed.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ jobs:
2828
- name: Install Task
2929
uses: go-task/setup-task@3be4020d41929789a01026e0e427a4321ce0ad44 # v2.0.0
3030
- name: Install Playwright (chromium only)
31-
run: task frontend:test:e2e:install -- chromium
31+
run: task e2e:install -- chromium
32+
- name: Build frontend (production bundle for vite preview)
33+
env:
34+
VITE_BUILD_FOR_PREVIEW: "1"
35+
run: task frontend:build
3236
- name: Run stubbed E2E tests (chromium)
33-
run: task frontend:test:e2e -- --project=stubbed --workers=3
37+
run: task e2e:stubbed -- --workers=3
3438
- name: Upload Playwright report
3539
if: always()
3640
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
- name: Install Task
3636
uses: go-task/setup-task@3be4020d41929789a01026e0e427a4321ce0ad44 # v2.0.0
3737
- name: Install all Playwright browsers
38-
run: task frontend:test:e2e:install
38+
run: task e2e:install
3939

4040
- name: Run E2E tests (all browsers)
41-
run: task frontend:test:e2e
41+
run: task e2e:cross-browser
4242

4343
- name: Upload Playwright report
4444
if: always()

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ exampleYmlFiles/stirling/
3232
/testing/cucumber/junit/
3333
/testing/cucumber/report.html
3434
/testing/.failed_tests
35+
/.test-state/
3536
SwaggerDoc.json
3637

3738
# Runtime storage for uploaded files and user data (not Java source code)

.taskfiles/backend.yml

Lines changed: 21 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
version: '3'
22

3+
# All gradle invocations go through `bash gradlew` (the sh wrapper) so they work
4+
# uniformly on Linux/macOS (native bash) and Windows-with-Git-Bash.
5+
36
tasks:
47
dev:
58
desc: "Start backend dev server"
@@ -10,58 +13,43 @@ tasks:
1013
env:
1114
SERVER_PORT: '{{.PORT}}'
1215
cmds:
13-
- cmd: '{{if .AIENGINE_URL}}set "AIENGINE_URL={{.AIENGINE_URL}}" && set "AIENGINE_ENABLED=true" && {{end}}cmd /c gradlew.bat :stirling-pdf:bootRun'
14-
platforms: [windows]
15-
- cmd: '{{if .AIENGINE_URL}}AIENGINE_URL={{.AIENGINE_URL}} AIENGINE_ENABLED=true {{end}}./gradlew :stirling-pdf:bootRun'
16-
platforms: [linux, darwin]
16+
- '{{if .AIENGINE_URL}}AIENGINE_URL={{.AIENGINE_URL}} AIENGINE_ENABLED=true {{end}}bash gradlew :stirling-pdf:bootRun'
17+
18+
dev:bundled:
19+
desc: "Clean + bootRun with frontend bundled into the backend (single :8080 server)"
20+
ignore_error: true
21+
cmds:
22+
- bash gradlew clean bootRun -PbuildWithFrontend=true
1723

1824
build:
1925
desc: "Full backend build"
2026
cmds:
21-
- cmd: cmd /c gradlew.bat clean build
22-
platforms: [windows]
23-
- cmd: ./gradlew clean build
24-
platforms: [linux, darwin]
27+
- bash gradlew clean build
2528

2629
build:fast:
2730
desc: "Build without tests"
2831
cmds:
29-
- cmd: cmd /c gradlew.bat clean build -x test
30-
platforms: [windows]
31-
- cmd: ./gradlew clean build -x test
32-
platforms: [linux, darwin]
32+
- bash gradlew clean build -x test
3333

3434
build:ci:
3535
desc: "Build for CI (formatting checked separately)"
3636
cmds:
37-
- cmd: cmd /c gradlew.bat build -PnoSpotless
38-
platforms: [windows]
39-
- cmd: ./gradlew build -PnoSpotless
40-
platforms: [linux, darwin]
37+
- bash gradlew build -PnoSpotless
4138

4239
test:
4340
desc: "Run backend tests"
4441
cmds:
45-
- cmd: cmd /c gradlew.bat test
46-
platforms: [windows]
47-
- cmd: ./gradlew test
48-
platforms: [linux, darwin]
42+
- bash gradlew test
4943

5044
format:
5145
desc: "Auto-fix code formatting"
5246
cmds:
53-
- cmd: cmd /c gradlew.bat spotlessApply
54-
platforms: [windows]
55-
- cmd: ./gradlew spotlessApply
56-
platforms: [linux, darwin]
47+
- bash gradlew spotlessApply
5748

5849
format:check:
5950
desc: "Check code formatting"
6051
cmds:
61-
- cmd: cmd /c gradlew.bat spotlessCheck
62-
platforms: [windows]
63-
- cmd: ./gradlew spotlessCheck
64-
platforms: [linux, darwin]
52+
- bash gradlew spotlessCheck
6553

6654
fix:
6755
desc: "Auto-fix backend"
@@ -71,10 +59,7 @@ tasks:
7159
swagger:
7260
desc: "Generate OpenAPI docs"
7361
cmds:
74-
- cmd: cmd /c gradlew.bat :stirling-pdf:copySwaggerDoc
75-
platforms: [windows]
76-
- cmd: ./gradlew :stirling-pdf:copySwaggerDoc
77-
platforms: [linux, darwin]
62+
- bash gradlew :stirling-pdf:copySwaggerDoc
7863
sources:
7964
- app/core/src/main/java/**/*.java
8065
- app/proprietary/src/main/java/**/*.java
@@ -92,31 +77,19 @@ tasks:
9277
desc: "Print project version"
9378
silent: true
9479
cmds:
95-
- cmd: cmd /c gradlew.bat printVersion --quiet | tail -1
96-
platforms: [windows]
97-
- cmd: ./gradlew printVersion --quiet | tail -1
98-
platforms: [linux, darwin]
80+
- bash gradlew printVersion --quiet | tail -1
9981

10082
licenses:check:
10183
desc: "Check dependency licenses"
10284
cmds:
103-
- cmd: cmd /c gradlew.bat checkLicense --no-parallel
104-
platforms: [windows]
105-
- cmd: ./gradlew checkLicense --no-parallel
106-
platforms: [linux, darwin]
85+
- bash gradlew checkLicense --no-parallel
10786

10887
licenses:generate:
10988
desc: "Check and generate dependency license report"
11089
cmds:
111-
- cmd: cmd /c gradlew.bat checkLicense generateLicenseReport --no-parallel
112-
platforms: [windows]
113-
- cmd: ./gradlew checkLicense generateLicenseReport --no-parallel
114-
platforms: [linux, darwin]
90+
- bash gradlew checkLicense generateLicenseReport --no-parallel
11591

11692
clean:
11793
desc: "Clean build artifacts"
11894
cmds:
119-
- cmd: cmd /c gradlew.bat clean
120-
platforms: [windows]
121-
- cmd: ./gradlew clean
122-
platforms: [linux, darwin]
95+
- bash gradlew clean

.taskfiles/docker.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,9 @@ tasks:
5555
desc: "Tail docker compose logs"
5656
cmds:
5757
- docker compose -f {{.COMPOSE_DIR}}/docker-compose.yml logs -f
58+
59+
test:
60+
desc: "Run full Docker integration test suite (builds all variants and tests them)"
61+
ignore_error: true
62+
cmds:
63+
- bash testing/test.sh {{.CLI_ARGS}}

0 commit comments

Comments
 (0)