@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.17.0 → 4.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dpr/components/_catalogue/catalogue-list/utils.js +1 -1
  2. package/dpr/components/_catalogue/catalogue-list/utils.js.map +3 -3
  3. package/dpr/components/_catalogue/catalogue-list/utils.ts +4 -5
  4. package/dpr/components/_charts/chart/Buckets.js +1 -1
  5. package/dpr/components/_charts/chart/Buckets.js.map +3 -3
  6. package/dpr/components/_charts/chart/Buckets.ts +44 -36
  7. package/dpr/components/_charts/chart/heatmap/HeatmapChart.js +1 -1
  8. package/dpr/components/_charts/chart/heatmap/HeatmapChart.js.map +2 -2
  9. package/dpr/components/_charts/chart/heatmap/HeatmapChart.ts +22 -14
  10. package/dpr/components/_charts/chart/heatmap/types.js +2 -0
  11. package/dpr/components/_charts/chart/heatmap/types.js.map +7 -0
  12. package/dpr/components/_charts/chart/heatmap/types.ts +6 -0
  13. package/dpr/components/_charts/utils.js +1 -1
  14. package/dpr/components/_charts/utils.js.map +3 -3
  15. package/dpr/components/_charts/utils.test.ts +10 -7
  16. package/dpr/components/_charts/utils.ts +57 -50
  17. package/dpr/components/_dashboards/dashboard/view.njk +1 -1
  18. package/dpr/components/_dashboards/dashboard-list/utils.js +1 -1
  19. package/dpr/components/_dashboards/dashboard-list/utils.js.map +2 -2
  20. package/dpr/components/_dashboards/dashboard-list/utils.test.ts +3 -3
  21. package/dpr/components/_dashboards/dashboard-list/utils.ts +16 -12
  22. package/dpr/components/_dashboards/dashboard-section/view.njk +1 -1
  23. package/dpr/components/_dashboards/dashboard-visualisation/DashboardVisualisation.js +2 -0
  24. package/dpr/components/_dashboards/dashboard-visualisation/DashboardVisualisation.js.map +7 -0
  25. package/dpr/components/_dashboards/dashboard-visualisation/DashboardVisualisation.ts +40 -0
  26. package/dpr/components/_dashboards/dashboard-visualisation/types.js +2 -0
  27. package/dpr/components/_dashboards/dashboard-visualisation/types.js.map +7 -0
  28. package/dpr/components/_dashboards/dashboard-visualisation/types.ts +102 -0
  29. package/dpr/components/_dashboards/dashboard-visualisation/view.njk +1 -1
  30. package/dpr/components/_dashboards/scorecard/Scorecard.js +1 -1
  31. package/dpr/components/_dashboards/scorecard/Scorecard.js.map +2 -2
  32. package/dpr/components/_dashboards/scorecard/Scorecard.ts +37 -29
  33. package/dpr/components/_dashboards/scorecard/types.js.map +1 -1
  34. package/dpr/components/_dashboards/scorecard/types.ts +1 -0
  35. package/dpr/components/_dashboards/scorecard/utils.js +1 -1
  36. package/dpr/components/_dashboards/scorecard/utils.js.map +2 -2
  37. package/dpr/components/_dashboards/scorecard/utils.test.ts +13 -4
  38. package/dpr/components/_dashboards/scorecard/utils.ts +6 -5
  39. package/dpr/components/_dashboards/scorecard/view.njk +6 -5
  40. package/dpr/components/_dashboards/scorecard-group/view.njk +4 -4
  41. package/dpr/components/_reports/report-actions/types.d.js.map +1 -1
  42. package/dpr/components/_reports/report-actions/types.d.ts +1 -1
  43. package/dpr/components/_reports/report-heading/view.njk +1 -1
  44. package/dpr/data/dashboardClient.js +1 -1
  45. package/dpr/data/dashboardClient.js.map +2 -2
  46. package/dpr/data/dashboardClient.ts +8 -7
  47. package/dpr/data/reportingClient.js +1 -1
  48. package/dpr/data/reportingClient.js.map +1 -1
  49. package/dpr/data/reportingClient.ts +1 -1
  50. package/dpr/middleware/reportAuthoriser.js +1 -1
  51. package/dpr/middleware/reportAuthoriser.js.map +3 -3
  52. package/dpr/middleware/reportAuthoriser.ts +9 -20
  53. package/dpr/routes/journeys/download-report/controller.js +1 -1
  54. package/dpr/routes/journeys/download-report/controller.js.map +3 -3
  55. package/dpr/routes/journeys/download-report/controller.ts +4 -1
  56. package/dpr/routes/journeys/download-report/request-download/form/submitted/tests.cy.js +1 -1
  57. package/dpr/routes/journeys/download-report/request-download/form/submitted/tests.cy.js.map +2 -2
  58. package/dpr/routes/journeys/download-report/request-download/form/submitted/tests.cy.ts +1 -0
  59. package/dpr/routes/journeys/download-report/request-download/form/tests.cy.js +1 -1
  60. package/dpr/routes/journeys/download-report/request-download/form/tests.cy.js.map +2 -2
  61. package/dpr/routes/journeys/download-report/request-download/form/tests.cy.ts +1 -0
  62. package/dpr/routes/journeys/download-report/tests.cy.js +1 -1
  63. package/dpr/routes/journeys/download-report/tests.cy.js.map +2 -2
  64. package/dpr/routes/journeys/download-report/tests.cy.ts +2 -8
  65. package/dpr/routes/journeys/download-report/utils.js +1 -1
  66. package/dpr/routes/journeys/download-report/utils.js.map +3 -3
  67. package/dpr/routes/journeys/download-report/utils.ts +10 -7
  68. package/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.js +1 -1
  69. package/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.js.map +2 -2
  70. package/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.ts +1 -0
  71. package/dpr/routes/journeys/my-reports/bookmarks/tests.cy.js +1 -1
  72. package/dpr/routes/journeys/my-reports/bookmarks/tests.cy.js.map +3 -3
  73. package/dpr/routes/journeys/my-reports/bookmarks/tests.cy.ts +5 -14
  74. package/dpr/routes/journeys/my-reports/bookmarks/utils.js +1 -1
  75. package/dpr/routes/journeys/my-reports/bookmarks/utils.js.map +3 -3
  76. package/dpr/routes/journeys/my-reports/bookmarks/utils.ts +11 -5
  77. package/dpr/routes/journeys/my-reports/recently-viewed/list/tests.cy.js +1 -1
  78. package/dpr/routes/journeys/my-reports/recently-viewed/list/tests.cy.js.map +3 -3
  79. package/dpr/routes/journeys/my-reports/recently-viewed/list/tests.cy.ts +4 -7
  80. package/dpr/routes/journeys/my-reports/requested-reports/list/tests.cy.js +1 -1
  81. package/dpr/routes/journeys/my-reports/requested-reports/list/tests.cy.js.map +2 -2
  82. package/dpr/routes/journeys/my-reports/requested-reports/list/tests.cy.ts +1 -0
  83. package/dpr/routes/journeys/request-missing-report/form/tests.cy.js +1 -1
  84. package/dpr/routes/journeys/request-missing-report/form/tests.cy.js.map +2 -2
  85. package/dpr/routes/journeys/request-missing-report/form/tests.cy.ts +1 -0
  86. package/dpr/routes/journeys/request-missing-report/tests.cy.js +1 -1
  87. package/dpr/routes/journeys/request-missing-report/tests.cy.js.map +2 -2
  88. package/dpr/routes/journeys/request-missing-report/tests.cy.ts +3 -5
  89. package/dpr/routes/journeys/request-report/filters/tests.cy.js +1 -1
  90. package/dpr/routes/journeys/request-report/filters/tests.cy.js.map +3 -3
  91. package/dpr/routes/journeys/request-report/filters/tests.cy.ts +3 -6
  92. package/dpr/routes/journeys/request-report/filters/utils.js +1 -1
  93. package/dpr/routes/journeys/request-report/filters/utils.js.map +2 -2
  94. package/dpr/routes/journeys/request-report/filters/utils.ts +2 -3
  95. package/dpr/routes/journeys/request-report/status/tests.cy.js +1 -1
  96. package/dpr/routes/journeys/request-report/status/tests.cy.js.map +2 -2
  97. package/dpr/routes/journeys/request-report/status/tests.cy.ts +2 -7
  98. package/dpr/routes/journeys/request-report/tests.cy.js +1 -1
  99. package/dpr/routes/journeys/request-report/tests.cy.js.map +3 -3
  100. package/dpr/routes/journeys/request-report/tests.cy.ts +5 -21
  101. package/dpr/routes/journeys/view-report/async/controller.js.map +2 -2
  102. package/dpr/routes/journeys/view-report/async/controller.ts +2 -2
  103. package/dpr/routes/journeys/view-report/async/dashboard/tests.cy.js +1 -1
  104. package/dpr/routes/journeys/view-report/async/dashboard/tests.cy.js.map +2 -2
  105. package/dpr/routes/journeys/view-report/async/dashboard/tests.cy.ts +2 -10
  106. package/dpr/routes/journeys/view-report/async/dashboard/utils.js +1 -1
  107. package/dpr/routes/journeys/view-report/async/dashboard/utils.js.map +3 -3
  108. package/dpr/routes/journeys/view-report/async/dashboard/utils.ts +100 -95
  109. package/dpr/routes/journeys/view-report/async/report/controller.js +1 -1
  110. package/dpr/routes/journeys/view-report/async/report/controller.js.map +3 -3
  111. package/dpr/routes/journeys/view-report/async/report/controller.ts +4 -6
  112. package/dpr/routes/journeys/view-report/async/report/tests.cy.js +1 -1
  113. package/dpr/routes/journeys/view-report/async/report/tests.cy.js.map +2 -2
  114. package/dpr/routes/journeys/view-report/async/report/tests.cy.ts +8 -19
  115. package/dpr/routes/journeys/view-report/async/report/types.js +2 -0
  116. package/dpr/routes/journeys/view-report/async/report/types.js.map +7 -0
  117. package/dpr/routes/journeys/view-report/async/report/types.ts +31 -0
  118. package/dpr/routes/journeys/view-report/async/report/utils.js +1 -1
  119. package/dpr/routes/journeys/view-report/async/report/utils.js.map +3 -3
  120. package/dpr/routes/journeys/view-report/async/report/utils.ts +173 -136
  121. package/dpr/routes/journeys/view-report/sync/tests.cy.js +1 -1
  122. package/dpr/routes/journeys/view-report/sync/tests.cy.js.map +3 -3
  123. package/dpr/routes/journeys/view-report/sync/tests.cy.ts +3 -5
  124. package/dpr/services/dashboardService.js +1 -1
  125. package/dpr/services/dashboardService.js.map +2 -2
  126. package/dpr/services/dashboardService.ts +7 -5
  127. package/dpr/services/productCollection/productCollectionService.js +1 -1
  128. package/dpr/services/productCollection/productCollectionService.js.map +2 -2
  129. package/dpr/services/productCollection/productCollectionService.ts +3 -3
  130. package/dpr/services/reportingService.js +1 -1
  131. package/dpr/services/reportingService.js.map +1 -1
  132. package/dpr/services/reportingService.ts +1 -1
  133. package/dpr/types/AsyncReportUtils.js.map +1 -1
  134. package/dpr/types/AsyncReportUtils.ts +3 -4
  135. package/dpr/types/Charts.js +1 -1
  136. package/dpr/types/Charts.js.map +3 -3
  137. package/dpr/types/Charts.ts +0 -82
  138. package/dpr/types/Metrics.js +1 -1
  139. package/dpr/types/Metrics.js.map +1 -1
  140. package/dpr/types/Metrics.ts +7 -0
  141. package/dpr/types/ReportQuery.js +1 -1
  142. package/dpr/types/ReportQuery.js.map +3 -3
  143. package/dpr/types/ReportQuery.ts +24 -15
  144. package/dpr/types/Services.d.js +1 -1
  145. package/dpr/types/Services.d.js.map +1 -1
  146. package/dpr/types/Services.d.ts +2 -0
  147. package/dpr/types/api.d.js.map +1 -1
  148. package/dpr/types/api.d.ts +14 -16
  149. package/dpr/utils/Personalisation/personalisationUtils.js +1 -1
  150. package/dpr/utils/Personalisation/personalisationUtils.js.map +3 -3
  151. package/dpr/utils/Personalisation/personalisationUtils.ts +15 -6
  152. package/dpr/utils/UserStoreItemBuilder.js +1 -1
  153. package/dpr/utils/UserStoreItemBuilder.js.map +1 -1
  154. package/dpr/utils/UserStoreItemBuilder.ts +2 -2
  155. package/dpr/utils/datasetHelper.js +1 -1
  156. package/dpr/utils/datasetHelper.js.map +3 -3
  157. package/dpr/utils/datasetHelper.test.ts +11 -11
  158. package/dpr/utils/datasetHelper.ts +23 -8
  159. package/dpr/utils/logger.js +1 -1
  160. package/dpr/utils/logger.js.map +3 -3
  161. package/dpr/utils/logger.ts +6 -1
  162. package/package.json +2 -1
  163. package/dpr/components/_charts/chart/DashboardVisualisation.js +0 -2
  164. package/dpr/components/_charts/chart/DashboardVisualisation.js.map +0 -7
  165. package/dpr/components/_charts/chart/DashboardVisualisation.ts +0 -43
  166. package/dpr/components/_dashboards/dashboard/types.js +0 -2
  167. package/dpr/components/_dashboards/dashboard/types.js.map +0 -7
  168. package/dpr/components/_dashboards/dashboard/types.ts +0 -120
@@ -1,17 +1,13 @@
1
1
  import parseUrl from 'parseurl'
2
- import { Url } from 'url'
3
2
  import { Request } from 'express'
4
- import type { AsyncReportUtilsParams } from '../../../../../types/AsyncReportUtils'
5
-
3
+ import { Services } from '../../../../../types/Services'
6
4
  import {
7
- DashboardUIVisualisation,
5
+ DashboardSection,
6
+ DashboardVisualisation,
8
7
  DashboardVisualisationType,
9
- ListVisualisation,
10
- type DashboardDefinition,
11
- type DashboardSection,
12
- type DashboardUISection,
13
- type DashboardVisualisation,
14
- } from '../../../../../components/_dashboards/dashboard/types'
8
+ } from '../../../../../components/_dashboards/dashboard-visualisation/types'
9
+ import type { AsyncReportUtilsParams } from '../../../../../types/AsyncReportUtils'
10
+
15
11
  import type { DashboardDataResponse } from '../../../../../types/Metrics'
16
12
  import type { RequestedReport } from '../../../../../types/UserReports'
17
13
  import { ReportType } from '../../../../../types/UserReports'
@@ -27,48 +23,53 @@ import ScorecardVisualisation from '../../../../../components/_dashboards/scorec
27
23
  import ReportActionsUtils from '../../../../../components/_reports/report-actions/utils'
28
24
  import ReportQuery from '../../../../../types/ReportQuery'
29
25
  import LocalsHelper from '../../../../../utils/localsHelper'
30
- import { Services } from '../../../../../types/Services'
31
26
  import { FilterValue } from '../../../../../components/_filters/types'
32
27
  import { FiltersType } from '../../../../../components/_filters/filtersTypeEnum'
33
28
 
34
29
  const setDashboardActions = (
35
- dashboardDefinition: DashboardDefinition,
30
+ dashboardDefinition: components['schemas']['DashboardDefinition'],
36
31
  reportDefinition: components['schemas']['ReportDefinitionSummary'],
37
- requestData: RequestedReport,
32
+ requestData?: RequestedReport,
38
33
  ) => {
39
34
  const reportName = reportDefinition.name
40
35
  const { name } = dashboardDefinition
41
- const actionsUrl = requestData.url.request.fullUrl
42
- const { executionId } = requestData
43
-
44
- return ReportActionsUtils.getActions({
45
- share: {
46
- reportName,
47
- name,
48
- url: actionsUrl,
49
- },
50
- refresh: {
51
- url: actionsUrl,
52
- executionId,
53
- },
54
- copy: {
55
- url: actionsUrl,
56
- },
57
- })
36
+ const actionsUrl = requestData?.url?.request?.fullUrl
37
+ const executionId = requestData?.executionId
38
+
39
+ let actions = {}
40
+ if (actionsUrl) {
41
+ actions = {
42
+ share: {
43
+ reportName,
44
+ name,
45
+ url: actionsUrl,
46
+ },
47
+ copy: {
48
+ url: actionsUrl,
49
+ },
50
+ }
51
+ if (executionId) {
52
+ actions = {
53
+ ...actions,
54
+ refresh: {
55
+ url: actionsUrl,
56
+ executionId,
57
+ },
58
+ }
59
+ }
60
+ }
61
+
62
+ return ReportActionsUtils.getActions(actions)
58
63
  }
59
64
 
60
65
  const getDefinitionData = async ({ req, res, services, next }: AsyncReportUtilsParams) => {
61
66
  const { token } = LocalsHelper.getValues(res)
62
67
  const { reportId, id } = req.params
63
- const { dataProductDefinitionsPath } = req.query
68
+ const dataProductDefinitionsPath = <string>req.query.dataProductDefinitionsPath
64
69
 
65
70
  // Dashboard Definition,
66
- const dashboardDefinition: DashboardDefinition = await services.dashboardService.getDefinition(
67
- token,
68
- reportId,
69
- id,
70
- dataProductDefinitionsPath,
71
- )
71
+ const dashboardDefinition: components['schemas']['DashboardDefinition'] =
72
+ await services.dashboardService.getDefinition(token, reportId, id, dataProductDefinitionsPath)
72
73
 
73
74
  // Report summary data
74
75
  const reportDefinition = await DefinitionUtils.getReportSummary(
@@ -104,61 +105,62 @@ const getDefinitionData = async ({ req, res, services, next }: AsyncReportUtilsP
104
105
  }
105
106
 
106
107
  const getSections = (
107
- dashboardDefinition: DashboardDefinition,
108
+ dashboardDefinition: components['schemas']['DashboardDefinition'],
108
109
  dashboardData: DashboardDataResponse[],
109
110
  query: Record<string, string | string[]>,
110
- ): DashboardUISection[] => {
111
- return dashboardDefinition.sections.map((section: DashboardSection) => {
111
+ ): DashboardSection[] => {
112
+ return dashboardDefinition.sections.map((section: components['schemas']['DashboardSectionDefinition']) => {
112
113
  const { id, display: title, description } = section
113
114
 
114
115
  let hasScorecard = false
115
- const visualisations = section.visualisations.map((visDefinition: DashboardVisualisation) => {
116
- const { type, display, description: visDescription, id: visId } = visDefinition
117
-
118
- let data: DashboardUIVisualisation['data']
119
-
120
- switch (type) {
121
- case DashboardVisualisationType.LIST:
122
- data = DashboardListUtils.createList(visDefinition as ListVisualisation, dashboardData)
123
- break
124
-
125
- case DashboardVisualisationType.SCORECARD:
126
- hasScorecard = true
127
- data = new ScorecardVisualisation(dashboardData, visDefinition).build()
128
- break
129
-
130
- case DashboardVisualisationType.SCORECARD_GROUP:
131
- data = new ScorecardVisualisation(dashboardData, visDefinition, true).build()
132
- break
133
-
134
- case DashboardVisualisationType.BAR:
135
- case DashboardVisualisationType.LINE:
136
- case DashboardVisualisationType.DONUT: {
137
- data = ChartUtils.createChart(visDefinition, dashboardData)
138
- break
139
- }
140
- case DashboardVisualisationType.MATRIX:
141
- case DashboardVisualisationType.MATRIX_TIMESERIES: {
142
- data = ChartUtils.createMatrixChart(visDefinition, dashboardData, query)
143
- break
116
+ const visualisations: DashboardVisualisation[] = section.visualisations.map(
117
+ (visDefinition: components['schemas']['DashboardVisualisationDefinition']) => {
118
+ const { type, display, description: visDescription, id: visId } = visDefinition
119
+
120
+ let data: DashboardVisualisation['data'] | undefined
121
+
122
+ switch (type) {
123
+ case DashboardVisualisationType.LIST:
124
+ data = DashboardListUtils.createList(visDefinition, dashboardData)
125
+ break
126
+
127
+ case DashboardVisualisationType.SCORECARD:
128
+ hasScorecard = true
129
+ data = new ScorecardVisualisation(dashboardData, visDefinition).build()
130
+ break
131
+
132
+ case DashboardVisualisationType.SCORECARD_GROUP:
133
+ data = new ScorecardVisualisation(dashboardData, visDefinition, true).build()
134
+ break
135
+
136
+ case DashboardVisualisationType.BAR:
137
+ case DashboardVisualisationType.LINE:
138
+ case DashboardVisualisationType.DONUT: {
139
+ data = ChartUtils.createChart(visDefinition, dashboardData)
140
+ break
141
+ }
142
+ case DashboardVisualisationType.MATRIX_TIMESERIES: {
143
+ data = ChartUtils.createMatrixChart(visDefinition, dashboardData, query)
144
+ break
145
+ }
146
+ case DashboardVisualisationType.BAR_TIMESERIES:
147
+ case DashboardVisualisationType.LINE_TIMESERIES: {
148
+ data = ChartUtils.createTimeseriesCharts(visDefinition, dashboardData)
149
+ break
150
+ }
151
+ default:
152
+ break
144
153
  }
145
- case DashboardVisualisationType.BAR_TIMESERIES:
146
- case DashboardVisualisationType.LINE_TIMESERIES: {
147
- data = ChartUtils.createTimeseriesCharts(visDefinition, dashboardData)
148
- break
149
- }
150
- default:
151
- break
152
- }
153
154
 
154
- return {
155
- id: visId,
156
- title: display,
157
- description: visDescription,
158
- type,
159
- data,
160
- }
161
- })
155
+ return {
156
+ id: visId,
157
+ title: display,
158
+ description: visDescription,
159
+ type,
160
+ data,
161
+ }
162
+ },
163
+ )
162
164
 
163
165
  if (hasScorecard) ScorecardsUtils.mergeScorecardsIntoGroup(visualisations)
164
166
 
@@ -170,15 +172,14 @@ const updateStore = async (
170
172
  services: Services,
171
173
  tableId: string,
172
174
  userId: string,
173
- sections: DashboardUISection[],
174
- url: Url,
175
+ sections: DashboardSection[],
175
176
  req: Request,
176
177
  filters: FilterValue[],
177
- ) => {
178
- const dashboardRequestData: RequestedReport = await services.requestedReportService.getReportByTableId(
179
- tableId,
180
- userId,
181
- )
178
+ ): Promise<RequestedReport | undefined> => {
179
+ const { requestedReportService } = services
180
+ const dashboardRequestData = requestedReportService
181
+ ? await requestedReportService.getReportByTableId(tableId, userId)
182
+ : undefined
182
183
 
183
184
  // Add to recently viewed
184
185
  if (sections && sections.length && dashboardRequestData) {
@@ -197,6 +198,7 @@ const updateStore = async (
197
198
  export const renderAsyncDashboard = async ({ req, res, services, next }: AsyncReportUtilsParams) => {
198
199
  const { token, csrfToken, dprUser, nestedBaseUrl } = LocalsHelper.getValues(res)
199
200
  const { reportId, id, tableId } = req.params
201
+ const { bookmarkService, requestedReportService } = services
200
202
  const url = parseUrl(req)
201
203
 
202
204
  // Get the definition Data
@@ -218,10 +220,13 @@ export const renderAsyncDashboard = async ({ req, res, services, next }: AsyncRe
218
220
  const flattenedData: DashboardDataResponse[] = dashboardData.flat()
219
221
 
220
222
  // Get the dashboard parts
221
- const sections: DashboardUISection[] = getSections(dashboardDefinition, flattenedData, query)
223
+ const sections: DashboardSection[] = getSections(dashboardDefinition, flattenedData, query)
222
224
 
223
225
  // Update the store
224
- const dashboardRequestData = await updateStore(services, tableId, dprUser.id, sections, url, req, filters.filters)
226
+ let dashboardRequestData
227
+ if (requestedReportService) {
228
+ dashboardRequestData = await updateStore(services, tableId, dprUser.id, sections, req, filters.filters)
229
+ }
225
230
 
226
231
  return {
227
232
  dashboardData: {
@@ -231,7 +236,7 @@ export const renderAsyncDashboard = async ({ req, res, services, next }: AsyncRe
231
236
  name: dashboardDefinition.name,
232
237
  description: dashboardDefinition.description,
233
238
  reportName: reportDefinition.name,
234
- bookmarked: await services.bookmarkService.isBookmarked(id, reportId, dprUser.id),
239
+ bookmarked: bookmarkService ? await bookmarkService.isBookmarked(id, reportId, dprUser.id) : false,
235
240
  nestedBaseUrl,
236
241
  csrfToken,
237
242
  sections,
@@ -1,2 +1,2 @@
1
- var f=Object.create;var o=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},d=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of w(e))!S.call(t,a)&&a!==r&&o(t,a,{get:()=>e[a],enumerable:!(s=R(e,a))||s.enumerable});return t};var p=(t,e,r)=>(r=t!=null?f(E(t)):{},d(e||!t||!t.__esModule?o(r,"default",{value:t,enumerable:!0}):r,t)),H=t=>d(o({},"__esModule",{value:!0}),t);var P={};b(P,{ViewAyncReportController:()=>y,default:()=>I});module.exports=H(P);var m=p(require("../../../../../components/error-summary/utils")),u=p(require("../../../../../utils/localsHelper")),h=p(require("./utils")),n=p(require("../../utils"));class y{constructor(e,r){this.GET=async(e,r,s)=>{const{type:a}=e.params;try{const l={req:e,res:r,services:this.services,next:s},i=await h.default.renderReport(l);r.render("dpr/routes/journeys/view-report/report",{layoutPath:this.layoutPath,...i})}catch(l){const i=m.default.handleError(l,e.params.type);let c;if(i.status==="EXPIRED"){const{dprUser:v}=u.default.getValues(r);c=await this.services.recentlyViewedService.asyncSetToExpiredByTableId(e.params.tableId,v.id)}e.body.title=`Failed to retrieve ${a}`,e.body.error=i,c&&(e.body.refreshLink=c),s()}};this.applyFilters=async(e,r,s)=>{await n.default.applyReportInteractiveQuery(e,r,this.services,"filters")};this.applyColumns=async(e,r,s)=>{await n.default.applyReportInteractiveQuery(e,r,this.services,"columns")};this.layoutPath=e,this.services=r}}var I=y;0&&(module.exports={ViewAyncReportController});
1
+ var R=Object.create;var i=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var H=(t,r)=>{for(var e in r)i(t,e,{get:r[e],enumerable:!0})},m=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of E(r))!b.call(t,o)&&o!==e&&i(t,o,{get:()=>r[o],enumerable:!(s=w(r,o))||s.enumerable});return t};var p=(t,r,e)=>(e=t!=null?R(S(t)):{},m(r||!t||!t.__esModule?i(e,"default",{value:t,enumerable:!0}):e,t)),I=t=>m(i({},"__esModule",{value:!0}),t);var x={};H(x,{ViewAyncReportController:()=>y,default:()=>P});module.exports=I(x);var u=p(require("../../../../../components/error-summary/utils")),h=p(require("../../../../../utils/localsHelper")),v=p(require("./utils")),n=p(require("../../utils"));class y{constructor(r,e){this.GET=async(r,e,s)=>{const{type:o}=r.params;try{const c={req:r,res:e,services:this.services,next:s},a=await v.default.renderReport(c);e.render("dpr/routes/journeys/view-report/report",{layoutPath:this.layoutPath,...a})}catch(c){const a=u.default.handleError(c,r.params.type);let l;const{recentlyViewedService:d}=this.services;if(a.status==="EXPIRED"&&d){const{dprUser:f}=h.default.getValues(e);l=await d.asyncSetToExpiredByTableId(r.params.tableId,f.id)}r.body.title=`Failed to retrieve ${o}`,r.body.error=a,l&&(r.body.refreshLink=l),s()}};this.applyFilters=async(r,e,s)=>{await n.default.applyReportInteractiveQuery(r,e,this.services,"filters")};this.applyColumns=async(r,e,s)=>{await n.default.applyReportInteractiveQuery(r,e,this.services,"columns")};this.layoutPath=r,this.services=e}}var P=y;0&&(module.exports={ViewAyncReportController});
2
2
  //# sourceMappingURL=controller.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/dpr/routes/journeys/view-report/async/report/controller.ts"],
4
- "sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../../types/Services'\nimport ErrorSummaryUtils from '../../../../../components/error-summary/utils'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport AsyncReportUtils from './utils'\nimport ViewReportUtils from '../../utils'\n\nclass ViewAyncReportController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n GET: RequestHandler = async (req, res, next) => {\n const { type } = req.params\n try {\n const params = { req, res, services: this.services, next }\n\n const renderData = await AsyncReportUtils.renderReport(params)\n\n res.render(`dpr/routes/journeys/view-report/report`, {\n layoutPath: this.layoutPath,\n ...renderData,\n })\n } catch (error) {\n const dprError = ErrorSummaryUtils.handleError(error, req.params.type)\n let refreshLink\n if (dprError.status === 'EXPIRED') {\n const { dprUser } = LocalsHelper.getValues(res)\n refreshLink = await this.services.recentlyViewedService.asyncSetToExpiredByTableId(\n req.params.tableId,\n dprUser.id,\n )\n }\n req.body.title = `Failed to retrieve ${type}`\n req.body.error = dprError\n if (refreshLink) {\n req.body.refreshLink = refreshLink\n }\n next()\n }\n }\n\n applyFilters: RequestHandler = async (req, res, next) => {\n await ViewReportUtils.applyReportInteractiveQuery(req, res, this.services, 'filters')\n }\n\n applyColumns: RequestHandler = async (req, res, next) => {\n await ViewReportUtils.applyReportInteractiveQuery(req, res, this.services, 'columns')\n }\n}\n\nexport { ViewAyncReportController }\nexport default ViewAyncReportController\n"],
5
- "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAA8B,4DAC9BC,EAAyB,gDACzBD,EAA6B,sBAC7BA,EAA4B,0BAE5B,MAAMH,CAAyB,CAK7B,YAAYK,EAAoBC,EAAoB,CAKpD,SAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,KAAM,CAAE,KAAAC,CAAK,EAAIH,EAAI,OACrB,GAAI,CACF,MAAMI,EAAS,CAAE,IAAAJ,EAAK,IAAAC,EAAK,SAAU,KAAK,SAAU,KAAAC,CAAK,EAEnDG,EAAa,MAAM,EAAAC,QAAiB,aAAaF,CAAM,EAE7DH,EAAI,OAAO,yCAA0C,CACnD,WAAY,KAAK,WACjB,GAAGI,CACL,CAAC,CACH,OAASE,EAAO,CACd,MAAMC,EAAW,EAAAC,QAAkB,YAAYF,EAAOP,EAAI,OAAO,IAAI,EACrE,IAAIU,EACJ,GAAIF,EAAS,SAAW,UAAW,CACjC,KAAM,CAAE,QAAAG,CAAQ,EAAI,EAAAC,QAAa,UAAUX,CAAG,EAC9CS,EAAc,MAAM,KAAK,SAAS,sBAAsB,2BACtDV,EAAI,OAAO,QACXW,EAAQ,EACV,CACF,CACAX,EAAI,KAAK,MAAQ,sBAAsBG,CAAI,GAC3CH,EAAI,KAAK,MAAQQ,EACbE,IACFV,EAAI,KAAK,YAAcU,GAEzBR,EAAK,CACP,CACF,EAEA,kBAA+B,MAAOF,EAAKC,EAAKC,IAAS,CACvD,MAAM,EAAAW,QAAgB,4BAA4Bb,EAAKC,EAAK,KAAK,SAAU,SAAS,CACtF,EAEA,kBAA+B,MAAOD,EAAKC,EAAKC,IAAS,CACvD,MAAM,EAAAW,QAAgB,4BAA4Bb,EAAKC,EAAK,KAAK,SAAU,SAAS,CACtF,EAxCE,KAAK,WAAaH,EAClB,KAAK,SAAWC,CAClB,CAuCF,CAGA,IAAOL,EAAQD",
6
- "names": ["controller_exports", "__export", "ViewAyncReportController", "controller_default", "__toCommonJS", "import_utils", "import_localsHelper", "layoutPath", "services", "req", "res", "next", "type", "params", "renderData", "AsyncReportUtils", "error", "dprError", "ErrorSummaryUtils", "refreshLink", "dprUser", "LocalsHelper", "ViewReportUtils"]
4
+ "sourcesContent": ["import { RequestHandler } from 'express'\nimport { Services } from '../../../../../types/Services'\nimport ErrorSummaryUtils from '../../../../../components/error-summary/utils'\nimport LocalsHelper from '../../../../../utils/localsHelper'\nimport AsyncReportUtils from './utils'\nimport ViewReportUtils from '../../utils'\n\nclass ViewAyncReportController {\n layoutPath: string\n\n services: Services\n\n constructor(layoutPath: string, services: Services) {\n this.layoutPath = layoutPath\n this.services = services\n }\n\n GET: RequestHandler = async (req, res, next) => {\n const { type } = req.params\n try {\n const params = { req, res, services: this.services, next }\n\n const renderData = await AsyncReportUtils.renderReport(params)\n\n res.render(`dpr/routes/journeys/view-report/report`, {\n layoutPath: this.layoutPath,\n ...renderData,\n })\n } catch (error) {\n const dprError = ErrorSummaryUtils.handleError(<Error>error, req.params.type)\n let refreshLink\n const { recentlyViewedService } = this.services\n if (dprError.status === 'EXPIRED' && recentlyViewedService) {\n const { dprUser } = LocalsHelper.getValues(res)\n refreshLink = await recentlyViewedService.asyncSetToExpiredByTableId(req.params.tableId, dprUser.id)\n }\n req.body.title = `Failed to retrieve ${type}`\n req.body.error = dprError\n if (refreshLink) {\n req.body.refreshLink = refreshLink\n }\n next()\n }\n }\n\n applyFilters: RequestHandler = async (req, res, next) => {\n await ViewReportUtils.applyReportInteractiveQuery(req, res, this.services, 'filters')\n }\n\n applyColumns: RequestHandler = async (req, res, next) => {\n await ViewReportUtils.applyReportInteractiveQuery(req, res, this.services, 'columns')\n }\n}\n\nexport { ViewAyncReportController }\nexport default ViewAyncReportController\n"],
5
+ "mappings": "6iBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAEA,IAAAK,EAA8B,4DAC9BC,EAAyB,gDACzBD,EAA6B,sBAC7BA,EAA4B,0BAE5B,MAAMH,CAAyB,CAK7B,YAAYK,EAAoBC,EAAoB,CAKpD,SAAsB,MAAOC,EAAKC,EAAKC,IAAS,CAC9C,KAAM,CAAE,KAAAC,CAAK,EAAIH,EAAI,OACrB,GAAI,CACF,MAAMI,EAAS,CAAE,IAAAJ,EAAK,IAAAC,EAAK,SAAU,KAAK,SAAU,KAAAC,CAAK,EAEnDG,EAAa,MAAM,EAAAC,QAAiB,aAAaF,CAAM,EAE7DH,EAAI,OAAO,yCAA0C,CACnD,WAAY,KAAK,WACjB,GAAGI,CACL,CAAC,CACH,OAASE,EAAO,CACd,MAAMC,EAAW,EAAAC,QAAkB,YAAmBF,EAAOP,EAAI,OAAO,IAAI,EAC5E,IAAIU,EACJ,KAAM,CAAE,sBAAAC,CAAsB,EAAI,KAAK,SACvC,GAAIH,EAAS,SAAW,WAAaG,EAAuB,CAC1D,KAAM,CAAE,QAAAC,CAAQ,EAAI,EAAAC,QAAa,UAAUZ,CAAG,EAC9CS,EAAc,MAAMC,EAAsB,2BAA2BX,EAAI,OAAO,QAASY,EAAQ,EAAE,CACrG,CACAZ,EAAI,KAAK,MAAQ,sBAAsBG,CAAI,GAC3CH,EAAI,KAAK,MAAQQ,EACbE,IACFV,EAAI,KAAK,YAAcU,GAEzBR,EAAK,CACP,CACF,EAEA,kBAA+B,MAAOF,EAAKC,EAAKC,IAAS,CACvD,MAAM,EAAAY,QAAgB,4BAA4Bd,EAAKC,EAAK,KAAK,SAAU,SAAS,CACtF,EAEA,kBAA+B,MAAOD,EAAKC,EAAKC,IAAS,CACvD,MAAM,EAAAY,QAAgB,4BAA4Bd,EAAKC,EAAK,KAAK,SAAU,SAAS,CACtF,EAtCE,KAAK,WAAaH,EAClB,KAAK,SAAWC,CAClB,CAqCF,CAGA,IAAOL,EAAQD",
6
+ "names": ["controller_exports", "__export", "ViewAyncReportController", "controller_default", "__toCommonJS", "import_utils", "import_localsHelper", "layoutPath", "services", "req", "res", "next", "type", "params", "renderData", "AsyncReportUtils", "error", "dprError", "ErrorSummaryUtils", "refreshLink", "recentlyViewedService", "dprUser", "LocalsHelper", "ViewReportUtils"]
7
7
  }
@@ -27,14 +27,12 @@ class ViewAyncReportController {
27
27
  ...renderData,
28
28
  })
29
29
  } catch (error) {
30
- const dprError = ErrorSummaryUtils.handleError(error, req.params.type)
30
+ const dprError = ErrorSummaryUtils.handleError(<Error>error, req.params.type)
31
31
  let refreshLink
32
- if (dprError.status === 'EXPIRED') {
32
+ const { recentlyViewedService } = this.services
33
+ if (dprError.status === 'EXPIRED' && recentlyViewedService) {
33
34
  const { dprUser } = LocalsHelper.getValues(res)
34
- refreshLink = await this.services.recentlyViewedService.asyncSetToExpiredByTableId(
35
- req.params.tableId,
36
- dprUser.id,
37
- )
35
+ refreshLink = await recentlyViewedService.asyncSetToExpiredByTableId(req.params.tableId, dprUser.id)
38
36
  }
39
37
  req.body.title = `Failed to retrieve ${type}`
40
38
  req.body.error = dprError
@@ -1,2 +1,2 @@
1
- var x=Object.create;var b=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var g=(n,a,d,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of v(a))!V.call(n,i)&&i!==d&&b(n,i,{get:()=>a[i],enumerable:!(o=B(a,i))||o.enumerable});return n};var w=(n,a,d)=>(d=n!=null?x(F(n)):{},g(a||!n||!n.__esModule?b(d,"default",{value:n,enumerable:!0}):d,n));var l=require("../../../../../../../cypress-tests/cypressUtils"),f=w(require("../../../../../utils/DateMapper/DateMapper"));context("Viewing a report",()=>{const n="/embedded/platform/";let a,d;describe("List report page",()=>{before(()=>{cy.task("resetStubs"),cy.task("resetRedis"),cy.task("stubDefinitions"),cy.task("stubGetProductCollections"),cy.task("stubReportStatusMock"),cy.task("stubReportsFinishedStatus"),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubReportsFinishedStatus"),cy.task("stubTestDashboard8"),cy.task("stubMockDashboardsStatusFinished"),cy.task("stubRequestSuccessResult20"),cy.task("stubRequestSuccessResult10"),cy.task("stubRequestSuccessReportTablesCount"),cy.task("stubRequestSuccessResult100"),cy.task("stubViewAsyncReportingResults"),(0,l.requestReport)({name:"Successful Report",description:"this will succeed",path:n}),cy.url().then(o=>{a=o;const i=o.split("/");d=i[i.length-2]})}),beforeEach(()=>{cy.visit(a)}),describe("Report details",()=>{it("should show the report details",()=>{cy.findAllByRole("group").contains("Report details").should("be.visible").click(),cy.findAllByRole("group").contains("Report details").parent().parent().within(()=>{cy.findAllByRole("row").each((o,i)=>{cy.wrap(o).within(()=>{switch(i){case 0:cy.findAllByRole("cell",{name:"Name:"}).should("exist"),cy.findAllByRole("cell",{name:"Successful Report"}).should("exist");break;case 1:cy.findAllByRole("cell",{name:"Product:"}).should("exist"),cy.findAllByRole("cell",{name:"Successful Report"}).should("exist");break;case 2:cy.findAllByRole("cell",{name:"Description:"}).should("exist"),cy.findAllByRole("cell",{name:"this will succeed"}).should("exist");break;case 3:cy.findAllByRole("cell",{name:"Classification:"}).should("exist"),cy.findAllByRole("cell",{name:"OFFICIAL"}).should("exist");break;case 4:cy.findAllByRole("cell",{name:"Requested at:"}).should("exist"),cy.findAllByRole("cell",{name:/\d{1,2}\/\d{1,2}\/\d{2,4}/}).should("exist");break;case 5:cy.findAllByRole("cell",{name:"Applied Filters:"}).should("exist"),cy.findAllByRole("listitem").each((c,e)=>{switch(e){case 0:cy.wrap(c).contains("Field 1: value1.2");break;case 1:cy.wrap(c).contains("Field 3 start: 01/02/2003");break;case 2:cy.wrap(c).contains("Field 3 end: 04/05/2006");break;case 3:cy.wrap(c).contains("Field 7: 01/02/2005");break;case 4:cy.wrap(c).contains("Field 8: value8.2,value8.3");break;case 5:cy.wrap(c).contains("Sort column: Field 1");break;case 6:cy.wrap(c).contains("Sort direction: Descending");break;default:break}});break;default:break}})})})})}),describe("Actions",()=>{it("should show the actions and go to the filters page when refresh action is clicked",()=>{cy.findByLabelText("Refresh report").should("be.visible"),cy.findByLabelText(/Print screen/).should("be.visible").should("be.disabled"),cy.findByLabelText(/download/).should("be.visible"),cy.findByLabelText(/Copy report link/).should("be.visible"),cy.findByRole("button",{name:/Add bookmark/}).should("be.visible"),cy.findByLabelText("Refresh report").should("be.visible").click(),cy.url().should("match",/.*\/embedded\/platform\/dpr\/request-report\/report\/request-examples\/request-example-success\/filters/i),cy.location().should(o=>{expect(o.search).to.contain("filters.field1=value1.2"),expect(o.search).to.contain("filters.field3.start=2003-02-01"),expect(o.search).to.contain("filters.field3.end=2006-05-04"),expect(o.search).to.contain("filters.field7=2005-02-01"),expect(o.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")})})}),describe("Column interactions",()=>{const o=()=>{cy.findByRole("checkbox",{name:"Field 1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 2"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 3"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 4"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 5"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 6"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 7"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 8"}).should("not.be.checked"),cy.location().should(e=>{expect(e.search).to.contain("columns=field1"),expect(e.search).to.contain("columns=field2"),expect(e.search).to.contain("columns=field3"),expect(e.search).not.to.contain("columns=field4"),expect(e.search).not.to.contain("columns=field5"),expect(e.search).to.contain("columns=field6"),expect(e.search).to.contain("columns=field7"),expect(e.search).not.to.contain("columns=field8")}),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("row").eq(1).within(()=>{cy.findAllByRole("columnheader").should("have.length",5)})})})},i=()=>{cy.findByRole("checkbox",{name:"Field 1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 2"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 4"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 5"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 6"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 7"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 8"}).should("be.checked"),cy.location().should(e=>{expect(e.search).not.to.contain("columns=field1"),expect(e.search).to.contain("columns=field2"),expect(e.search).not.to.contain("columns=field3"),expect(e.search).not.to.contain("columns=field4"),expect(e.search).to.contain("columns=field5"),expect(e.search).to.contain("columns=field6"),expect(e.search).not.to.contain("columns=field7"),expect(e.search).to.contain("columns=field8")}),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("row").eq(1).within(()=>{cy.findAllByRole("columnheader").should("have.length",4)})})})},c=()=>{cy.findByRole("checkbox",{name:"Field 1"}).uncheck(),cy.findByRole("checkbox",{name:"Field 3"}).uncheck(),cy.findByRole("checkbox",{name:"Field 5"}).check(),cy.findByRole("checkbox",{name:"Field 7"}).uncheck(),cy.findByRole("checkbox",{name:"Field 8"}).check()};it("should initialise the column content correctly",()=>{cy.findAllByRole("group").contains(/Show columns/).should("be.visible").click(),o(),cy.findAllByRole("group").contains("Show columns (5 of 8 shown)"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("columnheader").each((e,s)=>{switch(s){case 0:cy.wrap(e).contains("Field 1");break;case 1:cy.wrap(e).contains("Field 2");break;case 2:cy.wrap(e).contains("Field 3");break;case 3:cy.wrap(e).contains("Field 6");break;case 4:cy.wrap(e).contains("Field 7");break;default:break}})})})}),it("should apply the columns",()=>{cy.findAllByRole("group").contains(/Show columns/).click(),c(),cy.findByRole("button",{name:"Apply columns"}).click(),i(),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("columnheader").each((e,s)=>{switch(s){case 0:cy.wrap(e).contains("Field 2");break;case 1:cy.wrap(e).contains("Field 5");break;case 2:cy.wrap(e).contains("Field 6");break;case 3:cy.wrap(e).contains("Field 8");break;default:break}})})})}),it("should reset the columns to their DPD defaults",()=>{cy.findAllByRole("group").contains(/Show columns/).click(),c(),cy.findByRole("button",{name:"Apply columns"}).click(),i(),cy.findAllByRole("group").contains(/Show columns/).click(),cy.findByRole("link",{name:"Reset columns"}).click(),o()}),it("should apply the columns from the URL",()=>{cy.visit(`/embedded/platform/dpr/view-report/async/report/request-examples/request-example-success/${d}/report?columns=field1&columns=field5&columns=field8`),cy.findByRole("checkbox",{name:"Field 1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 2"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 4"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 5"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 6"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 7"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 8"}).should("be.checked"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("columnheader").each((e,s)=>{switch(s){case 0:cy.wrap(e).contains("Field 1");break;case 1:cy.wrap(e).contains("Field 2");break;case 2:cy.wrap(e).contains("Field 5");break;case 3:cy.wrap(e).contains("Field 6");break;case 4:cy.wrap(e).contains("Field 8");break;default:break}})})})}),it("should only apply mandatory columms",()=>{cy.findAllByRole("group").contains(/Show columns/).click(),cy.findByRole("checkbox",{name:"Field 1"}).uncheck(),cy.findByRole("checkbox",{name:"Field 3"}).uncheck(),cy.findByRole("checkbox",{name:"Field 7"}).uncheck(),cy.findByRole("button",{name:"Apply columns"}).click(),cy.findByRole("checkbox",{name:"Field 1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 2"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 4"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 5"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 6"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 7"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 8"}).should("not.be.checked"),cy.location().should(e=>{expect(e.search).not.to.contain("columns=field1"),expect(e.search).to.contain("columns=field2"),expect(e.search).not.to.contain("columns=field3"),expect(e.search).not.to.contain("columns=field4"),expect(e.search).not.to.contain("columns=field5"),expect(e.search).to.contain("columns=field6"),expect(e.search).not.to.contain("columns=field7"),expect(e.search).not.to.contain("columns=field8")}),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("row").eq(1).within(()=>{cy.findAllByRole("columnheader").should("have.length",2)})})})})}),describe("Paging interaction",()=>{it("should show the table totals",()=>{cy.findAllByRole("paragraph").contains(/Showing \d{1,4} to \d{1,4} of \d{1,4} results/).should("exist"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",20)})})}),it("should change the page size",()=>{cy.get("#page-size-select").select("10"),cy.findAllByRole("paragraph").contains(/Showing 1 to 10 of 100 results/).should("exist"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",10)})})}),it("should change the page size via the URL",()=>{cy.visit(`/embedded/platform/dpr/view-report/async/report/request-examples/request-example-success/${d}/report?pageSize=100`),cy.findAllByRole("paragraph").contains(/100 total results/).should("exist"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",100)})})}),it("should change the page",()=>{cy.findByLabelText("Page 5").click(),cy.location().should(o=>{expect(o.search).to.contain("selectedPage=5")})}),it("should change the page via the URL",()=>{cy.visit(`/embedded/platform/dpr/view-report/async/report/request-examples/request-example-success/${d}/report?selectedPage=3`),cy.findByRole("link",{current:"page"}).contains("3")})})}),describe("Interactive report",()=>{const o=()=>{cy.findByRole("button",{name:"Apply filters"}).click()},i=()=>{cy.findAllByRole("group").contains(/Show filters/).click()};before(()=>{cy.task("resetStubs"),cy.task("resetRedis"),cy.task("stubDefinitions"),cy.task("stubGetProductCollections"),cy.task("stubDefinitionFeatureTestingInteractive"),cy.task("stubReportStatusMock"),cy.task("stubAsyncRequestSuccessReportTablesCount"),cy.task("stubViewAsyncReportingResults"),cy.task("stubRequestSuccessResult20"),cy.task("stubRequestSuccessResult100")}),describe("Apply filters",()=>{before(()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),cy.url().then(e=>{a=e})}),beforeEach(()=>{cy.visit(a)});const c=()=>{for(let e=0;e<4;e+=1)cy.findByLabelText("Selected filters").within(()=>{cy.findAllByRole("link").first().click()})};describe("Date range",()=>{it("should apply the date range",()=>{cy.findByRole("textbox",{name:"From"}).should("have.value","01/02/2003"),cy.findByRole("textbox",{name:"To"}).should("have.value","04/05/2006"),c(),i(),cy.findByRole("textbox",{name:"From"}).type("02/05/2025"),cy.findByRole("textbox",{name:"To"}).type("05/07/2025").blur(),o(),cy.location().should(e=>{expect(e.search).to.contain("filters.field3.start=2025-05-02"),expect(e.search).to.contain("filters.field3.end=2025-07-05")}),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 3",value:"02/05/2025 - 05/07/2025"}]})}),it("should apply the relative daterange",()=>{c(),i(),cy.findByRole("tab",{name:"Preset date ranges"}).click(),cy.findByRole("radio",{name:"Tomorrow"}).check(),o();let e,s;cy.findByRole("textbox",{name:"From"}).invoke("val").should("not.be.empty").then(t=>{e=t}),cy.findByRole("textbox",{name:"To"}).invoke("val").should("not.be.empty").then(t=>{s=t});const u=new f.default;cy.location().should(t=>{expect(t.search).to.contain(`filters.field3.start=${u.toDateString(e,"iso")}`),expect(t.search).to.contain(`filters.field3.end=${u.toDateString(s,"iso")}`),expect(t.search).to.contain("filters.field3.relative-duration=tomorrow")}),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 3",value:"Tomorrow"}]})})}),describe("Multiselect",()=>{it("should apply the multiselect values",()=>{cy.findByRole("checkbox",{name:"Value 8.2"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("be.checked"),c(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),cy.findByRole("checkbox",{name:"Value 8.3"}).check(),o(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 8",value:"Value 8.1, Value 8.3"}]})}),it("should set the selected filter values correctly",()=>{cy.findByRole("checkbox",{name:"Value 8.2"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("be.checked"),c(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),cy.findByRole("checkbox",{name:"Value 8.2"}).check(),cy.findByRole("checkbox",{name:"Value 8.3"}).check(),cy.findByRole("checkbox",{name:"Value 8.4"}).check(),o(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("be.checked"),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}]})}),it("should set the values correctly when only one checkbox selected",()=>{c(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),o(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 8",value:"Value 8.1"}]})})}),it("Applying filters should persist current applied columns",()=>{cy.findAllByRole("group").contains(/Show columns/).should("be.visible").click(),cy.findByRole("checkbox",{name:"Field 1"}).uncheck(),cy.findByRole("checkbox",{name:"Field 3"}).uncheck(),cy.findByRole("checkbox",{name:"Field 5"}).check(),cy.findByRole("checkbox",{name:"Field 7"}).uncheck(),cy.findByRole("checkbox",{name:"Field 8"}).check(),cy.findByRole("button",{name:"Apply columns"}).click(),cy.findAllByRole("group").contains("Show columns (4 of 8 shown)"),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),cy.findByRole("checkbox",{name:"Value 8.3"}).check(),o(),cy.findAllByRole("group").contains("Show columns (4 of 8 shown)")})}),describe("User defined interactive defaults",()=>{const c=()=>cy.findByRole("button",{name:"Save current filter values as defaults"}),e=()=>cy.findByRole("button",{name:"Update defaults"}),s=()=>cy.findByRole("button",{name:"Delete defaults"}),u=({name:t,product:y,length:p,selectedFilters:k})=>{cy.findByLabelText(/Viewed \(/).within(()=>{cy.findByRole("row",{name:(r,h)=>h.textContent.includes(t)&&h.textContent.includes(y)}).within(()=>{cy.findAllByRole("listitem").should("have.length",p).each((r,h)=>{if(k[h]){const{key:m,value:R}=k[h];cy.wrap(r).contains(m),cy.wrap(r).contains(R)}})})})};it("should save the interactive filters correctly",()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]}),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),cy.findByRole("checkbox",{name:"Value 8.4"}).check(),cy.findByRole("combobox",{name:"Field 2"}).select("value2.2"),o();const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}];(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),c().click(),e().should("exist"),s().should("exist"),(0,l.checkSelectedFilterValues)({length:6,buttonValues:t})}),it("should init the report with saved interactive defaults",()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),cy.url().then(y=>{a=y}),e().should("exist"),s().should("exist");const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}];(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:5,selectedFilters:t})}),it("should reset the filter values to the saved defaults",()=>{cy.visit(a),e().should("exist"),s().should("exist");const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}];(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).uncheck(),cy.findByRole("checkbox",{name:"Value 8.3"}).uncheck(),cy.findByRole("combobox",{name:"Field 2"}).select("value2.3"),o(),(0,l.checkSelectedFilterValues)({length:6,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.3"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.4"}]}),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:5,selectedFilters:[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.3"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.4"}]}),cy.visit(a),cy.findByRole("link",{name:"Reset filters"}).click(),(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:5,selectedFilters:t})}),it("should update the filter values and init the report with the updated interactive defaults",()=>{cy.visit(a),e().should("exist"),s().should("exist"),(0,l.checkSelectedFilterValues)({length:6,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}]}),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).uncheck(),cy.findByRole("checkbox",{name:"Value 8.3"}).uncheck(),cy.findByRole("combobox",{name:"Field 2"}).select("value2.3"),o();const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.3"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.4"}];(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),e().click(),(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),cy.url().then(y=>{a=y}),(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),e().should("exist"),s().should("exist"),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:5,selectedFilters:t})}),it("should delete the saved defaults",()=>{cy.visit(a),(0,l.checkSelectedFilterValues)({length:6,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.3"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.4"}]}),s().click(),(0,l.checkSelectedFilterValues)({length:5,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]}),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:4,selectedFilters:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]})}),describe("Input types",()=>{describe("Relative date range",()=>{it("should save the relative daterange",()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]}),i(),cy.findByRole("tab",{name:"Preset date ranges"}).click(),cy.findByRole("radio",{name:"Tomorrow"}).check(),o();const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"Tomorrow"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}];(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),c().click(),e().should("exist"),s().should("exist"),(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),s().click()})}),describe("Multiselect",()=>{it("should save a single multiselect value",()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]}),i(),cy.findByRole("checkbox",{name:"Value 8.3"}).uncheck(),o();const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2"}];(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),c().click(),e().should("exist"),s().should("exist"),(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),s().click()})})})}),describe("Sorting",()=>{before(()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),cy.url().then(c=>{a=c})}),beforeEach(()=>{cy.visit(a)}),it("should show the sort direction in the column header and the url",()=>{cy.findByRole("link",{name:"Reset filters"}).click(),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-ascending"),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-none"),cy.findByRole("link",{name:"Field 1"}).click(),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-descending"),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-none"),cy.location().should(c=>{expect(c.search).to.contain("&sortColumn=field1&sortedAsc=false"),expect(c.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")}),cy.findByRole("link",{name:"Field 1"}).click(),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-ascending"),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-none"),cy.location().should(c=>{expect(c.search).to.contain("&sortColumn=field1&sortedAsc=true"),expect(c.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")}),cy.findByRole("link",{name:"Field 2"}).click(),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-ascending"),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-none"),cy.location().should(c=>{expect(c.search).to.contain("&sortColumn=field2&sortedAsc=true"),expect(c.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")}),cy.findByRole("link",{name:"Field 2"}).click(),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-descending"),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-none"),cy.location().should(c=>{expect(c.search).to.contain("&sortColumn=field2&sortedAsc=false"),expect(c.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")})})})})});
1
+ var x=Object.create;var b=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var g=(n,a,s,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of v(a))!V.call(n,i)&&i!==s&&b(n,i,{get:()=>a[i],enumerable:!(o=B(a,i))||o.enumerable});return n};var w=(n,a,s)=>(s=n!=null?x(F(n)):{},g(a||!n||!n.__esModule?b(s,"default",{value:n,enumerable:!0}):s,n));var l=require("../../../../../../../cypress-tests/cypressUtils"),f=w(require("../../../../../utils/DateMapper/DateMapper"));context("Viewing a report",()=>{const n="/embedded/platform/";let a,s;describe("List report page",()=>{before(()=>{(0,l.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult10"),cy.task("stubRequestSuccessResult20"),cy.task("stubRequestSuccessResult100"),(0,l.requestReport)({name:"Successful Report",description:"this will succeed",path:n}),cy.url().then(o=>{a=o;const i=o.split("/");s=i[i.length-2]})}),beforeEach(()=>{cy.visit(a)}),describe("Report details",()=>{it("should show the report details",()=>{cy.findAllByRole("group").contains("Report details").should("be.visible").click(),cy.findAllByRole("group").contains("Report details").parent().parent().within(()=>{cy.findAllByRole("row").each((o,i)=>{cy.wrap(o).within(()=>{switch(i){case 0:cy.findAllByRole("cell",{name:"Name:"}).should("exist"),cy.findAllByRole("cell",{name:"Successful Report"}).should("exist");break;case 1:cy.findAllByRole("cell",{name:"Product:"}).should("exist"),cy.findAllByRole("cell",{name:"Successful Report"}).should("exist");break;case 2:cy.findAllByRole("cell",{name:"Description:"}).should("exist"),cy.findAllByRole("cell",{name:"this will succeed"}).should("exist");break;case 3:cy.findAllByRole("cell",{name:"Classification:"}).should("exist"),cy.findAllByRole("cell",{name:"OFFICIAL"}).should("exist");break;case 4:cy.findAllByRole("cell",{name:"Requested at:"}).should("exist"),cy.findAllByRole("cell",{name:/\d{1,2}\/\d{1,2}\/\d{2,4}/}).should("exist");break;case 5:cy.findAllByRole("cell",{name:"Applied Filters:"}).should("exist"),cy.findAllByRole("listitem").each((c,e)=>{switch(e){case 0:cy.wrap(c).contains("Field 1: value1.2");break;case 1:cy.wrap(c).contains("Field 3 start: 01/02/2003");break;case 2:cy.wrap(c).contains("Field 3 end: 04/05/2006");break;case 3:cy.wrap(c).contains("Field 7: 01/02/2005");break;case 4:cy.wrap(c).contains("Field 8: value8.2,value8.3");break;case 5:cy.wrap(c).contains("Sort column: Field 1");break;case 6:cy.wrap(c).contains("Sort direction: Descending");break;default:break}});break;default:break}})})})})}),describe("Actions",()=>{it("should show the actions and go to the filters page when refresh action is clicked",()=>{cy.findByLabelText("Refresh report").should("be.visible"),cy.findByLabelText(/Print screen/).should("be.visible").should("be.disabled"),cy.findByLabelText(/download/).should("be.visible"),cy.findByLabelText(/Copy report link/).should("be.visible"),cy.findByRole("button",{name:/Add bookmark/}).should("be.visible"),cy.findByLabelText("Refresh report").should("be.visible").click(),cy.url().should("match",/.*\/embedded\/platform\/dpr\/request-report\/report\/request-examples\/request-example-success\/filters/i),cy.location().should(o=>{expect(o.search).to.contain("filters.field1=value1.2"),expect(o.search).to.contain("filters.field3.start=2003-02-01"),expect(o.search).to.contain("filters.field3.end=2006-05-04"),expect(o.search).to.contain("filters.field7=2005-02-01"),expect(o.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")})})}),describe("Column interactions",()=>{const o=()=>{cy.findByRole("checkbox",{name:"Field 1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 2"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 3"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 4"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 5"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 6"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 7"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 8"}).should("not.be.checked"),cy.location().should(e=>{expect(e.search).to.contain("columns=field1"),expect(e.search).to.contain("columns=field2"),expect(e.search).to.contain("columns=field3"),expect(e.search).not.to.contain("columns=field4"),expect(e.search).not.to.contain("columns=field5"),expect(e.search).to.contain("columns=field6"),expect(e.search).to.contain("columns=field7"),expect(e.search).not.to.contain("columns=field8")}),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("row").eq(1).within(()=>{cy.findAllByRole("columnheader").should("have.length",5)})})})},i=()=>{cy.findByRole("checkbox",{name:"Field 1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 2"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 4"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 5"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 6"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 7"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 8"}).should("be.checked"),cy.location().should(e=>{expect(e.search).not.to.contain("columns=field1"),expect(e.search).to.contain("columns=field2"),expect(e.search).not.to.contain("columns=field3"),expect(e.search).not.to.contain("columns=field4"),expect(e.search).to.contain("columns=field5"),expect(e.search).to.contain("columns=field6"),expect(e.search).not.to.contain("columns=field7"),expect(e.search).to.contain("columns=field8")}),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("row").eq(1).within(()=>{cy.findAllByRole("columnheader").should("have.length",4)})})})},c=()=>{cy.findByRole("checkbox",{name:"Field 1"}).uncheck(),cy.findByRole("checkbox",{name:"Field 3"}).uncheck(),cy.findByRole("checkbox",{name:"Field 5"}).check(),cy.findByRole("checkbox",{name:"Field 7"}).uncheck(),cy.findByRole("checkbox",{name:"Field 8"}).check()};it("should initialise the column content correctly",()=>{cy.findAllByRole("group").contains(/Show columns/).should("be.visible").click(),o(),cy.findAllByRole("group").contains("Show columns (5 of 8 shown)"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("columnheader").each((e,d)=>{switch(d){case 0:cy.wrap(e).contains("Field 1");break;case 1:cy.wrap(e).contains("Field 2");break;case 2:cy.wrap(e).contains("Field 3");break;case 3:cy.wrap(e).contains("Field 6");break;case 4:cy.wrap(e).contains("Field 7");break;default:break}})})})}),it("should apply the columns",()=>{cy.findAllByRole("group").contains(/Show columns/).click(),c(),cy.findByRole("button",{name:"Apply columns"}).click(),i(),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("columnheader").each((e,d)=>{switch(d){case 0:cy.wrap(e).contains("Field 2");break;case 1:cy.wrap(e).contains("Field 5");break;case 2:cy.wrap(e).contains("Field 6");break;case 3:cy.wrap(e).contains("Field 8");break;default:break}})})})}),it("should reset the columns to their DPD defaults",()=>{cy.findAllByRole("group").contains(/Show columns/).click(),c(),cy.findByRole("button",{name:"Apply columns"}).click(),i(),cy.findAllByRole("group").contains(/Show columns/).click(),cy.findByRole("link",{name:"Reset columns"}).click(),o()}),it("should apply the columns from the URL",()=>{cy.visit(`/embedded/platform/dpr/view-report/async/report/request-examples/request-example-success/${s}/report?columns=field1&columns=field5&columns=field8`),cy.findByRole("checkbox",{name:"Field 1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 2"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 4"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 5"}).should("be.checked"),cy.findByRole("checkbox",{name:"Field 6"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 7"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 8"}).should("be.checked"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("columnheader").each((e,d)=>{switch(d){case 0:cy.wrap(e).contains("Field 1");break;case 1:cy.wrap(e).contains("Field 2");break;case 2:cy.wrap(e).contains("Field 5");break;case 3:cy.wrap(e).contains("Field 6");break;case 4:cy.wrap(e).contains("Field 8");break;default:break}})})})}),it("should only apply mandatory columms",()=>{cy.findAllByRole("group").contains(/Show columns/).click(),cy.findByRole("checkbox",{name:"Field 1"}).uncheck(),cy.findByRole("checkbox",{name:"Field 3"}).uncheck(),cy.findByRole("checkbox",{name:"Field 7"}).uncheck(),cy.findByRole("button",{name:"Apply columns"}).click(),cy.findByRole("checkbox",{name:"Field 1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 2"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 4"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 5"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 6"}).should("be.checked").should("be.disabled"),cy.findByRole("checkbox",{name:"Field 7"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Field 8"}).should("not.be.checked"),cy.location().should(e=>{expect(e.search).not.to.contain("columns=field1"),expect(e.search).to.contain("columns=field2"),expect(e.search).not.to.contain("columns=field3"),expect(e.search).not.to.contain("columns=field4"),expect(e.search).not.to.contain("columns=field5"),expect(e.search).to.contain("columns=field6"),expect(e.search).not.to.contain("columns=field7"),expect(e.search).not.to.contain("columns=field8")}),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("row").eq(1).within(()=>{cy.findAllByRole("columnheader").should("have.length",2)})})})})}),describe("Paging interaction",()=>{it("should show the table totals",()=>{cy.findAllByRole("paragraph").contains(/Showing \d{1,4} to \d{1,4} of \d{1,4} results/).should("exist"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",20)})})}),it("should change the page size",()=>{cy.get("#page-size-select").select("10"),cy.findAllByRole("paragraph").contains(/Showing 1 to 10 of 100 results/).should("exist"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",10)})})}),it("should change the page size via the URL",()=>{cy.visit(`/embedded/platform/dpr/view-report/async/report/request-examples/request-example-success/${s}/report?pageSize=100`),cy.findAllByRole("paragraph").contains(/100 total results/).should("exist"),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(1).within(()=>{cy.findAllByRole("row").should("have.length",100)})})}),it("should change the page",()=>{cy.findByLabelText("Page 5").click(),cy.location().should(o=>{expect(o.search).to.contain("selectedPage=5")})}),it("should change the page via the URL",()=>{cy.visit(`/embedded/platform/dpr/view-report/async/report/request-examples/request-example-success/${s}/report?selectedPage=3`),cy.findByRole("link",{current:"page"}).contains("3")})})}),describe("Interactive report",()=>{const o=()=>{cy.findByRole("button",{name:"Apply filters"}).click()},i=()=>{cy.findAllByRole("group").contains(/Show filters/).click()};before(()=>{(0,l.executeReportStubs)(),cy.task("stubDefinitionFeatureTestingInteractive"),cy.task("stubAsyncRequestSuccessReportTablesCount"),cy.task("stubRequestSuccessResult20"),cy.task("stubRequestSuccessResult100")}),describe("Apply filters",()=>{before(()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),cy.url().then(e=>{a=e})}),beforeEach(()=>{cy.visit(a)});const c=()=>{for(let e=0;e<4;e+=1)cy.findByLabelText("Selected filters").within(()=>{cy.findAllByRole("link").first().click()})};describe("Date range",()=>{it("should apply the date range",()=>{cy.findByRole("textbox",{name:"From"}).should("have.value","01/02/2003"),cy.findByRole("textbox",{name:"To"}).should("have.value","04/05/2006"),c(),i(),cy.findByRole("textbox",{name:"From"}).type("02/05/2025"),cy.findByRole("textbox",{name:"To"}).type("05/07/2025").blur(),o(),cy.location().should(e=>{expect(e.search).to.contain("filters.field3.start=2025-05-02"),expect(e.search).to.contain("filters.field3.end=2025-07-05")}),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 3",value:"02/05/2025 - 05/07/2025"}]})}),it("should apply the relative daterange",()=>{c(),i(),cy.findByRole("tab",{name:"Preset date ranges"}).click(),cy.findByRole("radio",{name:"Tomorrow"}).check(),o();let e,d;cy.findByRole("textbox",{name:"From"}).invoke("val").should("not.be.empty").then(t=>{e=t}),cy.findByRole("textbox",{name:"To"}).invoke("val").should("not.be.empty").then(t=>{d=t});const u=new f.default;cy.location().should(t=>{expect(t.search).to.contain(`filters.field3.start=${u.toDateString(e,"iso")}`),expect(t.search).to.contain(`filters.field3.end=${u.toDateString(d,"iso")}`),expect(t.search).to.contain("filters.field3.relative-duration=tomorrow")}),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 3",value:"Tomorrow"}]})})}),describe("Multiselect",()=>{it("should apply the multiselect values",()=>{cy.findByRole("checkbox",{name:"Value 8.2"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("be.checked"),c(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),cy.findByRole("checkbox",{name:"Value 8.3"}).check(),o(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 8",value:"Value 8.1, Value 8.3"}]})}),it("should set the selected filter values correctly",()=>{cy.findByRole("checkbox",{name:"Value 8.2"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("be.checked"),c(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),cy.findByRole("checkbox",{name:"Value 8.2"}).check(),cy.findByRole("checkbox",{name:"Value 8.3"}).check(),cy.findByRole("checkbox",{name:"Value 8.4"}).check(),o(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("be.checked"),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}]})}),it("should set the values correctly when only one checkbox selected",()=>{c(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),o(),cy.findByRole("checkbox",{name:"Value 8.1"}).should("be.checked"),cy.findByRole("checkbox",{name:"Value 8.2"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.3"}).should("not.be.checked"),cy.findByRole("checkbox",{name:"Value 8.4"}).should("not.be.checked"),(0,l.checkSelectedFilterValues)({length:2,buttonValues:[{key:"Field 8",value:"Value 8.1"}]})})}),it("Applying filters should persist current applied columns",()=>{cy.findAllByRole("group").contains(/Show columns/).should("be.visible").click(),cy.findByRole("checkbox",{name:"Field 1"}).uncheck(),cy.findByRole("checkbox",{name:"Field 3"}).uncheck(),cy.findByRole("checkbox",{name:"Field 5"}).check(),cy.findByRole("checkbox",{name:"Field 7"}).uncheck(),cy.findByRole("checkbox",{name:"Field 8"}).check(),cy.findByRole("button",{name:"Apply columns"}).click(),cy.findAllByRole("group").contains("Show columns (4 of 8 shown)"),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),cy.findByRole("checkbox",{name:"Value 8.3"}).check(),o(),cy.findAllByRole("group").contains("Show columns (4 of 8 shown)")})}),describe("User defined interactive defaults",()=>{const c=()=>cy.findByRole("button",{name:"Save current filter values as defaults"}),e=()=>cy.findByRole("button",{name:"Update defaults"}),d=()=>cy.findByRole("button",{name:"Delete defaults"}),u=({name:t,product:h,length:m,selectedFilters:k})=>{cy.findByLabelText(/Viewed \(/).within(()=>{cy.findByRole("row",{name:(r,y)=>y.textContent.includes(t)&&y.textContent.includes(h)}).within(()=>{cy.findAllByRole("listitem").should("have.length",m).each((r,y)=>{if(k[y]){const{key:p,value:R}=k[y];cy.wrap(r).contains(p),cy.wrap(r).contains(R)}})})})};it("should save the interactive filters correctly",()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]}),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).check(),cy.findByRole("checkbox",{name:"Value 8.4"}).check(),cy.findByRole("combobox",{name:"Field 2"}).select("value2.2"),o();const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}];(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),c().click(),e().should("exist"),d().should("exist"),(0,l.checkSelectedFilterValues)({length:6,buttonValues:t})}),it("should init the report with saved interactive defaults",()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),cy.url().then(h=>{a=h}),e().should("exist"),d().should("exist");const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}];(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:5,selectedFilters:t})}),it("should reset the filter values to the saved defaults",()=>{cy.visit(a),e().should("exist"),d().should("exist");const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}];(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).uncheck(),cy.findByRole("checkbox",{name:"Value 8.3"}).uncheck(),cy.findByRole("combobox",{name:"Field 2"}).select("value2.3"),o(),(0,l.checkSelectedFilterValues)({length:6,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.3"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.4"}]}),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:5,selectedFilters:[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.3"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.4"}]}),cy.visit(a),cy.findByRole("link",{name:"Reset filters"}).click(),(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:5,selectedFilters:t})}),it("should update the filter values and init the report with the updated interactive defaults",()=>{cy.visit(a),e().should("exist"),d().should("exist"),(0,l.checkSelectedFilterValues)({length:6,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.1, Value 8.2, Value 8.3 + 1 more"}]}),i(),cy.findByRole("checkbox",{name:"Value 8.1"}).uncheck(),cy.findByRole("checkbox",{name:"Value 8.3"}).uncheck(),cy.findByRole("combobox",{name:"Field 2"}).select("value2.3"),o();const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.3"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.4"}];(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),e().click(),(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),cy.url().then(h=>{a=h}),(0,l.checkSelectedFilterValues)({length:6,buttonValues:t}),e().should("exist"),d().should("exist"),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:5,selectedFilters:t})}),it("should delete the saved defaults",()=>{cy.visit(a),(0,l.checkSelectedFilterValues)({length:6,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 2",value:"Value 2.3"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.4"}]}),d().click(),(0,l.checkSelectedFilterValues)({length:5,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]}),cy.visit(n),cy.findByRole("tab",{name:/Viewed/}).click(),u({name:"Interactive Report",product:"Interactive Report",length:4,selectedFilters:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]})}),describe("Input types",()=>{describe("Relative date range",()=>{it("should save the relative daterange",()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]}),i(),cy.findByRole("tab",{name:"Preset date ranges"}).click(),cy.findByRole("radio",{name:"Tomorrow"}).check(),o();const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"Tomorrow"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}];(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),c().click(),e().should("exist"),d().should("exist"),(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),d().click()})}),describe("Multiselect",()=>{it("should save a single multiselect value",()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2, Value 8.3"}]}),i(),cy.findByRole("checkbox",{name:"Value 8.3"}).uncheck(),o();const t=[{key:"Field 1",value:"Value 1.2"},{key:"Field 3",value:"01/02/2003 - 04/05/2006"},{key:"Field 7",value:"01/02/2005"},{key:"Field 8",value:"Value 8.2"}];(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),c().click(),e().should("exist"),d().should("exist"),(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),(0,l.checkSelectedFilterValues)({length:5,buttonValues:t}),d().click()})})})}),describe("Sorting",()=>{before(()=>{(0,l.requestReport)({name:"Interactive Report",description:"this is an interactive report",path:n}),cy.url().then(c=>{a=c})}),beforeEach(()=>{cy.visit(a)}),it("should show the sort direction in the column header and the url",()=>{cy.findByRole("link",{name:"Reset filters"}).click(),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-ascending"),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-none"),cy.findByRole("link",{name:"Field 1"}).click(),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-descending"),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-none"),cy.location().should(c=>{expect(c.search).to.contain("&sortColumn=field1&sortedAsc=false"),expect(c.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")}),cy.findByRole("link",{name:"Field 1"}).click(),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-ascending"),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-none"),cy.location().should(c=>{expect(c.search).to.contain("&sortColumn=field1&sortedAsc=true"),expect(c.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")}),cy.findByRole("link",{name:"Field 2"}).click(),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-ascending"),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-none"),cy.location().should(c=>{expect(c.search).to.contain("&sortColumn=field2&sortedAsc=true"),expect(c.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")}),cy.findByRole("link",{name:"Field 2"}).click(),cy.findByRole("link",{name:"Field 2"}).should("have.class","data-table-header-button-sort-descending"),cy.findByRole("link",{name:"Field 1"}).should("have.class","data-table-header-button-sort-none"),cy.location().should(c=>{expect(c.search).to.contain("&sortColumn=field2&sortedAsc=false"),expect(c.search).to.contain("filters.field8=value8.2&filters.field8=value8.3")})})})})});
2
2
  //# sourceMappingURL=tests.cy.js.map