@@ -109,6 +109,54 @@ describe('Collection schema tab', function () {
109
109
} ) ;
110
110
}
111
111
112
+ describe ( 'with the enableExportSchema feature flag enabled' , function ( ) {
113
+ beforeEach ( async function ( ) {
114
+ // TODO(COMPASS-8819): remove web skip when defaulted true.
115
+ skipForWeb ( this , "can't toggle features in compass-web" ) ;
116
+ await browser . setFeature ( 'enableExportSchema' , true ) ;
117
+ } ) ;
118
+
119
+ it ( 'shows an exported schema to copy' , async function ( ) {
120
+ await browser . navigateToCollectionTab (
121
+ DEFAULT_CONNECTION_NAME_1 ,
122
+ 'test' ,
123
+ 'numbers' ,
124
+ 'Schema'
125
+ ) ;
126
+ await browser . clickVisible ( Selectors . AnalyzeSchemaButton ) ;
127
+
128
+ const element = browser . $ ( Selectors . SchemaFieldList ) ;
129
+ await element . waitForDisplayed ( ) ;
130
+
131
+ await browser . clickVisible ( Selectors . ExportSchemaButton ) ;
132
+
133
+ const exportModal = browser . $ ( Selectors . ExportSchemaFormatOptions ) ;
134
+ await exportModal . waitForDisplayed ( ) ;
135
+
136
+ const exportSchemaContent = browser . $ ( Selectors . ExportSchemaOutput ) ;
137
+ await exportSchemaContent . waitForDisplayed ( ) ;
138
+ const text = await browser . $ ( Selectors . ExportSchemaOutput ) . getText ( ) ;
139
+ const parsedText = JSON . parse ( text ) ;
140
+ delete parsedText . $defs ;
141
+ expect ( parsedText ) . to . deep . equal ( {
142
+ $schema : 'https://json-schema.org/draft/2020-12/schema' ,
143
+ type : 'object' ,
144
+ required : [ '_id' , 'i' , 'j' ] ,
145
+ properties : {
146
+ _id : {
147
+ $ref : '#/$defs/ObjectId' ,
148
+ } ,
149
+ i : {
150
+ type : 'integer' ,
151
+ } ,
152
+ j : {
153
+ type : 'integer' ,
154
+ } ,
155
+ } ,
156
+ } ) ;
157
+ } ) ;
158
+ } ) ;
159
+
112
160
it ( 'analyzes the schema with a query' ) ;
113
161
it ( 'can reset the query' ) ;
114
162
it ( 'can create a geoquery from a map' ) ;
0 commit comments