@@ -14,13 +14,52 @@ import {
1414 createNumbersCollection ,
1515} from '../helpers/insert-data' ;
1616
17+ async function createNewDataModel (
18+ browser : CompassBrowser ,
19+ dataModelName : string ,
20+ connectionName : string ,
21+ databaseName : string
22+ ) {
23+ await browser . navigateToDataModeling ( ) ;
24+
25+ // Click on create new data model button
26+ await browser . clickVisible ( Selectors . CreateNewDataModelButton ) ;
27+
28+ // Fill in model details
29+ await browser . setValueVisible (
30+ Selectors . CreateDataModelNameInput ,
31+ dataModelName
32+ ) ;
33+ await browser . clickVisible ( Selectors . CreateDataModelConfirmButton ) ;
34+
35+ // Select existing connection
36+ await browser . selectOption (
37+ Selectors . CreateDataModelConnectionSelector ,
38+ connectionName
39+ ) ;
40+ await browser . clickVisible ( Selectors . CreateDataModelConfirmButton ) ;
41+
42+ // Select a database
43+ await browser . selectOption (
44+ Selectors . CreateDataModelDatabaseSelector ,
45+ databaseName
46+ ) ;
47+ await browser . clickVisible ( Selectors . CreateDataModelConfirmButton ) ;
48+
49+ // TODO: Confirm all collections are selected by default (COMPASS-9309)
50+ // Note: We'll need to change the UI, right now the labels are disconnected from the checkboxes
51+ await browser . clickVisible ( Selectors . CreateDataModelConfirmButton ) ;
52+
53+ // Wait for the diagram editor to load
54+ const dataModelEditor = browser . $ ( Selectors . DataModelEditor ) ;
55+ await dataModelEditor . waitForDisplayed ( ) ;
56+ }
57+
1758describe ( 'Data Modeling tab' , function ( ) {
1859 let compass : Compass ;
1960 let browser : CompassBrowser ;
2061
2162 before ( async function ( ) {
22- skipForWeb ( this , 'data modeling not yet available in compass-web' ) ;
23-
2463 compass = await init ( this . test ?. fullTitle ( ) ) ;
2564 browser = compass . browser ;
2665 await browser . setFeature ( 'enableDataModeling' , true ) ;
@@ -45,40 +84,16 @@ describe('Data Modeling tab', function () {
4584 } ) ;
4685
4786 it ( 'creates a new data model using an existing connection' , async function ( ) {
48- await browser . navigateToDataModeling ( ) ;
49-
50- // Click on create new data model button
51- await browser . clickVisible ( Selectors . CreateNewDataModelButton ) ;
87+ // Skipping this test on web because it does not support saving of diagrams yet
88+ skipForWeb ( this , 'data modeling not yet available in compass-web' ) ;
5289
53- // Fill in model details
5490 const dataModelName = 'Test Data Model' ;
55- await browser . setValueVisible (
56- Selectors . CreateDataModelNameInput ,
57- dataModelName
58- ) ;
59- await browser . clickVisible ( Selectors . CreateDataModelConfirmButton ) ;
60-
61- // Select existing connection
62- await browser . selectOption (
63- Selectors . CreateDataModelConnectionSelector ,
64- DEFAULT_CONNECTION_NAME_1
65- ) ;
66- await browser . clickVisible ( Selectors . CreateDataModelConfirmButton ) ;
67-
68- // Select a database
69- await browser . selectOption (
70- Selectors . CreateDataModelDatabaseSelector ,
91+ await createNewDataModel (
92+ browser ,
93+ dataModelName ,
94+ DEFAULT_CONNECTION_NAME_1 ,
7195 'test'
7296 ) ;
73- await browser . clickVisible ( Selectors . CreateDataModelConfirmButton ) ;
74-
75- // TODO: Confirm all collections are selected by default (COMPASS-9309)
76- // Note: We'll need to change the UI, right now the labels are disconnected from the checkboxes
77- await browser . clickVisible ( Selectors . CreateDataModelConfirmButton ) ;
78-
79- // Wait for the diagram editor to load
80- const dataModelEditor = browser . $ ( Selectors . DataModelEditor ) ;
81- await dataModelEditor . waitForDisplayed ( ) ;
8297
8398 // Verify that the diagram is displayed and contains both collections
8499 const text = await browser . getCodemirrorEditorText (
@@ -153,4 +168,23 @@ describe('Data Modeling tab', function () {
153168 . $ ( Selectors . DataModelsListItem ( dataModelName ) )
154169 . waitForDisplayed ( { reverse : true } ) ;
155170 } ) ;
171+
172+ it ( 'does not store diagrams on web' , async function ( ) {
173+ await createNewDataModel (
174+ browser ,
175+ 'Test diagram' ,
176+ DEFAULT_CONNECTION_NAME_1 ,
177+ 'test'
178+ ) ;
179+
180+ // Close the tab
181+ await browser . closeWorkspaceTabs ( ) ;
182+
183+ // Re-open the data modeling tab
184+ await browser . navigateToDataModeling ( ) ;
185+
186+ // The diagram should not be there
187+ const emptyContent = browser . $ ( Selectors . EmptyState ) ;
188+ await emptyContent . waitForDisplayed ( ) ;
189+ } ) ;
156190} ) ;
0 commit comments