@@ -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 {
@@ -641,6 +642,50 @@ describe('Connection string', function () {
641642 } ) ;
642643} ) ;
643644
645+ describe ( 'Connect in a new window' , ( ) => {
646+ let compass : Compass ;
647+ let browser : CompassBrowser ;
648+
649+ before ( async function ( ) {
650+ compass = await init ( this . test ?. fullTitle ( ) , {
651+ firstRun : false ,
652+ } ) ;
653+ browser = compass . browser ;
654+ await browser . setupDefaultConnections ( ) ;
655+ } ) ;
656+
657+ after ( async function ( ) {
658+ await cleanup ( compass ) ;
659+ } ) ;
660+
661+ it ( 'can connect in new window' , async function ( this ) {
662+ skipForWeb ( this , 'connecting in new window is not supported on web' ) ;
663+ const connectionName = DEFAULT_CONNECTION_NAMES [ 0 ] ;
664+ const connectionSelector = Selectors . sidebarConnection ( connectionName ) ;
665+ await browser . hover ( connectionSelector ) ;
666+
667+ expect ( ( await browser . getWindowHandles ( ) ) . length ) . equals ( 1 ) ;
668+
669+ const connectionElement = browser . $ ( connectionSelector ) ;
670+ await browser . clickVisible (
671+ connectionElement . $ ( Selectors . ConnectDropdownButton )
672+ ) ;
673+ await browser . clickVisible (
674+ connectionElement . $ ( Selectors . ConnectInNewWindowButton )
675+ ) ;
676+
677+ const windowsAfter = await browser . getWindowHandles ( ) ;
678+ expect ( windowsAfter . length ) . equals ( 2 ) ;
679+ const [ , newWindowHandle ] = windowsAfter ;
680+ await browser . switchToWindow ( newWindowHandle ) ;
681+ await browser . waitForConnectionResult ( connectionName , {
682+ connectionStatus : 'success' ,
683+ } ) ;
684+ } ) ;
685+
686+ // TODO: Add a test for we to ensure the SplitButton isn't visible on Web
687+ } ) ;
688+
644689describe ( 'Connection form' , function ( ) {
645690 let compass : Compass ;
646691 let browser : CompassBrowser ;
0 commit comments