@@ -733,5 +733,41 @@ describe('Data Modeling tab', function () {
733733 expect ( nodesPostDelete ) . to . have . lengthOf ( 1 ) ;
734734 expect ( nodesPostDelete [ 0 ] . id ) . to . equal ( 'test.testCollection-renamedOne' ) ;
735735 } ) ;
736+
737+ it ( 'adding a new collection from the toolbar' , async function ( ) {
738+ const dataModelName = 'Test Edit Collection' ;
739+ await setupDiagram ( browser , {
740+ diagramName : dataModelName ,
741+ connectionName : DEFAULT_CONNECTION_NAME_1 ,
742+ databaseName : 'test' ,
743+ } ) ;
744+
745+ const dataModelEditor = browser . $ ( Selectors . DataModelEditor ) ;
746+ await dataModelEditor . waitForDisplayed ( ) ;
747+
748+ // Click on the add collection button.
749+ await browser . clickVisible ( Selectors . DataModelAddCollectionBtn ) ;
750+
751+ // Verify that the drawer is opened.
752+ const drawer = browser . $ ( Selectors . SideDrawer ) ;
753+ await drawer . waitForDisplayed ( ) ;
754+
755+ // Name the collection (it submits on unfocus).
756+ const collectionName = 'testCollection-newOne' ;
757+ await browser . setValueVisible (
758+ browser . $ ( Selectors . DataModelNameInput ) ,
759+ collectionName
760+ ) ;
761+ await drawer . click ( ) ; // Unfocus the input.
762+
763+ // Verify that the new collection is added to the diagram.
764+ const nodes = await getDiagramNodes ( browser , 3 ) ;
765+ expect ( nodes [ 2 ] . id ) . to . equal ( 'test.testCollection-newOne' ) ;
766+
767+ // Undo once - verify that the collection is removed
768+ // This is to ensure that the initial edit of the collection name wasn't a separate edit
769+ await browser . clickVisible ( Selectors . DataModelUndoButton ) ;
770+ await getDiagramNodes ( browser , 2 ) ;
771+ } ) ;
736772 } ) ;
737773} ) ;
0 commit comments