@@ -119,6 +119,7 @@ describe("Action center", () => {
119
119
beforeEach ( ( ) => {
120
120
cy . visit ( `${ ACTION_CENTER_ROUTE } /${ webMonitorKey } ` ) ;
121
121
cy . wait ( "@getSystemAggregateResults" ) ;
122
+ cy . getByTestId ( "page-breadcrumb" ) . should ( "contain" , webMonitorKey ) ; // little hack to make sure the webMonitorKey is available before proceeding
122
123
} ) ;
123
124
it ( "should display a breadcrumb" , ( ) => {
124
125
cy . getByTestId ( "page-breadcrumb" ) . within ( ( ) => {
@@ -137,8 +138,7 @@ describe("Action center", () => {
137
138
// cy.getByTestId("column-data_use").should("exist");
138
139
cy . getByTestId ( "column-locations" ) . should ( "exist" ) ;
139
140
cy . getByTestId ( "column-domains" ) . should ( "exist" ) ;
140
- // TODO: [HJ-343] uncomment when actions column is implemented
141
- // cy.getByTestId("column-actions").should("exist");
141
+ cy . getByTestId ( "column-actions" ) . should ( "exist" ) ;
142
142
cy . getByTestId ( "row-0-col-system_name" ) . within ( ( ) => {
143
143
cy . getByTestId ( "change-icon" ) . should ( "exist" ) ; // new result
144
144
cy . contains ( "Uncategorized assets" ) . should ( "exist" ) ;
@@ -165,6 +165,39 @@ describe("Action center", () => {
165
165
"contain" ,
166
166
"analytics.google.com" ,
167
167
) ;
168
+ cy . getByTestId ( "row-0-col-actions" ) . within ( ( ) => {
169
+ cy . getByTestId ( "add-btn" ) . should ( "be.disabled" ) ;
170
+ } ) ;
171
+ } ) ;
172
+ it ( "should ignore all assets in an uncategorized system" , ( ) => {
173
+ cy . getByTestId ( "row-0-col-actions" ) . within ( ( ) => {
174
+ cy . getByTestId ( "ignore-btn" ) . click ( { force : true } ) ;
175
+ } ) ;
176
+ cy . wait ( "@ignoreMonitorResultUncategorizedSystem" ) ;
177
+ cy . getByTestId ( "success-alert" ) . should (
178
+ "contain" ,
179
+ "108 uncategorized assets have been ignored and will not appear in future scans." ,
180
+ ) ;
181
+ } ) ;
182
+ it ( "should add all assets in a categorized system" , ( ) => {
183
+ cy . getByTestId ( "row-1-col-actions" ) . within ( ( ) => {
184
+ cy . getByTestId ( "add-btn" ) . click ( { force : true } ) ;
185
+ } ) ;
186
+ cy . wait ( "@addMonitorResultSystem" ) ;
187
+ cy . getByTestId ( "success-alert" ) . should (
188
+ "contain" ,
189
+ "10 assets from Google Tag Manager have been added to the system inventory." ,
190
+ ) ;
191
+ } ) ;
192
+ it ( "should ignore all assets in a categorized system" , ( ) => {
193
+ cy . getByTestId ( "row-1-col-actions" ) . within ( ( ) => {
194
+ cy . getByTestId ( "ignore-btn" ) . click ( { force : true } ) ;
195
+ } ) ;
196
+ cy . wait ( "@ignoreMonitorResultSystem" ) ;
197
+ cy . getByTestId ( "success-alert" ) . should (
198
+ "contain" ,
199
+ "10 assets from Google Tag Manager have been ignored and will not appear in future scans." ,
200
+ ) ;
168
201
} ) ;
169
202
it ( "should navigate to table view on row click" , ( ) => {
170
203
cy . getByTestId ( "row-1" ) . click ( ) ;
@@ -179,18 +212,70 @@ describe("Action center", () => {
179
212
} ) ;
180
213
} ) ;
181
214
182
- describe ( "Action center system assets results" , ( ) => {
215
+ describe ( "Action center assets uncategorized results" , ( ) => {
216
+ const webMonitorKey = "my_web_monitor_1" ;
217
+ const systemId = "[undefined]" ;
218
+ beforeEach ( ( ) => {
219
+ cy . visit ( `${ ACTION_CENTER_ROUTE } /${ webMonitorKey } /${ systemId } ` ) ;
220
+ cy . wait ( "@getSystemAssetsUncategorized" ) ;
221
+ cy . getByTestId ( "page-breadcrumb" ) . should ( "contain" , "Uncategorized" ) ;
222
+ } ) ;
223
+ it ( "should render uncategorized asset results view" , ( ) => {
224
+ cy . getByTestId ( "search-bar" ) . should ( "exist" ) ;
225
+ cy . getByTestId ( "pagination-btn" ) . should ( "exist" ) ;
226
+ cy . getByTestId ( "bulk-actions-menu" ) . should ( "be.disabled" ) ;
227
+ cy . getByTestId ( "add-all" ) . should ( "be.disabled" ) ;
228
+
229
+ // table columns
230
+ cy . getByTestId ( "column-select" ) . should ( "exist" ) ;
231
+ cy . getByTestId ( "column-name" ) . should ( "exist" ) ;
232
+ cy . getByTestId ( "column-resource_type" ) . should ( "exist" ) ;
233
+ cy . getByTestId ( "column-system" ) . should ( "exist" ) ;
234
+ // TODO: [HJ-369] uncomment when data use column is implemented
235
+ // cy.getByTestId("column-data_use").should("exist");
236
+ cy . getByTestId ( "column-locations" ) . should ( "exist" ) ;
237
+ cy . getByTestId ( "column-domain" ) . should ( "exist" ) ;
238
+ // TODO: [HJ-344] uncomment when Discovery column is implemented
239
+ /* cy.getByTestId("column-with_consent").should("exist");
240
+ cy.getByTestId("row-4-col-with_consent")
241
+ .contains("Without consent")
242
+ .realHover();
243
+ cy.get(".ant-tooltip-inner").should("contain", "January"); */
244
+ cy . getByTestId ( "column-actions" ) . should ( "exist" ) ;
245
+ cy . getByTestId ( "row-0-col-actions" ) . within ( ( ) => {
246
+ cy . getByTestId ( "add-btn" ) . should ( "be.disabled" ) ;
247
+ cy . getByTestId ( "ignore-btn" ) . should ( "exist" ) ;
248
+ } ) ;
249
+ } ) ;
250
+ it ( "should allow adding a system on uncategorized assets" , ( ) => {
251
+ cy . getByTestId ( "row-0-col-system" ) . within ( ( ) => {
252
+ cy . getByTestId ( "add-system-btn" ) . click ( ) ;
253
+ } ) ;
254
+ cy . wait ( "@getSystemsPaginated" ) ;
255
+ cy . getByTestId ( "system-select" ) . antSelect ( "Fidesctl System" ) ;
256
+ cy . wait ( "@setAssetSystem" ) ;
257
+ cy . getByTestId ( "system-select" ) . should ( "not.exist" ) ;
258
+ cy . getByTestId ( "success-alert" ) . should (
259
+ "contain" ,
260
+ 'Browser Request "0d22c925-3a81-4f10-bfdc-69a5d67e93bc" has been assigned to Fidesctl System.' ,
261
+ ) ;
262
+ } ) ;
263
+ } ) ;
264
+
265
+ describe ( "Action center assets categorized results" , ( ) => {
183
266
const webMonitorKey = "my_web_monitor_1" ;
184
267
const systemId = "system_key-8fe42cdb-af2e-4b9e-9b38-f75673180b88" ;
185
268
beforeEach ( ( ) => {
186
269
cy . visit ( `${ ACTION_CENTER_ROUTE } /${ webMonitorKey } /${ systemId } ` ) ;
187
270
cy . wait ( "@getSystemAssetResults" ) ;
271
+ cy . getByTestId ( "page-breadcrumb" ) . should ( "contain" , systemId ) ; // little hack to make sure the systemId is available before proceeding
188
272
} ) ;
189
273
it ( "should render asset results view" , ( ) => {
190
274
cy . getByTestId ( "page-breadcrumb" ) . should ( "contain" , systemId ) ;
191
275
cy . getByTestId ( "search-bar" ) . should ( "exist" ) ;
192
276
cy . getByTestId ( "pagination-btn" ) . should ( "exist" ) ;
193
277
cy . getByTestId ( "bulk-actions-menu" ) . should ( "be.disabled" ) ;
278
+ cy . getByTestId ( "add-all" ) . should ( "exist" ) ;
194
279
195
280
// table columns
196
281
cy . getByTestId ( "column-select" ) . should ( "exist" ) ;
@@ -213,18 +298,18 @@ describe("Action center", () => {
213
298
cy . getByTestId ( "ignore-btn" ) . should ( "exist" ) ;
214
299
} ) ;
215
300
} ) ;
216
- it . skip ( "should allow adding a system on uncategorized assets" , ( ) => {
217
- // TODO: uncategorized assets are not yet available for testing
218
- } ) ;
219
301
it ( "should allow editing a system on categorized assets" , ( ) => {
220
- cy . getByTestId ( "page-breadcrumb" ) . should ( "contain" , systemId ) ; // little hack to make sure the systemId is available before proceeding
221
302
cy . getByTestId ( "row-3-col-system" ) . within ( ( ) => {
222
303
cy . getByTestId ( "system-badge" ) . click ( ) ;
223
304
} ) ;
224
305
cy . wait ( "@getSystemsPaginated" ) ;
225
306
cy . getByTestId ( "system-select" ) . antSelect ( "Fidesctl System" ) ;
226
307
cy . wait ( "@setAssetSystem" ) ;
227
308
cy . getByTestId ( "system-select" ) . should ( "not.exist" ) ;
309
+ cy . getByTestId ( "success-alert" ) . should (
310
+ "contain" ,
311
+ 'Browser Request "destination" has been assigned to Fidesctl System.' ,
312
+ ) ;
228
313
229
314
// Wait for previous UI animations to reset or Cypress chokes on the next part
230
315
// eslint-disable-next-line cypress/no-unnecessary-waiting
@@ -243,20 +328,30 @@ describe("Action center", () => {
243
328
cy . wait ( "@setAssetSystem" ) ;
244
329
cy . getByTestId ( "success-alert" ) . should ( "exist" ) ;
245
330
cy . getByTestId ( "system-select" ) . should ( "not.exist" ) ;
331
+ cy . getByTestId ( "success-alert" ) . should (
332
+ "contain" ,
333
+ 'Browser Request "collect" has been assigned to Demo Marketing System.' ,
334
+ ) ;
246
335
} ) ;
247
336
it ( "should add individual assets" , ( ) => {
248
337
cy . getByTestId ( "row-0-col-actions" ) . within ( ( ) => {
249
338
cy . getByTestId ( "add-btn" ) . click ( { force : true } ) ;
250
339
} ) ;
251
340
cy . wait ( "@addAssets" ) ;
252
- cy . getByTestId ( "success-alert" ) . should ( "exist" ) ;
341
+ cy . getByTestId ( "success-alert" ) . should (
342
+ "contain" ,
343
+ 'Browser Request "11020051272" has been added to the system inventory.' ,
344
+ ) ;
253
345
} ) ;
254
346
it ( "should ignore individual assets" , ( ) => {
255
347
cy . getByTestId ( "row-0-col-actions" ) . within ( ( ) => {
256
348
cy . getByTestId ( "ignore-btn" ) . click ( { force : true } ) ;
257
349
} ) ;
258
350
cy . wait ( "@ignoreAssets" ) ;
259
- cy . getByTestId ( "success-alert" ) . should ( "exist" ) ;
351
+ cy . getByTestId ( "success-alert" ) . should (
352
+ "contain" ,
353
+ 'Browser Request "11020051272" has been ignored and will not appear in future scans.' ,
354
+ ) ;
260
355
} ) ;
261
356
it ( "should bulk add assets" , ( ) => {
262
357
cy . getByTestId ( "bulk-actions-menu" ) . should ( "be.disabled" ) ;
@@ -268,7 +363,10 @@ describe("Action center", () => {
268
363
cy . getByTestId ( "bulk-actions-menu" ) . click ( ) ;
269
364
cy . getByTestId ( "bulk-add" ) . click ( ) ;
270
365
cy . wait ( "@addAssets" ) ;
271
- cy . getByTestId ( "success-alert" ) . should ( "exist" ) ;
366
+ cy . getByTestId ( "success-alert" ) . should (
367
+ "contain" ,
368
+ "3 assets from Google Tag Manager have been added to the system inventory." ,
369
+ ) ;
272
370
} ) ;
273
371
it ( "should bulk ignore assets" , ( ) => {
274
372
cy . getByTestId ( "bulk-actions-menu" ) . should ( "be.disabled" ) ;
@@ -280,15 +378,29 @@ describe("Action center", () => {
280
378
cy . getByTestId ( "bulk-actions-menu" ) . click ( ) ;
281
379
cy . getByTestId ( "bulk-ignore" ) . click ( ) ;
282
380
cy . wait ( "@ignoreAssets" ) ;
283
- cy . getByTestId ( "success-alert" ) . should ( "exist" ) ;
381
+ cy . getByTestId ( "success-alert" ) . should (
382
+ "contain" ,
383
+ "3 assets from Google Tag Manager have been ignored and will not appear in future scans." ,
384
+ ) ;
284
385
} ) ;
285
- it . skip ( "should add all assets" , ( ) => {
286
- // TODO: [HJ-343] unskip when add all is implemented
386
+ it ( "should add all assets" , ( ) => {
387
+ cy . intercept (
388
+ "POST" ,
389
+ "/api/v1/plus/discovery-monitor/*/promote*" ,
390
+ ( req ) => {
391
+ req . on ( "response" , ( res ) => {
392
+ res . setDelay ( 100 ) ; // slight delay allows us to check for the loading state below
393
+ } ) ;
394
+ } ,
395
+ ) . as ( "slowRequest" ) ;
287
396
cy . getByTestId ( "add-all" ) . click ( ) ;
288
397
cy . getByTestId ( "add-all" ) . should ( "have.class" , "ant-btn-loading" ) ;
289
- cy . wait ( "@addAssets " ) ;
398
+ cy . wait ( "@slowRequest " ) ;
290
399
cy . url ( ) . should ( "not.contain" , systemId ) ;
291
- cy . getByTestId ( "success-alert" ) . should ( "exist" ) ;
400
+ cy . getByTestId ( "success-alert" ) . should (
401
+ "contain" ,
402
+ "11 assets from Google Tag Manager have been added to the system inventory." ,
403
+ ) ;
292
404
} ) ;
293
405
} ) ;
294
406
} ) ;
0 commit comments