@@ -16,6 +16,9 @@ export async function resetConnectForm(browser: CompassBrowser): Promise<void> {
1616 if ( await browser . $ ( Selectors . ConnectionModal ) . isDisplayed ( ) ) {
1717 await browser . clickVisible ( Selectors . ConnectionModalCloseButton ) ;
1818 }
19+ await browser
20+ . $ ( Selectors . ConnectionModal )
21+ . waitForDisplayed ( { reverse : true } ) ;
1922 await browser
2023 . $ ( Selectors . ConnectionModal )
2124 . waitForClickable ( { reverse : true } ) ;
@@ -924,6 +927,8 @@ export async function saveConnection(
924927 . waitForDisplayed ( { reverse : true } ) ;
925928}
926929
930+ let screenshotCounter = 0 ;
931+
927932export async function setupDefaultConnections ( browser : CompassBrowser ) {
928933 // When running tests against Atlas Cloud, connections can't be added or
929934 // removed from the UI manually, so we skip setup for default connections
@@ -953,20 +958,28 @@ export async function setupDefaultConnections(browser: CompassBrowser) {
953958 whereas we do have some tests that try and use those. We can easily change
954959 this in future if needed, though.
955960 */
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- } ) ;
961+
962+ try {
963+ for ( const connectionInfo of DEFAULT_CONNECTIONS ) {
964+ const connectionName = getConnectionTitle ( connectionInfo ) ;
965+ if ( await browser . removeConnection ( connectionName ) ) {
966+ debug ( 'Removing existing connection so we do not create a duplicate' , {
967+ connectionName,
968+ } ) ;
969+ }
962970 }
963- }
964971
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- } ) ;
972+ for ( const connectionInfo of DEFAULT_CONNECTIONS ) {
973+ await browser . saveConnection ( {
974+ connectionString : connectionInfo . connectionOptions . connectionString ,
975+ connectionName : connectionInfo . favorite ?. name ,
976+ connectionColor : connectionInfo . favorite ?. color ,
977+ } ) ;
978+ }
979+ } catch ( err ) {
980+ await browser . screenshot (
981+ `connection-form-setup-default-connections-${ screenshotCounter ++ } .png`
982+ ) ;
983+ throw err ;
971984 }
972985}
0 commit comments