@@ -20,6 +20,7 @@ import {
2020import type { Compass } from '../helpers/compass' ;
2121import type { ConnectFormState } from '../helpers/connect-form-state' ;
2222import * as Selectors from '../helpers/selectors' ;
23+ import { DEFAULT_CONNECTION_NAMES } from '../helpers/test-runner-context' ;
2324
2425async function disconnect ( browser : CompassBrowser ) {
2526 try {
@@ -643,6 +644,50 @@ describe('Connection string', function () {
643644 } ) ;
644645} ) ;
645646
647+ describe ( 'Connect in a new window' , ( ) => {
648+ let compass : Compass ;
649+ let browser : CompassBrowser ;
650+
651+ before ( async function ( ) {
652+ compass = await init ( this . test ?. fullTitle ( ) , {
653+ firstRun : false ,
654+ } ) ;
655+ browser = compass . browser ;
656+ await browser . setupDefaultConnections ( ) ;
657+ } ) ;
658+
659+ after ( async function ( ) {
660+ await cleanup ( compass ) ;
661+ } ) ;
662+
663+ it ( 'can connect in new window' , async function ( this ) {
664+ skipForWeb ( this , 'connecting in new window is not supported on web' ) ;
665+ const connectionName = DEFAULT_CONNECTION_NAMES [ 0 ] ;
666+ const connectionSelector = Selectors . sidebarConnection ( connectionName ) ;
667+ await browser . hover ( connectionSelector ) ;
668+
669+ expect ( ( await browser . getWindowHandles ( ) ) . length ) . equals ( 1 ) ;
670+
671+ const connectionElement = browser . $ ( connectionSelector ) ;
672+ await browser . clickVisible (
673+ connectionElement . $ ( Selectors . Multiple . ConnectDropdownButton )
674+ ) ;
675+ await browser . clickVisible (
676+ connectionElement . $ ( Selectors . Multiple . ConnectInNewWindowButton )
677+ ) ;
678+
679+ const windowsAfter = await browser . getWindowHandles ( ) ;
680+ expect ( windowsAfter . length ) . equals ( 2 ) ;
681+ const [ , newWindowHandle ] = windowsAfter ;
682+ await browser . switchToWindow ( newWindowHandle ) ;
683+ await browser . waitForConnectionResult ( connectionName , {
684+ connectionStatus : 'success' ,
685+ } ) ;
686+ } ) ;
687+
688+ // TODO: Add a test for we to ensure the SplitButton isn't visible on Web
689+ } ) ;
690+
646691describe ( 'Connection form' , function ( ) {
647692 let compass : Compass ;
648693 let browser : CompassBrowser ;
0 commit comments