@@ -111,6 +111,9 @@ describe("System management page", () => {
111
111
112
112
it ( "Can step through the flow" , ( ) => {
113
113
cy . fixture ( "systems/system.json" ) . then ( ( system ) => {
114
+ cy . intercept ( "GET" , "/api/v1/system/*" , {
115
+ body : { ...system , privacy_declarations : [ ] } ,
116
+ } ) . as ( "getDemoSystem" ) ;
114
117
// Fill in the describe form based on fixture data
115
118
cy . visit ( ADD_SYSTEMS_ROUTE ) ;
116
119
cy . getByTestId ( "manual-btn" ) . click ( ) ;
@@ -145,6 +148,7 @@ describe("System management page", () => {
145
148
"@getDataSubjects" ,
146
149
"@getDataUses" ,
147
150
"@getFilteredDatasets" ,
151
+ "@getDemoSystem" ,
148
152
] ) ;
149
153
cy . getByTestId ( "new-declaration-form" ) ;
150
154
const declaration = system . privacy_declarations [ 0 ] ;
@@ -180,32 +184,41 @@ describe("System management page", () => {
180
184
} ) ;
181
185
182
186
it ( "can render a warning when there is unsaved data" , ( ) => {
183
- cy . visit ( ADD_SYSTEMS_MANUAL_ROUTE ) ;
184
- cy . wait ( "@getSystems" ) ;
185
- cy . wait ( "@getConnectionTypes" ) ;
186
- cy . getByTestId ( "create-system-btn" ) . click ( ) ;
187
- cy . getByTestId ( "input-name" ) . type ( "test" ) ;
188
- cy . getByTestId ( "input-fides_key" ) . type ( "test" ) ;
189
- cy . getByTestId ( "save-btn" ) . click ( ) ;
190
- cy . wait ( "@postSystem" ) ;
187
+ cy . fixture ( "systems/system.json" ) . then ( ( system ) => {
188
+ cy . intercept ( "GET" , "/api/v1/system/*" , {
189
+ body : { ...system , privacy_declarations : [ ] } ,
190
+ } ) . as ( "getDemoSystem" ) ;
191
+ cy . visit ( ADD_SYSTEMS_MANUAL_ROUTE ) ;
192
+ cy . wait ( "@getSystems" ) ;
193
+ cy . wait ( "@getConnectionTypes" ) ;
194
+ cy . getByTestId ( "create-system-btn" ) . click ( ) ;
195
+ cy . getByTestId ( "input-name" ) . type ( system . name ) ;
196
+ cy . getByTestId ( "input-fides_key" ) . type ( system . fides_key ) ;
197
+ cy . getByTestId ( "input-description" ) . type ( system . description ) ;
198
+ cy . getByTestId ( "save-btn" ) . click ( ) ;
199
+ cy . wait ( "@postSystem" ) ;
191
200
192
- // start typing a description
193
- const description = "half formed thought" ;
194
- cy . getByTestId ( "input-description" ) . type ( description ) ;
195
- // then try navigating to the privacy declarations tab
196
- cy . getByTestId ( "tab-Data uses" ) . click ( ) ;
197
- cy . getByTestId ( "confirmation-modal" ) ;
198
- // make sure canceling works
199
- cy . getByTestId ( "cancel-btn" ) . click ( ) ;
200
- cy . getByTestId ( "input-description" ) . should ( "have.value" , description ) ;
201
- // now actually discard
202
- cy . getByTestId ( "tab-Data uses" ) . click ( ) ;
203
- cy . getByTestId ( "continue-btn" ) . click ( ) ;
204
- // should load the privacy declarations page
205
- cy . getByTestId ( "privacy-declaration-step" ) ;
206
- // navigate back
207
- cy . getByTestId ( "tab-System information" ) . click ( ) ;
208
- cy . getByTestId ( "input-description" ) . should ( "have.value" , "" ) ;
201
+ // start typing a description
202
+ const description = "half formed thought" ;
203
+ cy . getByTestId ( "input-description" ) . clear ( ) . type ( description ) ;
204
+ // then try navigating to the privacy declarations tab
205
+ cy . getByTestId ( "tab-Data uses" ) . click ( ) ;
206
+ cy . getByTestId ( "confirmation-modal" ) ;
207
+ // make sure canceling works
208
+ cy . getByTestId ( "cancel-btn" ) . click ( ) ;
209
+ cy . getByTestId ( "input-description" ) . should ( "have.value" , description ) ;
210
+ // now actually discard
211
+ cy . getByTestId ( "tab-Data uses" ) . click ( ) ;
212
+ cy . getByTestId ( "continue-btn" ) . click ( ) ;
213
+ // should load the privacy declarations page
214
+ cy . getByTestId ( "privacy-declaration-step" ) ;
215
+ // navigate back and make sure description has the original description
216
+ cy . getByTestId ( "tab-System information" ) . click ( ) ;
217
+ cy . getByTestId ( "input-description" ) . should (
218
+ "have.value" ,
219
+ system . description
220
+ ) ;
221
+ } ) ;
209
222
} ) ;
210
223
} ) ;
211
224
} ) ;
@@ -311,6 +324,7 @@ describe("System management page", () => {
311
324
const { body } = interception . request ;
312
325
expect ( body . joint_controller . name ) . to . eql ( controllerName ) ;
313
326
} ) ;
327
+ cy . wait ( "@getFidesctlSystem" ) ;
314
328
315
329
// Switch to the Data Uses tab
316
330
cy . getByTestId ( "tab-Data uses" ) . click ( ) ;
@@ -336,15 +350,15 @@ describe("System management page", () => {
336
350
// edit the existing declaration
337
351
cy . getByTestId ( "accordion-header-improve.system" ) . click ( ) ;
338
352
cy . getByTestId ( "improve.system-form" ) . within ( ( ) => {
339
- cy . getByTestId ( "input-data_subjects" ) . type ( `anonymous {enter}` ) ;
353
+ cy . getByTestId ( "input-data_subjects" ) . type ( `customer {enter}` ) ;
340
354
cy . getByTestId ( "save-btn" ) . click ( ) ;
341
355
} ) ;
342
356
cy . wait ( "@putSystem" ) . then ( ( interception ) => {
343
357
const { body } = interception . request ;
344
358
expect ( body . privacy_declarations . length ) . to . eql ( 1 ) ;
345
359
expect ( body . privacy_declarations [ 0 ] . data_subjects ) . to . eql ( [
346
- "customer" ,
347
360
"anonymous_user" ,
361
+ "customer" ,
348
362
] ) ;
349
363
} ) ;
350
364
cy . getByTestId ( "saved-indicator" ) ;
0 commit comments