@@ -40,7 +40,7 @@ describe("Consent reporting", () => {
40
40
} ) ;
41
41
} ) ;
42
42
43
- describe ( "downloading reports " , ( ) => {
43
+ describe ( "results view and download report " , ( ) => {
44
44
beforeEach ( ( ) => {
45
45
stubPlus ( true , {
46
46
core_fides_version : "1.9.6" ,
@@ -70,10 +70,80 @@ describe("Consent reporting", () => {
70
70
url : "/api/v1/plus/consent_reporting*" ,
71
71
method : "GET" ,
72
72
} ) . as ( "getConsentReport" ) ;
73
- cy . getByTestId ( "input-from- date" ) . type ( "2023-11-01" ) ;
74
- cy . getByTestId ( "input-to- date" ) . type ( "2023-11-07" ) ;
73
+ cy . getByTestId ( "input-date-range" ) . first ( ) . type ( "2023-11-01" ) ;
74
+ cy . getByTestId ( "input-date-range" ) . last ( ) . type ( "2023-11-07" ) ;
75
75
cy . getByTestId ( "download-btn" ) . click ( ) ;
76
+ cy . getByTestId ( "download-report-btn" ) . click ( ) ;
76
77
cy . wait ( "@getConsentReport" ) ;
77
78
} ) ;
79
+ it ( "can lookup specific consent preferences" , ( ) => {
80
+ cy . intercept ( {
81
+ url : "/api/v1/current-privacy-preferences*" ,
82
+ method : "GET" ,
83
+ } ) . as ( "lookupConsentPreferences" ) ;
84
+ cy . getByTestId ( "consent-reporting-dropdown-btn" ) . click ( ) ;
85
+ cy . getByTestId ( "consent-preference-lookup-btn" ) . click ( ) ;
86
+ cy . getByTestId ( "subject-search-input" ) . type ( "[email protected] {enter}" ) ;
87
+ cy . wait ( "@lookupConsentPreferences" ) . then ( ( interception ) => {
88
+ const { url : requestUrl } = interception . request ;
89
+ let url = new URL ( requestUrl ) ;
90
+ let params = new URLSearchParams ( url . search ) ;
91
+ expect ( params . get ( "email" ) ) . to . equal ( "[email protected] " ) ;
92
+ expect ( params . get ( "phone_number" ) ) . to . equal ( "[email protected] " ) ;
93
+ expect ( params . get ( "fides_user_device_id" ) ) . to . equal ( "[email protected] " ) ;
94
+ expect ( params . get ( "external_id" ) ) . to . equal ( "[email protected] " ) ;
95
+ } ) ;
96
+ } ) ;
97
+ it ( "loads the consent report table without date filters" , ( ) => {
98
+ cy . intercept (
99
+ {
100
+ url : "/api/v1/historical-privacy-preferences*" ,
101
+ method : "GET" ,
102
+ } ,
103
+ {
104
+ fixture : "consent-reporting/historical-privacy-preferences.json" ,
105
+ } ,
106
+ ) . as ( "getConsentReport" ) ;
107
+
108
+ cy . wait ( "@getConsentReport" ) . then ( ( interception ) => {
109
+ const { url : requestUrl } = interception . request ;
110
+ let url = new URL ( requestUrl ) ;
111
+ let params = new URLSearchParams ( url . search ) ;
112
+ expect ( params . get ( "request_timestamp_gt" ) ) . to . be . null ;
113
+ expect ( params . get ( "request_timestamp_lt" ) ) . to . be . null ;
114
+ } ) ;
115
+
116
+ cy . getByTestId ( "fidesTable-body" ) . children ( ) . should ( "have.length" , 22 ) ;
117
+ } ) ;
118
+ it ( "loads the consent report table with date filters" , ( ) => {
119
+ cy . intercept (
120
+ {
121
+ url : "/api/v1/historical-privacy-preferences*" ,
122
+ method : "GET" ,
123
+ } ,
124
+ {
125
+ fixture : "consent-reporting/historical-privacy-preferences.json" ,
126
+ } ,
127
+ ) . as ( "getConsentReport" ) ;
128
+
129
+ cy . wait ( "@getConsentReport" ) ;
130
+
131
+ cy . getByTestId ( "input-date-range" ) . first ( ) . type ( "2023-11-01" ) ;
132
+ cy . getByTestId ( "input-date-range" ) . last ( ) . type ( "2023-11-07{enter}" ) ;
133
+
134
+ cy . wait ( "@getConsentReport" ) . then ( ( interception ) => {
135
+ const { url : requestUrl } = interception . request ;
136
+ let url = new URL ( requestUrl ) ;
137
+ let params = new URLSearchParams ( url . search ) ;
138
+ expect ( params . get ( "request_timestamp_gt" ) ) . to . equal (
139
+ "2023-11-01T00:00:00.000Z" ,
140
+ ) ;
141
+ expect ( params . get ( "request_timestamp_lt" ) ) . to . equal (
142
+ "2023-11-07T23:59:59.999Z" ,
143
+ ) ;
144
+ } ) ;
145
+
146
+ cy . getByTestId ( "fidesTable-body" ) . children ( ) . should ( "have.length" , 22 ) ;
147
+ } ) ;
78
148
} ) ;
79
149
} ) ;
0 commit comments