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,73 @@ 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 " 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 /platform" ' 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 INTERNAL_API_BASE_URL=http://127.0.0.1:3027 TRUSTED_ORIGINS=http://127.0.0.1:3027
179+ export BILLING_ENABLED=true NEXT_PUBLIC_BILLING_ENABLED=true
180+ export ENTERPRISE_ENABLED=true NEXT_PUBLIC_ENTERPRISE_ENABLED=true
181+ export SSO_ENABLED=true NEXT_PUBLIC_SSO_ENABLED=true
182+ export SCIM_ENABLED=true NEXT_PUBLIC_SCIM_ENABLED=true
183+ export ORGANIZATIONS_ENABLED=true NEXT_PUBLIC_ORGANIZATIONS_ENABLED=true
184+ export KNOWLEDGE_MEMBER_ACCESS=true CREDENTIAL_GROUPS=true ACCESS_CONTROL_ENABLED=true
185+ export NEXT_PUBLIC_ACCESS_CONTROL_ENABLED=true
186+ export SIM_LINKS=true PEOPLE=true
187+ export INTERNAL_API_SECRET=platform-live-ci-local-secret-at-least-32-characters
188+ export COPILOT_API_KEY=platform-live-ci-local-copilot-key MOTHERSHIP_SIM_TRANSPORT=direct
189+ export SIM_AGENT_API_URL=http://127.0.0.1:3029
190+ export GOOGLE_CLIENT_ID=platform-live-google-client GOOGLE_CLIENT_SECRET=platform-live-google-secret
191+ export MICROSOFT_CLIENT_ID=platform-live-microsoft-client MICROSOFT_CLIENT_SECRET=platform-live-microsoft-secret
192+ export STRIPE_SECRET_KEY=sk_test_platform_live STRIPE_WEBHOOK_SECRET=whsec_platform_live
193+
194+ export PLATFORM_LIVE_ORIGIN=" $E2E_APP_PUBLIC_URL "
195+ export PLATFORM_LIVE_PASSWORD=platform-live-password-1
196+ export PLATFORM_LIVE_ORGANIZATION_ID=platform-live-organization
197+ export PLATFORM_LIVE_ORGANIZATION_NAME=' Sim Live Org'
198+ export PLATFORM_LIVE_OWNER_EMAIL=olive@platform-live.test
199+ export PLATFORM_LIVE_EMAIL=ada@platform-live.test
200+ export PLATFORM_LIVE_MEMBER_EMAIL=mia@platform-live.test
201+ export PLATFORM_LIVE_CONNECTED_EMAIL=cory@platform-live.test
202+ export PLATFORM_LIVE_ROLE_TARGET_EMAIL=rae@platform-live.test
203+ export PLATFORM_LIVE_REMOVABLE_EMAIL=remy@platform-live.test
204+ export PLATFORM_LIVE_NO_DIRECTORY_EMAIL=noor@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> [playwright args...]
211+ run_platform_live () {
212+ local project=$1 name=$2
213+ shift 2
214+ PLATFORM_LIVE_REPORT_PATH=" $report_dir /$name /report.json" \
215+ bun run test:platform:live --project=" $project " ${PLATFORM_LIVE_GREP: +--grep " $PLATFORM_LIVE_GREP " } " $@ "
216+ }
217+
136218# wait_ready <pid> <health-url> <label>
137219wait_ready () {
138220 local pid=$1 url=$2 label=$3
349431 bun run test:landing-seo:e2e
350432 ;;
351433
434+ # The zone as deployed: flag on, /platform rewritten to the Platform build. Then the same build
435+ # with the flag off, which must put everyone back on the legacy surface. Both report, whichever
436+ # fails.
437+ platform-live-zone)
438+ platform_live_environment
439+ export SIM_PLATFORM_ORIGIN=http://127.0.0.1:3028
440+ export NEXT_PUBLIC_APP_URL=" $E2E_APP_PUBLIC_URL "
441+ start_browser_install platform-live --only-shell chromium
442+ PLATFORM_ORG_UI=true start_app platform-live 3027 ' Platform main' record-http-status
443+ start_platform 3028
444+ bun --no-env-file platform/checks/live/support/scripted-agent.ts 3029 \
445+ > " $report_dir /platform-live-agent.log" 2>&1 &
446+ agent_pid=$!
447+ wait_for_browsers
448+ live_status=0
449+ run_platform_live zone platform-live || live_status=$?
450+ stop_app
451+ start_app platform-live-flag-off 3027 ' Platform main, flag off' record-http-status
452+ PLATFORM_LIVE_ZONE=1 run_platform_live flag-off platform-live-flag-off || live_status=$?
453+ exit " $live_status "
454+ ;;
455+
456+ # No zone at all: built without SIM_PLATFORM_ORIGIN, so even with the flag on nothing may change.
457+ platform-live-flag-off)
458+ platform_live_environment
459+ export PLATFORM_ORG_UI=true
460+ start_browser_install platform-live --only-shell chromium
461+ start_app platform-live-flag-off 3027 ' Main, no zone' record-http-status
462+ wait_for_browsers
463+ run_platform_live flag-off platform-live-flag-off
464+ ;;
465+
352466 * )
353467 echo " ::error::Unknown end-to-end group: $group " >&2
354468 exit 2
0 commit comments