@@ -924,6 +924,8 @@ export async function saveConnection(
924924 . waitForDisplayed ( { reverse : true } ) ;
925925}
926926
927+ let screenshotCounter = 0 ;
928+
927929export async function setupDefaultConnections ( browser : CompassBrowser ) {
928930 // When running tests against Atlas Cloud, connections can't be added or
929931 // removed from the UI manually, so we skip setup for default connections
@@ -953,20 +955,28 @@ export async function setupDefaultConnections(browser: CompassBrowser) {
953955 whereas we do have some tests that try and use those. We can easily change
954956 this in future if needed, though.
955957 */
956- for ( const connectionInfo of DEFAULT_CONNECTIONS ) {
957- const connectionName = getConnectionTitle ( connectionInfo ) ;
958- if ( await browser . removeConnection ( connectionName ) ) {
959- debug ( 'Removing existing connection so we do not create a duplicate' , {
960- connectionName,
961- } ) ;
958+
959+ try {
960+ for ( const connectionInfo of DEFAULT_CONNECTIONS ) {
961+ const connectionName = getConnectionTitle ( connectionInfo ) ;
962+ if ( await browser . removeConnection ( connectionName ) ) {
963+ debug ( 'Removing existing connection so we do not create a duplicate' , {
964+ connectionName,
965+ } ) ;
966+ }
962967 }
963- }
964968
965- for ( const connectionInfo of DEFAULT_CONNECTIONS ) {
966- await browser . saveConnection ( {
967- connectionString : connectionInfo . connectionOptions . connectionString ,
968- connectionName : connectionInfo . favorite ?. name ,
969- connectionColor : connectionInfo . favorite ?. color ,
970- } ) ;
969+ for ( const connectionInfo of DEFAULT_CONNECTIONS ) {
970+ await browser . saveConnection ( {
971+ connectionString : connectionInfo . connectionOptions . connectionString ,
972+ connectionName : connectionInfo . favorite ?. name ,
973+ connectionColor : connectionInfo . favorite ?. color ,
974+ } ) ;
975+ }
976+ } catch ( err ) {
977+ await browser . screenshot (
978+ `screenshot-connection-form-setup-default-connections-${ screenshotCounter ++ } .png`
979+ ) ;
980+ throw err ;
971981 }
972982}
0 commit comments