33# CI groups, which reuse the production build from `e2e-build`.
44# The job extracts it into apps/sim/.next before running these suites.
55#
6- # Usage: http-e2e.sh <scim|cli|stop-after|desktop-inbox|assistant-actions|organization-search|browser-extension|browser-extension-native|browser-extension-navigation|browser-extension-composer|browser-extension-access|project-files|mobile|seo> (run from apps/sim)
6+ # Usage: http-e2e.sh <scim|cli|stop-after|desktop-inbox|assistant-actions|organization-search|browser-extension|browser-extension-native|browser-extension-navigation|browser-extension-composer|browser-extension-access|project-files|mobile|seo|platform-live-zone|platform-live-flag-off > (run from apps/sim)
77#
88# The job provides DATABASE_URL, BETTER_AUTH_SECRET and ENCRYPTION_KEY; each group sets the rest of
99# its app's environment here. Reports and server logs land in $RUNNER_TEMP/e2e.
2020# telemetry flush runs detached and still writes .next/dev).
2121set -euo pipefail
2222
23- group=${1:? usage: http-e2e.sh <scim|cli|stop-after|desktop-inbox|assistant-actions|organization-search|browser-extension|browser-extension-native|browser-extension-navigation|browser-extension-composer|browser-extension-access|project-files|mobile|seo>}
23+ group=${1:? usage: http-e2e.sh <scim|cli|stop-after|desktop-inbox|assistant-actions|organization-search|browser-extension|browser-extension-native|browser-extension-navigation|browser-extension-composer|browser-extension-access|project-files|mobile|seo|platform-live-zone|platform-live-flag-off >}
2424report_dir=" $RUNNER_TEMP /e2e"
2525ready_timeout_seconds=600
2626mkdir -p " $report_dir "
@@ -32,6 +32,10 @@ status_log=''
3232realtime_pid=' '
3333realtime_tag=' '
3434realtime_log=' '
35+ platform_pid=' '
36+ platform_tag=' '
37+ platform_log=' '
38+ agent_pid=' '
3539browsers_pid=' '
3640local_app_url=' '
3741# `dev` or `start`; a group sets it before start_app.
@@ -63,6 +67,17 @@ finish() {
6367 tail -n 100 " $realtime_log "
6468 fi
6569 fi
70+ if [ -n " $platform_pid " ]; then
71+ bash " $GITHUB_WORKSPACE /.github/scripts/stop-session.sh" " $platform_pid " " $platform_tag " || status=1
72+ wait " $platform_pid " 2> /dev/null || true
73+ if [ " $status " -ne 0 ]; then
74+ tail -n 100 " $platform_log "
75+ fi
76+ fi
77+ if [ -n " $agent_pid " ]; then
78+ kill " $agent_pid " 2> /dev/null || true
79+ wait " $agent_pid " 2> /dev/null || true
80+ fi
6681 if [ -n " $browsers_pid " ]; then
6782 kill -- " -$browsers_pid " 2> /dev/null || true
6883 wait " $browsers_pid " 2> /dev/null || true
@@ -133,6 +148,72 @@ start_realtime() {
133148 wait_ready " $realtime_pid " " http://127.0.0.1:$port /health" " $name realtime server"
134149}
135150
151+ # stop_app: stops the app start_app started, so a group can start it again under other flags.
152+ stop_app () {
153+ bash " $GITHUB_WORKSPACE /.github/scripts/stop-session.sh" " $server_pid " " $app_tag "
154+ wait " $server_pid " 2> /dev/null || true
155+ server_pid=' '
156+ }
157+
158+ # start_platform <port>: the production build of apps/sim/platform, behind the main app's rewrite.
159+ start_platform () {
160+ local port=$1
161+ platform_tag=" platform-$GITHUB_RUN_ID -$GITHUB_RUN_ATTEMPT -$$ "
162+ platform_log=" $report_dir /platform-live-platform.log"
163+ E2E_APP=" $platform_tag " SIM_PLATFORM_API_ORIGIN=" $local_app_url " SIM_PLATFORM_BASE_PATH=/org setsid node \
164+ ../../node_modules/next/dist/bin/next start platform --hostname 127.0.0.1 --port " $port " \
165+ > " $platform_log " 2>&1 &
166+ platform_pid=$!
167+ wait_ready " $platform_pid " " http://127.0.0.1:$port /org" ' Platform zone'
168+ }
169+
170+ # platform_live_environment: one hosted Enterprise organization, the deterministic seed its specs
171+ # read, and a scripted worker in place of the model. Hosted is decided by the app's hostname, which
172+ # the job maps to loopback. Google and Microsoft answer only to real credentials, so those clients
173+ # are fixtures, and what no fixture can reach is reported by the specs as a skip.
174+ platform_live_environment () {
175+ app_server=start
176+ export REDIS_URL=redis://127.0.0.1:6379
177+ export E2E_APP_PUBLIC_URL=http://platform-live.sim.ai:3027
178+ export NEXT_PUBLIC_APP_URL=" $E2E_APP_PUBLIC_URL "
179+ export INTERNAL_API_BASE_URL=http://127.0.0.1:3027 TRUSTED_ORIGINS=http://127.0.0.1:3027
180+ export BILLING_ENABLED=true NEXT_PUBLIC_BILLING_ENABLED=true
181+ export ENTERPRISE_ENABLED=true NEXT_PUBLIC_ENTERPRISE_ENABLED=true
182+ export SSO_ENABLED=true NEXT_PUBLIC_SSO_ENABLED=true
183+ export SCIM_ENABLED=true NEXT_PUBLIC_SCIM_ENABLED=true
184+ export ORGANIZATIONS_ENABLED=true NEXT_PUBLIC_ORGANIZATIONS_ENABLED=true
185+ export KNOWLEDGE_MEMBER_ACCESS=true CREDENTIAL_GROUPS=true ACCESS_CONTROL_ENABLED=true
186+ export NEXT_PUBLIC_ACCESS_CONTROL_ENABLED=true
187+ export SIM_LINKS=true PEOPLE=true
188+ export INTERNAL_API_SECRET=platform-live-ci-local-secret-at-least-32-characters
189+ export COPILOT_API_KEY=platform-live-ci-local-copilot-key MOTHERSHIP_SIM_TRANSPORT=direct
190+ export SIM_AGENT_API_URL=http://127.0.0.1:3029
191+ export GOOGLE_CLIENT_ID=platform-live-google-client GOOGLE_CLIENT_SECRET=platform-live-google-secret
192+ export MICROSOFT_CLIENT_ID=platform-live-microsoft-client MICROSOFT_CLIENT_SECRET=platform-live-microsoft-secret
193+ export STRIPE_SECRET_KEY=sk_test_platform_live STRIPE_WEBHOOK_SECRET=whsec_platform_live
194+
195+ export PLATFORM_LIVE_ORIGIN=" $E2E_APP_PUBLIC_URL "
196+ export PLATFORM_LIVE_PASSWORD=platform-live-password-1
197+ export PLATFORM_LIVE_ORGANIZATION_ID=platform-live-organization
198+ export PLATFORM_LIVE_ORGANIZATION_NAME=' Sim Live Org'
199+ export PLATFORM_LIVE_OWNER_EMAIL=olive@platform-live.test
200+ export PLATFORM_LIVE_EMAIL=ada@platform-live.test
201+ export PLATFORM_LIVE_MEMBER_EMAIL=mia@platform-live.test
202+ export PLATFORM_LIVE_CONNECTED_EMAIL=cory@platform-live.test
203+ export PLATFORM_LIVE_ROLE_TARGET_EMAIL=rae@platform-live.test
204+ export PLATFORM_LIVE_REMOVABLE_EMAIL=remy@platform-live.test
205+ export PLATFORM_LIVE_REFUSED_INVITE_EMAIL=otto@platform-live.test
206+ export PLATFORM_LIVE_ORCHESTRATOR=1
207+ bun --no-env-file scripts/platform-live-seed.ts
208+ }
209+
210+ # run_platform_live <project> <report-name>
211+ run_platform_live () {
212+ local project=$1 name=$2
213+ PLATFORM_LIVE_REPORT_PATH=" $report_dir /$name /report.json" \
214+ bun run test:platform:live --project=" $project " ${PLATFORM_LIVE_GREP: +--grep " $PLATFORM_LIVE_GREP " }
215+ }
216+
136217# wait_ready <pid> <health-url> <label>
137218wait_ready () {
138219 local pid=$1 url=$2 label=$3
349430 bun run test:landing-seo:e2e
350431 ;;
351432
433+ # The zone as deployed: flag on, /org rewritten to the Platform build. Then the same build
434+ # with the flag off, which must put everyone back on the legacy surface. Both report, whichever
435+ # fails.
436+ platform-live-zone)
437+ platform_live_environment
438+ export SIM_PLATFORM_ORIGIN=http://127.0.0.1:3028
439+ start_browser_install platform-live --only-shell chromium
440+ PLATFORM_ORG_UI=true start_app platform-live 3027 ' Platform main' record-http-status
441+ start_platform 3028
442+ bun --no-env-file platform/checks/live/support/scripted-agent.ts 3029 \
443+ > " $report_dir /platform-live-agent.log" 2>&1 &
444+ agent_pid=$!
445+ wait_for_browsers
446+ live_status=0
447+ run_platform_live zone platform-live || live_status=$?
448+ stop_app
449+ start_app platform-live-flag-off 3027 ' Platform main, flag off' record-http-status
450+ run_platform_live flag-off platform-live-flag-off || live_status=$?
451+ exit " $live_status "
452+ ;;
453+
454+ # No zone at all: built without SIM_PLATFORM_ORIGIN, so even with the flag on nothing may change.
455+ platform-live-flag-off)
456+ platform_live_environment
457+ export PLATFORM_ORG_UI=true
458+ start_browser_install platform-live --only-shell chromium
459+ start_app platform-live-flag-off 3027 ' Main, no zone' record-http-status
460+ wait_for_browsers
461+ run_platform_live flag-off platform-live-flag-off
462+ ;;
463+
352464 * )
353465 echo " ::error::Unknown end-to-end group: $group " >&2
354466 exit 2
0 commit comments