@@ -13,7 +13,10 @@ import { rebuild } from '@electron/rebuild';
1313import type { RebuildOptions } from '@electron/rebuild' ;
1414import type { ConsoleMessageType } from 'puppeteer' ;
1515import { run as packageCompass } from 'hadron-build/commands/release' ;
16- import { redactConnectionString } from 'mongodb-connection-string-url' ;
16+ import {
17+ redactConnectionString ,
18+ ConnectionString ,
19+ } from 'mongodb-connection-string-url' ;
1720import { getConnectionTitle } from '@mongodb-js/connection-info' ;
1821export * as Selectors from './selectors' ;
1922export * as Commands from './commands' ;
@@ -45,7 +48,11 @@ let MONGODB_USE_ENTERPRISE =
4548 ( process . env . MONGODB_VERSION ?. endsWith ( '-enterprise' ) && 'yes' ) ?? 'no' ;
4649
4750// should we test compass-web (true) or compass electron (false)?
48- export const TEST_COMPASS_WEB = process . argv . includes ( '--test-compass-web' ) ;
51+ export const TEST_COMPASS_WEB_ATLAS_CLOUD = process . argv . includes (
52+ '--test-compass-web-atlas-cloud'
53+ ) ;
54+ export const TEST_COMPASS_WEB =
55+ process . argv . includes ( '--test-compass-web' ) || TEST_COMPASS_WEB_ATLAS_CLOUD ;
4956// multiple connections is now the default
5057export const TEST_MULTIPLE_CONNECTIONS = true ;
5158
@@ -56,10 +63,13 @@ in a scannable manner. It is not being output at present because the tests will
5663be logged as pending anyway.
5764*/
5865export function skipForWeb (
59- test : Mocha . Runnable | Mocha . Context ,
66+ test : Mocha . Context ,
6067 // eslint-disable-next-line @typescript-eslint/no-unused-vars
6168 reason : string
6269) {
70+ if ( test ?. currentTest ?. title ) {
71+ test . currentTest . title += ` - skipped with reason: ${ reason } ` ;
72+ }
6373 if ( TEST_COMPASS_WEB ) {
6474 test . skip ( ) ;
6575 }
@@ -75,12 +85,29 @@ export const MONGODB_TEST_SERVER_PORT = Number(
7585 process . env . MONGODB_TEST_SERVER_PORT ?? 27091
7686) ;
7787
78- export const DEFAULT_CONNECTION_STRING_1 = `mongodb://127.0.0.1:${ MONGODB_TEST_SERVER_PORT } /test` ;
88+ function getAtlasConnectionStringFromEnv ( ) {
89+ const connectionStringJSONString =
90+ process . env . E2E_ATLAS_CLOUD_TEST_CLUSTER_CONNECTION_STRING_JSON ;
91+ if ( ! connectionStringJSONString ) {
92+ return undefined ;
93+ }
94+ const { standardSrv } = JSON . parse ( connectionStringJSONString ) ;
95+ const mongodbConnectionString = new ConnectionString ( standardSrv ) ;
96+ mongodbConnectionString . username =
97+ process . env . E2E_TESTS_COMPASS_WEB_ATLAS_DB_USERNAME ! ;
98+ mongodbConnectionString . password =
99+ process . env . E2E_TESTS_COMPASS_WEB_ATLAS_PASSWORD ! ;
100+ return mongodbConnectionString . toString ( ) ;
101+ }
102+
103+ export const DEFAULT_CONNECTION_STRING_1 =
104+ getAtlasConnectionStringFromEnv ( ) ??
105+ `mongodb://127.0.0.1:${ MONGODB_TEST_SERVER_PORT } /test` ;
79106// NOTE: in browser.setupDefaultConnections() we don't give the first connection an
80107// explicit name, so it gets a calculated one based off the connection string
81- export const DEFAULT_CONNECTION_NAME_1 = connectionNameFromString (
82- DEFAULT_CONNECTION_STRING_1
83- ) ;
108+ export const DEFAULT_CONNECTION_NAME_1 =
109+ process . env . E2E_ATLAS_CLOUD_TEST_CLUSTER_NAME ??
110+ connectionNameFromString ( DEFAULT_CONNECTION_STRING_1 ) ;
84111
85112// for testing multiple connections
86113export const DEFAULT_CONNECTION_STRING_2 = `mongodb://127.0.0.1:${
0 commit comments