@@ -25,7 +25,46 @@ export const ALLOWED_RUNNER_ARGS = [
2525 '--bail' ,
2626] ;
2727
28- export const TEST_COMPASS_WEB = process . argv . includes ( '--test-compass-web' ) ;
28+ /**
29+ * Variables used by a special use-case of running e2e tests against a
30+ * cloud(-dev).mongodb.com URL. If you're changing anything related to these,
31+ * make sure that the tests in mms are also updated to account for that
32+ */
33+ export const TEST_ATLAS_CLOUD_EXTERNAL_URL =
34+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_URL ;
35+ export const TEST_ATLAS_CLOUD_EXTERNAL_COOKIES_FILE =
36+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_COOKIES_FILE ;
37+ export const TEST_ATLAS_CLOUD_EXTERNAL_GROUP_ID =
38+ process . env . TEST_ATLAS_CLOUD_EXTERNAL_GROUP_ID ;
39+ const TEST_ATLAS_CLOUD_EXTERNAL_DEFAULT_CONNECTIONS : ConnectionInfo [ ] | null =
40+ JSON . parse ( process . env . TEST_ATLAS_CLOUD_DEFAULT_CONNECTIONS ?? 'null' ) ;
41+
42+ const ALL_ATLAS_CLOUD_EXTERNAL_VARS = [
43+ TEST_ATLAS_CLOUD_EXTERNAL_URL ,
44+ TEST_ATLAS_CLOUD_EXTERNAL_COOKIES_FILE ,
45+ TEST_ATLAS_CLOUD_EXTERNAL_GROUP_ID ,
46+ TEST_ATLAS_CLOUD_EXTERNAL_DEFAULT_CONNECTIONS ,
47+ ] ;
48+
49+ export const TEST_ATLAS_CLOUD_EXTERNAL = ALL_ATLAS_CLOUD_EXTERNAL_VARS . some (
50+ ( val ) => {
51+ return ! ! val ;
52+ }
53+ ) ;
54+
55+ if (
56+ TEST_ATLAS_CLOUD_EXTERNAL &&
57+ ALL_ATLAS_CLOUD_EXTERNAL_VARS . some ( ( val ) => {
58+ return ! val ;
59+ } )
60+ ) {
61+ throw new Error (
62+ 'Trying to test Atlas Cloud external URL but some required variables are missing'
63+ ) ;
64+ }
65+
66+ export const TEST_COMPASS_WEB =
67+ process . argv . includes ( '--test-compass-web' ) || TEST_ATLAS_CLOUD_EXTERNAL ;
2968export const TEST_COMPASS_DESKTOP = ! TEST_COMPASS_WEB ;
3069export const TEST_COMPASS_DESKTOP_PACKAGED_APP = process . argv . includes (
3170 '--test-packaged-app'
@@ -57,46 +96,50 @@ export const COMPASS_WEB_BROWSER_NAME = process.env.BROWSER_NAME ?? 'chrome';
5796//
5897// NOTE: The version of chromedriver or geckodriver in play might also be
5998// relevant.
60- export const COPMASS_WEB_BROWSER_VERSION =
99+ export const COMPASS_WEB_BROWSER_VERSION =
61100 process . env . BROWSER_VERSION === 'unset'
62101 ? undefined
63102 : process . env . BROWSER_VERSION ?? 'latest' ;
103+ export const COMPASS_WEB_SANDBOX_URL = 'http://localhost:7777' ;
64104
65105const MONGODB_TESTSERVER_VERSION =
66106 process . env . MONGODB_VERSION ?? process . env . MONGODB_RUNNER_VERSION ;
67107
68108export const DEFAULT_CONNECTIONS : ( ConnectionInfo & {
69109 testServer ?: Partial < MongoClusterOptions > ;
70- } ) [ ] = [
71- {
72- id : 'test-connection-1' ,
73- connectionOptions : {
74- connectionString : 'mongodb://127.0.0.1:27091/test' ,
75- } ,
76- testServer : {
77- version : MONGODB_TESTSERVER_VERSION ,
78- topology : 'replset' ,
79- secondaries : 0 ,
80- args : [ '--port' , '27091' ] ,
81- } ,
82- } ,
83- {
84- id : 'test-connection-2' ,
85- connectionOptions : {
86- connectionString : 'mongodb://127.0.0.1:27092/test' ,
87- } ,
88- favorite : {
89- name : 'connection-2' ,
90- color : 'Iris' ,
91- } ,
92- testServer : {
93- version : MONGODB_TESTSERVER_VERSION ,
94- topology : 'replset' ,
95- secondaries : 0 ,
96- args : [ '--port' , '27092' ] ,
97- } ,
98- } ,
99- ] ;
110+ } ) [ ] =
111+ TEST_ATLAS_CLOUD_EXTERNAL && TEST_ATLAS_CLOUD_EXTERNAL_DEFAULT_CONNECTIONS
112+ ? TEST_ATLAS_CLOUD_EXTERNAL_DEFAULT_CONNECTIONS
113+ : [
114+ {
115+ id : 'test-connection-1' ,
116+ connectionOptions : {
117+ connectionString : 'mongodb://127.0.0.1:27091/test' ,
118+ } ,
119+ testServer : {
120+ version : MONGODB_TESTSERVER_VERSION ,
121+ topology : 'replset' ,
122+ secondaries : 0 ,
123+ args : [ '--port' , '27091' ] ,
124+ } ,
125+ } ,
126+ {
127+ id : 'test-connection-2' ,
128+ connectionOptions : {
129+ connectionString : 'mongodb://127.0.0.1:27092/test' ,
130+ } ,
131+ favorite : {
132+ name : 'connection-2' ,
133+ color : 'Iris' ,
134+ } ,
135+ testServer : {
136+ version : MONGODB_TESTSERVER_VERSION ,
137+ topology : 'replset' ,
138+ secondaries : 0 ,
139+ args : [ '--port' , '27092' ] ,
140+ } ,
141+ } ,
142+ ] ;
100143
101144export const DEFAULT_CONNECTION_STRINGS = DEFAULT_CONNECTIONS . map ( ( info ) => {
102145 return info . connectionOptions . connectionString ;
0 commit comments