@@ -46,8 +46,10 @@ let MONGODB_USE_ENTERPRISE =
4646
4747// should we test compass-web (true) or compass electron (false)?
4848export const TEST_COMPASS_WEB = process . argv . includes ( '--test-compass-web' ) ;
49- export const ATLAS_DOMAIN = process . env . ATLAS_DOMAIN ;
50- export const ATLAS_GROUP_ID = process . env . ATLAS_GROUP_ID ;
49+ export const TEST_ATLAS_CLOUD_EXTERNAL_URL =
50+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_URL ;
51+ export const TEST_ATLAS_CLOUD_EXTERNAL_GROUP_ID =
52+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_GROUP_ID ;
5153// multiple connections is now the default
5254export const TEST_MULTIPLE_CONNECTIONS = true ;
5355
@@ -78,21 +80,21 @@ export const MONGODB_TEST_SERVER_PORT = Number(
7880) ;
7981
8082export const DEFAULT_CONNECTION_STRING_1 =
81- process . env . CONNECTION_STRING_1 ||
83+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_CONNECTION_STRING_1 ||
8284 `mongodb://127.0.0.1:${ MONGODB_TEST_SERVER_PORT } /test` ;
8385// NOTE: in browser.setupDefaultConnections() we don't give the first connection an
8486// explicit name, so it gets a calculated one based off the connection string
8587export const DEFAULT_CONNECTION_NAME_1 =
86- process . env . CONNECTION_NAME_1 ||
88+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_CONNECTION_NAME_1 ||
8789 connectionNameFromString ( DEFAULT_CONNECTION_STRING_1 ) ;
8890
8991// for testing multiple connections
9092export const DEFAULT_CONNECTION_STRING_2 =
91- process . env . CONNECTION_STRING_2 ||
93+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_CONNECTION_STRING_2 ||
9294 `mongodb://127.0.0.1:${ MONGODB_TEST_SERVER_PORT + 1 } /test` ;
9395// NOTE: in browser.setupDefaultConnections() the second connection gets given an explicit name
9496export const DEFAULT_CONNECTION_NAME_2 =
95- process . env . CONNECTION_NAME_2 || 'connection-2' ;
97+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_CONNECTION_NAME_2 || 'connection-2' ;
9698
9799export function updateMongoDBServerInfo ( ) {
98100 try {
@@ -111,7 +113,7 @@ export function updateMongoDBServerInfo() {
111113 'server-info' ,
112114 '--' ,
113115 '--connectionString' ,
114- process . env . CONNECTION_STRING_1 ||
116+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_CONNECTION_STRING_1 ||
115117 `mongodb://127.0.0.1:${ String ( MONGODB_TEST_SERVER_PORT ) } ` ,
116118 ] ,
117119 { encoding : 'utf-8' }
@@ -767,6 +769,16 @@ async function startCompassElectron(
767769 return compass ;
768770}
769771
772+ export type StoredAtlasCloudCookies = {
773+ name : string ;
774+ value : string ;
775+ domain : string ;
776+ path : string ;
777+ secure : boolean ;
778+ httpOnly : boolean ;
779+ expirationDate : number ;
780+ } [ ] ;
781+
770782export async function startBrowser (
771783 name : string ,
772784 // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -794,17 +806,19 @@ export async function startBrowser(
794806 ...wdioOptions ,
795807 } ) ) as CompassBrowser ;
796808
797- if ( ATLAS_DOMAIN ) {
809+ if ( TEST_ATLAS_CLOUD_EXTERNAL_URL ) {
798810 // Navigate to a 404 page to set cookies
799- await browser . navigateTo ( `https://${ ATLAS_DOMAIN } /404` ) ;
811+ await browser . navigateTo ( `https://${ TEST_ATLAS_CLOUD_EXTERNAL_URL } /404` ) ;
800812
801813 const cookiesFile = process . env . COOKIES_FILE ;
802814 if ( ! cookiesFile ) {
803815 throw new Error (
804816 'ATLAS_DOMAIN is set but COOKIES_FILE is not. Please set COOKIES_FILE to the path of the cookies file.'
805817 ) ;
806818 }
807- const cookies = JSON . parse ( await fs . readFile ( cookiesFile , 'utf8' ) ) ;
819+ const cookies : StoredAtlasCloudCookies = JSON . parse (
820+ await fs . readFile ( cookiesFile , 'utf8' )
821+ ) ;
808822
809823 for ( const cookie of cookies ) {
810824 if (
@@ -824,7 +838,7 @@ export async function startBrowser(
824838 }
825839
826840 await browser . navigateTo (
827- `https://${ ATLAS_DOMAIN } /v2/${ ATLAS_GROUP_ID } #/explorer`
841+ `https://${ TEST_ATLAS_CLOUD_EXTERNAL_URL } /v2/${ TEST_ATLAS_CLOUD_EXTERNAL_GROUP_ID } #/explorer`
828842 ) ;
829843 } else {
830844 await browser . navigateTo ( 'http://localhost:7777/' ) ;
0 commit comments