@@ -10,6 +10,13 @@ import type { FakeUser } from '../../testUtils';
1010import { createTestUtils } from '../../testUtils' ;
1111import { prepareApplication } from './utils' ;
1212
13+ // eslint-disable-next-line turbo/no-undeclared-env-vars
14+ const APP_1_ENV_KEY = process . env . E2E_SESSIONS_APP_1_ENV_KEY ;
15+ // eslint-disable-next-line turbo/no-undeclared-env-vars
16+ const APP_1_HOST = process . env . E2E_SESSIONS_APP_1_HOST ;
17+ // eslint-disable-next-line turbo/no-undeclared-env-vars
18+ const APP_2_ENV_KEY = process . env . E2E_SESSIONS_APP_2_ENV_KEY ;
19+
1320/**
1421 * These two suites need to run in serial mode because they are both using a local proxy server
1522 * that listens to port 443. We can't run them in parallel because they would conflict with each other, unless
@@ -40,7 +47,7 @@ test.describe('root and subdomain production apps @sessions', () => {
4047 * 5. The second app is going to be served on sub-1.multiple-apps-e2e.clerk.app
4148 */
4249 test . describe ( 'multiple apps same domain for the same production instances' , ( ) => {
43- const hosts = [ 'multiple-apps-e2e.clerk.app :8443' , ' sub-1.multiple-apps-e2e.clerk.app :8443' ] ;
50+ const hosts = [ ` ${ APP_1_HOST } :8443` , ` sub-1.${ APP_1_HOST } :8443` ] ;
4451
4552 let fakeUser : FakeUser ;
4653 let server : Server ;
@@ -49,9 +56,9 @@ test.describe('root and subdomain production apps @sessions', () => {
4956 test . beforeAll ( async ( ) => {
5057 apps = await Promise . all ( [
5158 // first app
52- prepareApplication ( 'sessions-prod-1' ) ,
59+ prepareApplication ( APP_1_ENV_KEY ) ,
5360 // second app using the same instance keys
54- prepareApplication ( 'sessions-prod-1' ) ,
61+ prepareApplication ( APP_1_ENV_KEY ) ,
5562 ] ) ;
5663
5764 // TODO: Move this into createProxyServer
@@ -70,7 +77,11 @@ test.describe('root and subdomain production apps @sessions', () => {
7077
7178 const u = createTestUtils ( { app : apps [ 0 ] . app } ) ;
7279 fakeUser = u . services . users . createFakeUser ( ) ;
73- await u . services . users . createBapiUser ( fakeUser ) ;
80+ try {
81+ await u . services . users . createBapiUser ( fakeUser ) ;
82+ } catch ( error ) {
83+ console . error ( error ) ;
84+ }
7485 } ) ;
7586
7687 test . afterAll ( async ( ) => {
@@ -180,13 +191,13 @@ test.describe('root and subdomain production apps @sessions', () => {
180191 * 5. The second app is going to be served on sub-1.multiple-apps-e2e.clerk.app
181192 */
182193 test . describe ( 'multiple apps same domain for different production instances' , ( ) => {
183- const hosts = [ 'multiple-apps-e2e.clerk.app :8443' , ' sub-2.multiple-apps-e2e.clerk.app :8443' ] ;
194+ const hosts = [ ` ${ APP_1_HOST } :8443` , ` sub-2.${ APP_1_HOST } :8443` ] ;
184195 let fakeUsers : FakeUser [ ] ;
185196 let server : Server ;
186197 let apps : Array < { app : Application ; serverUrl : string } > ;
187198
188199 test . beforeAll ( async ( ) => {
189- apps = await Promise . all ( [ prepareApplication ( 'sessions-prod-1' ) , prepareApplication ( 'sessions-prod-2' ) ] ) ;
200+ apps = await Promise . all ( [ prepareApplication ( APP_1_ENV_KEY ) , prepareApplication ( APP_2_ENV_KEY ) ] ) ;
190201
191202 // TODO: Move this into createProxyServer
192203 const ssl : Pick < ServerOptions , 'ca' | 'cert' | 'key' > = {
@@ -312,13 +323,13 @@ test.describe('root and subdomain production apps @sessions', () => {
312323 *
313324 */
314325 test . describe ( 'multiple apps different same-level subdomains for different production instances' , ( ) => {
315- const hosts = [ ' sub-1.multiple-apps-e2e.clerk.app :8443' , ' sub-2.multiple-apps-e2e.clerk.app :8443' ] ;
326+ const hosts = [ ` sub-1.${ APP_1_HOST } :8443` , ` sub-2.${ APP_1_HOST } :8443` ] ;
316327 let fakeUsers : FakeUser [ ] ;
317328 let server : Server ;
318329 let apps : Array < { app : Application ; serverUrl : string } > ;
319330
320331 test . beforeAll ( async ( ) => {
321- apps = await Promise . all ( [ prepareApplication ( 'sessions-prod-1' ) , prepareApplication ( 'sessions-prod-2' ) ] ) ;
332+ apps = await Promise . all ( [ prepareApplication ( APP_1_ENV_KEY ) , prepareApplication ( APP_2_ENV_KEY ) ] ) ;
322333
323334 // TODO: Move this into createProxyServer
324335 const ssl : Pick < ServerOptions , 'ca' | 'cert' | 'key' > = {
0 commit comments