@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.23.1 → 4.24.0
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.
- package/dpr/components/_filters/filters-help/view.njk +9 -8
- package/dpr/data/dprReportingClient.js +1 -1
- package/dpr/data/dprReportingClient.js.map +3 -3
- package/dpr/data/dprReportingClient.ts +6 -3
- package/dpr/data/types.d.js +1 -1
- package/dpr/data/types.d.js.map +1 -1
- package/dpr/data/types.d.ts +6 -0
- package/dpr/middleware/setUpDprResources.js +1 -1
- package/dpr/middleware/setUpDprResources.js.map +3 -3
- package/dpr/middleware/setUpDprResources.test.ts +11 -0
- package/dpr/middleware/setUpDprResources.ts +37 -2
- package/dpr/routes/journeys/download-report/tests.cy.js +1 -1
- package/dpr/routes/journeys/download-report/tests.cy.js.map +3 -3
- package/dpr/routes/journeys/download-report/tests.cy.ts +1 -1
- package/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.js +1 -1
- package/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.js.map +3 -3
- package/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.ts +1 -1
- package/dpr/routes/journeys/product-collection/selected/tests.cy.js +1 -1
- package/dpr/routes/journeys/product-collection/selected/tests.cy.js.map +3 -3
- package/dpr/routes/journeys/product-collection/selected/tests.cy.ts +2 -2
- package/dpr/routes/journeys/request-report/filters/tests.cy.js +1 -1
- package/dpr/routes/journeys/request-report/filters/tests.cy.js.map +3 -3
- package/dpr/routes/journeys/request-report/filters/tests.cy.ts +3 -4
- package/dpr/routes/journeys/request-report/filters/view.njk +2 -2
- package/dpr/routes/journeys/request-report/status/tests.cy.js +1 -1
- package/dpr/routes/journeys/request-report/status/tests.cy.js.map +3 -3
- package/dpr/routes/journeys/request-report/status/tests.cy.ts +1 -1
- package/dpr/services/featureFlagService.js +2 -0
- package/dpr/services/featureFlagService.js.map +7 -0
- package/dpr/services/featureFlagService.ts +43 -0
- package/dpr/services/featureFlags.cy.js +2 -0
- package/dpr/services/featureFlags.cy.js.map +7 -0
- package/dpr/services/featureFlags.cy.ts +93 -0
- package/dpr/types/Services.d.js +1 -1
- package/dpr/types/Services.d.js.map +1 -1
- package/dpr/types/Services.d.ts +2 -0
- package/dpr/types/express.d.js +2 -0
- package/dpr/types/express.d.js.map +7 -0
- package/dpr/types/express.d.ts +14 -0
- package/dpr/utils/CreateDprServices.js +1 -1
- package/dpr/utils/CreateDprServices.js.map +2 -2
- package/dpr/utils/CreateDprServices.ts +4 -0
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{% from "govuk/components/button/macro.njk" import govukButton %}
|
|
2
2
|
{% from "govuk/components/details/macro.njk" import govukDetails %}
|
|
3
3
|
|
|
4
|
-
{% macro dprFiltersHelp(formId, hasDefaults, defaultsSaved) %}
|
|
4
|
+
{% macro dprFiltersHelp(saveDefaultsEnabled, formId, hasDefaults, defaultsSaved) %}
|
|
5
5
|
{% set helpHtml %}
|
|
6
6
|
<h2 class="govuk-!-margin-top-0">How to use</h2>
|
|
7
7
|
|
|
@@ -12,13 +12,14 @@
|
|
|
12
12
|
|
|
13
13
|
<h4>Selected Filters</h4>
|
|
14
14
|
<p class="govuk-body">Selected filters show the currently set filter values that will be used to generate your report. Clicking the selected button will remove filter. <br> "Reset filters" will reset the filters to their initial pre-defined default values</p>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
{% if saveDefaultsEnabled %}
|
|
16
|
+
<h4>Save current filter values as defaults</h4>
|
|
17
|
+
<p class="govuk-body">Save your current filter values as defaults so the next time you want to request this report, your default values will be prefilled.
|
|
18
|
+
You can update or delete your saved defaults to reset the report to its pre-defined default values.
|
|
19
|
+
If you have saved defaults, "Reset filters" will reset the values to your saved defaults.
|
|
20
|
+
Otherwise, it will reset to its intitial pre-defined default values
|
|
21
|
+
</p>
|
|
22
|
+
{% endif %}
|
|
22
23
|
|
|
23
24
|
<h4>Sort</h4>
|
|
24
25
|
<p>Select the sort column and sort direction for your generated report</p>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var g=Object.create;var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var R=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var r in t)l(e,r,{get:t[r],enumerable:!0})},a=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of F(t))!w.call(e,o)&&o!==r&&l(e,o,{get:()=>t[o],enumerable:!(n=u(t,o))||n.enumerable});return e};var i=(e,t,r)=>(r=e!=null?g(R(e)):{},a(t||!e||!e.__esModule?l(r,"default",{value:e,enumerable:!0}):r,e)),D=e=>a(l({},"__esModule",{value:!0}),e);var b={};S(b,{default:()=>v,initDprReportingClients:()=>d});module.exports=D(b);var m=i(require("./reportingClient")),p=i(require("./dashboardClient")),C=i(require("./reportDataStore")),s=require("../services/featureFlagService"),f=i(require("./productCollectionClient")),c=i(require("./missingReportClient"));const d=(e,t,r,n)=>({reportingClient:new m.default(e),dashboardClient:new p.default(e),reportDataStore:new C.default(t,r),missingReportClient:new c.default(e),productCollectionService:new f.default(e),featureFlagService:new s.FeatureFlagService(n)});var v=d;0&&(module.exports={initDprReportingClients});
|
|
2
2
|
//# sourceMappingURL=dprReportingClient.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/dpr/data/dprReportingClient.ts"],
|
|
4
|
-
"sourcesContent": ["import ReportingClient from './reportingClient'\nimport DashboardClient from './dashboardClient'\nimport ReportDataStore, { RedisClient } from './reportDataStore'\nimport { ApiConfig } from './types'\nimport
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,4BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA4B,gCAC5BC,EAA4B,gCAC5BC,EAA6C,gCAE7CC,
|
|
6
|
-
"names": ["dprReportingClient_exports", "__export", "dprReportingClient_default", "initDprReportingClients", "__toCommonJS", "import_reportingClient", "import_dashboardClient", "import_reportDataStore", "
|
|
4
|
+
"sourcesContent": ["import ReportingClient from './reportingClient'\nimport DashboardClient from './dashboardClient'\nimport ReportDataStore, { RedisClient } from './reportDataStore'\nimport { ApiConfig, FeatureFlagConfig } from './types'\nimport { FeatureFlagService } from '../services/featureFlagService'\nimport ProductCollectionClient from './productCollectionClient'\nimport MissingReportClient from './missingReportClient'\n\nexport const initDprReportingClients = (\n reportingApiConfig: ApiConfig,\n redisClient: RedisClient,\n storePrefix?: string,\n featureFlagConfig?: FeatureFlagConfig,\n) => {\n return {\n reportingClient: new ReportingClient(reportingApiConfig),\n dashboardClient: new DashboardClient(reportingApiConfig),\n reportDataStore: new ReportDataStore(redisClient, storePrefix),\n missingReportClient: new MissingReportClient(reportingApiConfig),\n productCollectionService: new ProductCollectionClient(reportingApiConfig),\n featureFlagService: new FeatureFlagService(featureFlagConfig),\n }\n}\n\nexport default initDprReportingClients\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,4BAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA4B,gCAC5BC,EAA4B,gCAC5BC,EAA6C,gCAE7CC,EAAmC,0CACnCC,EAAoC,wCACpCC,EAAgC,oCAEzB,MAAMP,EAA0B,CACrCQ,EACAC,EACAC,EACAC,KAEO,CACL,gBAAiB,IAAI,EAAAC,QAAgBJ,CAAkB,EACvD,gBAAiB,IAAI,EAAAK,QAAgBL,CAAkB,EACvD,gBAAiB,IAAI,EAAAM,QAAgBL,EAAaC,CAAW,EAC7D,oBAAqB,IAAI,EAAAK,QAAoBP,CAAkB,EAC/D,yBAA0B,IAAI,EAAAQ,QAAwBR,CAAkB,EACxE,mBAAoB,IAAI,qBAAmBG,CAAiB,CAC9D,GAGF,IAAOZ,EAAQC",
|
|
6
|
+
"names": ["dprReportingClient_exports", "__export", "dprReportingClient_default", "initDprReportingClients", "__toCommonJS", "import_reportingClient", "import_dashboardClient", "import_reportDataStore", "import_featureFlagService", "import_productCollectionClient", "import_missingReportClient", "reportingApiConfig", "redisClient", "storePrefix", "featureFlagConfig", "ReportingClient", "DashboardClient", "ReportDataStore", "MissingReportClient", "ProductCollectionClient"]
|
|
7
7
|
}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import ReportingClient from './reportingClient'
|
|
2
2
|
import DashboardClient from './dashboardClient'
|
|
3
3
|
import ReportDataStore, { RedisClient } from './reportDataStore'
|
|
4
|
-
import { ApiConfig } from './types'
|
|
5
|
-
import
|
|
4
|
+
import { ApiConfig, FeatureFlagConfig } from './types'
|
|
5
|
+
import { FeatureFlagService } from '../services/featureFlagService'
|
|
6
6
|
import ProductCollectionClient from './productCollectionClient'
|
|
7
|
+
import MissingReportClient from './missingReportClient'
|
|
7
8
|
|
|
8
9
|
export const initDprReportingClients = (
|
|
9
10
|
reportingApiConfig: ApiConfig,
|
|
10
11
|
redisClient: RedisClient,
|
|
11
12
|
storePrefix?: string,
|
|
13
|
+
featureFlagConfig?: FeatureFlagConfig,
|
|
12
14
|
) => {
|
|
13
15
|
return {
|
|
14
16
|
reportingClient: new ReportingClient(reportingApiConfig),
|
|
15
17
|
dashboardClient: new DashboardClient(reportingApiConfig),
|
|
16
18
|
reportDataStore: new ReportDataStore(redisClient, storePrefix),
|
|
17
19
|
missingReportClient: new MissingReportClient(reportingApiConfig),
|
|
18
|
-
|
|
20
|
+
productCollectionService: new ProductCollectionClient(reportingApiConfig),
|
|
21
|
+
featureFlagService: new FeatureFlagService(featureFlagConfig),
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
|
package/dpr/data/types.d.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var f=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of o(t))!g.call(e,n)&&n!==s&&i(e,n,{get:()=>t[n],enumerable:!(r=a(t,n))||r.enumerable});return e};var c=e=>f(i({},"__esModule",{value:!0}),e);var p={};module.exports=c(p);
|
|
2
2
|
//# sourceMappingURL=types.d.js.map
|
package/dpr/data/types.d.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/dpr/data/types.d.ts"],
|
|
4
|
-
"sourcesContent": ["import AgentConfig from './agentConfig'\nimport Dict = NodeJS.Dict\n\nexport interface GetRequest {\n path?: string\n query?: object\n headers?: Record<string, string>\n responseType?: string\n raw?: boolean\n token: string\n}\n\nexport interface ApiConfig {\n url: string\n agent: AgentConfig\n}\n\nexport interface Count {\n count: number\n}\n\nexport interface ListWithWarnings {\n data: Array<Dict<string>>\n warnings: Warnings\n}\n\nexport interface Warnings {\n noDataAvailable?: string | undefined\n}\n\nexport interface FieldValuesRequest {\n token: string\n definitionName: string\n variantName: string\n fieldName: string\n prefix: string\n definitionsPath?: string\n}\n\nexport interface AsyncRequestQuery {\n sortColumn: string\n sortedAsc: boolean\n dataProductDefinitionsPath: string\n [key: string]: string | boolean\n}\n\ninterface filter {\n [filterId: string]: string\n}\n"],
|
|
4
|
+
"sourcesContent": ["import AgentConfig from './agentConfig'\nimport Dict = NodeJS.Dict\n\nexport interface GetRequest {\n path?: string\n query?: object\n headers?: Record<string, string>\n responseType?: string\n raw?: boolean\n token: string\n}\n\nexport interface FeatureFlagConfig {\n namespace: string\n token: string\n url: string\n}\n\nexport interface ApiConfig {\n url: string\n agent: AgentConfig\n}\n\nexport interface Count {\n count: number\n}\n\nexport interface ListWithWarnings {\n data: Array<Dict<string>>\n warnings: Warnings\n}\n\nexport interface Warnings {\n noDataAvailable?: string | undefined\n}\n\nexport interface FieldValuesRequest {\n token: string\n definitionName: string\n variantName: string\n fieldName: string\n prefix: string\n definitionsPath?: string\n}\n\nexport interface AsyncRequestQuery {\n sortColumn: string\n sortedAsc: boolean\n dataProductDefinitionsPath: string\n [key: string]: string | boolean\n}\n\ninterface filter {\n [filterId: string]: string\n}\n"],
|
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
6
|
"names": ["types_d_exports", "__toCommonJS"]
|
|
7
7
|
}
|
package/dpr/data/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var w=Object.create;var d=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var o in e)d(t,o,{get:e[o],enumerable:!0})},S=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of y(e))!C.call(t,a)&&a!==o&&d(t,a,{get:()=>e[a],enumerable:!(r=q(e,a))||r.enumerable});return t};var P=(t,e,o)=>(o=t!=null?w(v(t)):{},S(e||!t||!t.__esModule?d(o,"default",{value:t,enumerable:!0}):o,t)),H=t=>S(d({},"__esModule",{value:!0}),t);var B={};U(B,{default:()=>A,errorRequestHandler:()=>D,populateDefinitions:()=>k,populateRequestedReports:()=>F,setupResources:()=>b});module.exports=H(B);var c=P(require("../utils/definitionUtils")),m=P(require("../utils/localsHelper")),h=require("../services/featureFlagService");const Q=(t,e)=>t[e]?t[e].toString():null,V=t=>Q(t,"dataProductDefinitionsPath"),x=t=>{const e=V(t);return e||null},D=t=>(e,o,r,a)=>e.status===401||e.status===403?r.render("dpr/routes/authError.njk",{layoutPath:t,message:"Sorry, there is a problem with authenticating your request"}):e.status>=400?r.render("dpr/routes/serviceProblem.njk",{layoutPath:t}):a(),b=(t,e,o,r)=>async(a,i,s)=>{j(a,i);try{return await T(i,t.featureFlagService),await k(t,a,i,r),await F(t,i),I(o,i),s()}catch(n){return D(e)(n,a,i,s)}},I=(t,e)=>{t.addGlobal("getLocals",()=>({locals:{...e.locals,...e.app.locals}}))},T=async(t,e)=>{t.app.locals.featureFlags===void 0&&(t.app.locals.featureFlags={flags:{},lastUpdated:new Date().getTime()-601*1e3});const{featureFlags:o}=t.app.locals,r=new Date().getTime();if((r-o.lastUpdated)/1e3>600){t.app.locals.featureFlags.lastUpdated=r;const s=await e.getFlags().catch(n=>{throw t.app.locals.featureFlags.lastUpdated=r-601*1e3,n});t.app.locals.featureFlags.flags=Object.fromEntries(s.flags.map(n=>[n.key,n]))}},j=(t,e)=>{const o=t.flash("DPR_ERRORS");o&&o[0]&&(e.locals.validationErrors=JSON.parse(o[0]))},k=async(t,e,o,r)=>{const{token:a,dprUser:i}=m.default.getValues(o),s=x(e.query),n=e.body?.dataProductDefinitionsPath,l=s||n;l&&(o.locals.dpdPathFromQuery=!0);const g=r?.dataProductDefinitionsPath;g&&(o.locals.dpdPathFromConfig=!0),o.locals.definitionsPath=l||g,o.locals.pathSuffix=`?dataProductDefinitionsPath=${o.locals.definitionsPath}`;let u;a&&(u=await t.productCollectionStoreService.getSelectedProductCollectionId(i.id)),o.locals.definitions=await Promise.all([t.reportingService.getDefinitions(a,o.locals.definitionsPath),u&&t.productCollectionService.getProductCollection(a,u)]).then(([R,p])=>{if(p&&p){const E=p.products.map(f=>f.productId);return R.filter(f=>E.includes(f.id))}return R})??[]},F=async(t,e)=>{const{dprUser:o}=m.default.getValues(e);if(o.id){const{definitions:r,definitionsPath:a}=e.locals,i=await t.recentlyViewedService.getAllReports(o.id);await t.requestedReportService.cleanList(o.id,i);const s=await t.requestedReportService.getAllReports(o.id);if(e.locals.requestedReports=a?s.filter(n=>c.default.getCurrentVariantDefinition(r,n.reportId,n.id)):s,e.locals.recentlyViewedReports=a?i.filter(n=>c.default.getCurrentVariantDefinition(r,n.reportId,n.id)):i,e.locals.downloadingEnabled=t.downloadPermissionService.enabled,e.locals.bookmarkingEnabled=t.bookmarkService.enabled,e.locals.collectionsEnabled=t.productCollectionService.enabled,e.locals.requestMissingEnabled=t.missingReportService.enabled,e.locals.saveDefaultsEnabled=(0,h.isBooleanFlagEnabled)("saveDefaultsEnabled",e.app),e.locals.bookmarkingEnabled){const n=await t.bookmarkService.getAllBookmarks(o.id);e.locals.bookmarks=a?n.filter(l=>c.default.getCurrentVariantDefinition(r,l.reportId,l.id)):n}}};var A=b;0&&(module.exports={errorRequestHandler,populateDefinitions,populateRequestedReports,setupResources});
|
|
2
2
|
//# sourceMappingURL=setUpDprResources.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/dpr/middleware/setUpDprResources.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { RequestHandler, Response, Request, ErrorRequestHandler, NextFunction } from 'express'\nimport type { ParsedQs } from 'qs'\nimport { HTTPError } from 'superagent'\nimport { Services } from '../types/Services'\nimport { RequestedReport, StoredReportData } from '../types/UserReports'\nimport DefinitionUtils from '../utils/definitionUtils'\nimport { BookmarkStoreData } from '../types/Bookmark'\nimport { DprConfig } from '../types/DprConfig'\nimport localsHelper from '../utils/localsHelper'\n\nconst getQueryParamAsString = (query: ParsedQs, name: string) => (query[name] ? query[name].toString() : null)\nconst getDefinitionsPath = (query: ParsedQs) => getQueryParamAsString(query, 'dataProductDefinitionsPath')\n\nconst deriveDefinitionsPath = (query: ParsedQs): string | null => {\n const definitionsPath = getDefinitionsPath(query)\n if (definitionsPath) {\n return definitionsPath\n }\n\n return null\n}\n\nexport const errorRequestHandler =\n (layoutPath: string): ErrorRequestHandler =>\n (error: HTTPError, _req: Request, res: Response, next: NextFunction) => {\n if (error.status === 401 || error.status === 403) {\n return res.render('dpr/routes/authError.njk', {\n layoutPath,\n message: 'Sorry, there is a problem with authenticating your request',\n })\n }\n if (error.status >= 400) {\n return res.render('dpr/routes/serviceProblem.njk', {\n layoutPath,\n })\n }\n return next()\n }\n\nexport const setupResources = (services: Services
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,wBAAAC,EAAA,wBAAAC,EAAA,6BAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAP,
|
|
6
|
-
"names": ["setUpDprResources_exports", "__export", "setUpDprResources_default", "errorRequestHandler", "populateDefinitions", "populateRequestedReports", "setupResources", "__toCommonJS", "import_definitionUtils", "import_localsHelper", "getQueryParamAsString", "query", "name", "getDefinitionsPath", "deriveDefinitionsPath", "definitionsPath", "layoutPath", "error", "_req", "res", "next", "services", "config", "req", "populateValidationErrors", "errors", "token", "dprUser", "localsHelper", "dpdPathFromQuery", "dpdPathFromBody", "definitionsPathFromQuery", "dpdPathFromConfig", "selectedProductCollectionId", "defs", "selectedProductCollection", "productIds", "product", "def", "definitions", "recent", "requested", "report", "DefinitionUtils", "bookmarks", "bookmark"]
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { RequestHandler, Response, Request, ErrorRequestHandler, NextFunction } from 'express'\nimport type { ParsedQs } from 'qs'\nimport { HTTPError } from 'superagent'\nimport type { Environment } from 'nunjucks'\nimport { Services } from '../types/Services'\nimport { RequestedReport, StoredReportData } from '../types/UserReports'\nimport DefinitionUtils from '../utils/definitionUtils'\nimport { BookmarkStoreData } from '../types/Bookmark'\nimport { DprConfig } from '../types/DprConfig'\nimport localsHelper from '../utils/localsHelper'\nimport { FeatureFlagService, isBooleanFlagEnabled } from '../services/featureFlagService'\n\nconst getQueryParamAsString = (query: ParsedQs, name: string) => (query[name] ? query[name].toString() : null)\nconst getDefinitionsPath = (query: ParsedQs) => getQueryParamAsString(query, 'dataProductDefinitionsPath')\n\nconst deriveDefinitionsPath = (query: ParsedQs): string | null => {\n const definitionsPath = getDefinitionsPath(query)\n if (definitionsPath) {\n return definitionsPath\n }\n\n return null\n}\n\nexport const errorRequestHandler =\n (layoutPath: string): ErrorRequestHandler =>\n (error: HTTPError, _req: Request, res: Response, next: NextFunction) => {\n if (error.status === 401 || error.status === 403) {\n return res.render('dpr/routes/authError.njk', {\n layoutPath,\n message: 'Sorry, there is a problem with authenticating your request',\n })\n }\n if (error.status >= 400) {\n return res.render('dpr/routes/serviceProblem.njk', {\n layoutPath,\n })\n }\n return next()\n }\n\nexport const setupResources = (\n services: Services,\n layoutPath: string,\n env: Environment,\n config?: DprConfig,\n): RequestHandler => {\n return async (req, res, next) => {\n populateValidationErrors(req, res)\n try {\n await setFeatures(res, services.featureFlagService)\n await populateDefinitions(services, req, res, config)\n await populateRequestedReports(services, res)\n setupRequestAwareNunjucks(env, res)\n return next()\n } catch (error) {\n return errorRequestHandler(layoutPath)(error, req, res, next)\n }\n }\n}\n\nconst setupRequestAwareNunjucks = (env: Environment, res: Response) => {\n env.addGlobal('getLocals', () => ({ locals: { ...res.locals, ...res.app.locals } }))\n}\n\nconst setFeatures = async (res: Response, featureFlagService: FeatureFlagService) => {\n if (res.app.locals.featureFlags === undefined) {\n res.app.locals.featureFlags = {\n flags: {},\n lastUpdated: new Date().getTime() - 601 * 1000,\n }\n }\n const { featureFlags } = res.app.locals\n const currentTime = new Date().getTime()\n const timeSinceLastUpdatedSeconds = (currentTime - featureFlags.lastUpdated) / 1000\n const shouldUpdate = timeSinceLastUpdatedSeconds > 600\n if (shouldUpdate) {\n // Refresh every 10 mins\n res.app.locals.featureFlags.lastUpdated = currentTime\n const flags = await featureFlagService.getFlags().catch((e) => {\n res.app.locals.featureFlags.lastUpdated = currentTime - 601 * 1000\n throw e\n })\n res.app.locals.featureFlags.flags = Object.fromEntries(flags.flags.map((flag) => [flag.key, flag]))\n }\n}\n\nconst populateValidationErrors = (req: Request, res: Response) => {\n const errors = req.flash(`DPR_ERRORS`)\n if (errors && errors[0]) {\n res.locals['validationErrors'] = JSON.parse(errors[0])\n }\n}\n\nexport const populateDefinitions = async (services: Services, req: Request, res: Response, config?: DprConfig) => {\n // Get the DPD path from the query\n const { token, dprUser } = localsHelper.getValues(res)\n\n const dpdPathFromQuery = deriveDefinitionsPath(req.query)\n const dpdPathFromBody = req.body?.dataProductDefinitionsPath\n const definitionsPathFromQuery = dpdPathFromQuery || dpdPathFromBody\n\n if (definitionsPathFromQuery) {\n res.locals['dpdPathFromQuery'] = true\n }\n\n // Get the DPD path from the config\n const dpdPathFromConfig = config?.dataProductDefinitionsPath\n if (dpdPathFromConfig) {\n res.locals['dpdPathFromConfig'] = true\n }\n\n // query takes presedence over config\n res.locals['definitionsPath'] = definitionsPathFromQuery || dpdPathFromConfig\n res.locals['pathSuffix'] = `?dataProductDefinitionsPath=${res.locals['definitionsPath']}`\n\n let selectedProductCollectionId: string | undefined\n if (token) {\n selectedProductCollectionId = await services.productCollectionStoreService.getSelectedProductCollectionId(\n dprUser.id,\n )\n }\n\n res.locals['definitions'] =\n (await Promise.all([\n services.reportingService.getDefinitions(token, res.locals['definitionsPath']),\n selectedProductCollectionId &&\n services.productCollectionService.getProductCollection(token, selectedProductCollectionId),\n ]).then(([defs, selectedProductCollection]) => {\n if (selectedProductCollection && selectedProductCollection) {\n const productIds = selectedProductCollection.products.map((product) => product.productId)\n return defs.filter((def) => productIds.includes(def.id))\n }\n return defs\n })) ?? []\n}\n\nexport const populateRequestedReports = async (services: Services, res: Response) => {\n const { dprUser } = localsHelper.getValues(res)\n if (dprUser.id) {\n const { definitions, definitionsPath } = res.locals\n\n const recent = await services.recentlyViewedService.getAllReports(dprUser.id)\n await services.requestedReportService.cleanList(dprUser.id, recent)\n const requested = await services.requestedReportService.getAllReports(dprUser.id)\n\n res.locals['requestedReports'] = !definitionsPath\n ? requested\n : requested.filter((report: RequestedReport) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, report.reportId, report.id)\n })\n\n res.locals['recentlyViewedReports'] = !definitionsPath\n ? recent\n : recent.filter((report: StoredReportData) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, report.reportId, report.id)\n })\n\n res.locals['downloadingEnabled'] = services.downloadPermissionService.enabled\n res.locals['bookmarkingEnabled'] = services.bookmarkService.enabled\n res.locals['collectionsEnabled'] = services.productCollectionService.enabled\n res.locals['requestMissingEnabled'] = services.missingReportService.enabled\n res.locals['saveDefaultsEnabled'] = isBooleanFlagEnabled('saveDefaultsEnabled', res.app)\n\n if (res.locals['bookmarkingEnabled']) {\n const bookmarks = await services.bookmarkService.getAllBookmarks(dprUser.id)\n res.locals['bookmarks'] = !definitionsPath\n ? bookmarks\n : bookmarks.filter((bookmark: BookmarkStoreData) => {\n return DefinitionUtils.getCurrentVariantDefinition(definitions, bookmark.reportId, bookmark.id)\n })\n }\n }\n}\n\nexport default setupResources\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["setUpDprResources_exports", "__export", "setUpDprResources_default", "errorRequestHandler", "populateDefinitions", "populateRequestedReports", "setupResources", "__toCommonJS", "import_definitionUtils", "import_localsHelper", "import_featureFlagService", "getQueryParamAsString", "query", "name", "getDefinitionsPath", "deriveDefinitionsPath", "definitionsPath", "layoutPath", "error", "_req", "res", "next", "services", "env", "config", "req", "populateValidationErrors", "setFeatures", "setupRequestAwareNunjucks", "featureFlagService", "featureFlags", "currentTime", "flags", "e", "flag", "errors", "token", "dprUser", "localsHelper", "dpdPathFromQuery", "dpdPathFromBody", "definitionsPathFromQuery", "dpdPathFromConfig", "selectedProductCollectionId", "defs", "selectedProductCollection", "productIds", "product", "def", "definitions", "recent", "requested", "report", "DefinitionUtils", "bookmarks", "bookmark"]
|
|
7
7
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { ProductCollectionService } from '../services/productCollection/productCollectionService'
|
|
15
15
|
import MissingReportService from '../services/missingReport/missingReportService'
|
|
16
16
|
import { ProductCollectionStoreService } from '../services/productCollection/productCollectionStoreService'
|
|
17
|
+
import { FeatureFlagService } from '../services/featureFlagService'
|
|
17
18
|
|
|
18
19
|
describe('setUpDprResources', () => {
|
|
19
20
|
describe('populateRequestedReports', () => {
|
|
@@ -25,6 +26,7 @@ describe('setUpDprResources', () => {
|
|
|
25
26
|
let defaultFilterValuesService: DefaultFilterValuesService
|
|
26
27
|
let productCollectionStoreService: ProductCollectionStoreService
|
|
27
28
|
let missingReportService: MissingReportService
|
|
29
|
+
let featureFlagService: FeatureFlagService
|
|
28
30
|
let services: Services
|
|
29
31
|
let res: Response
|
|
30
32
|
|
|
@@ -63,6 +65,11 @@ describe('setUpDprResources', () => {
|
|
|
63
65
|
enabled: true,
|
|
64
66
|
} as unknown as MissingReportService
|
|
65
67
|
|
|
68
|
+
featureFlagService = {
|
|
69
|
+
restClient: undefined,
|
|
70
|
+
namespace: '',
|
|
71
|
+
} as unknown as FeatureFlagService
|
|
72
|
+
|
|
66
73
|
services = {
|
|
67
74
|
requestedReportService,
|
|
68
75
|
recentlyViewedService,
|
|
@@ -72,9 +79,13 @@ describe('setUpDprResources', () => {
|
|
|
72
79
|
defaultFilterValuesService,
|
|
73
80
|
downloadPermissionService,
|
|
74
81
|
bookmarkService,
|
|
82
|
+
featureFlagService,
|
|
75
83
|
} as unknown as Services
|
|
76
84
|
|
|
77
85
|
res = {
|
|
86
|
+
app: {
|
|
87
|
+
locals: {},
|
|
88
|
+
},
|
|
78
89
|
locals: {
|
|
79
90
|
dprUser: {
|
|
80
91
|
token: 'T0k3n',
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
import { RequestHandler, Response, Request, ErrorRequestHandler, NextFunction } from 'express'
|
|
3
3
|
import type { ParsedQs } from 'qs'
|
|
4
4
|
import { HTTPError } from 'superagent'
|
|
5
|
+
import type { Environment } from 'nunjucks'
|
|
5
6
|
import { Services } from '../types/Services'
|
|
6
7
|
import { RequestedReport, StoredReportData } from '../types/UserReports'
|
|
7
8
|
import DefinitionUtils from '../utils/definitionUtils'
|
|
8
9
|
import { BookmarkStoreData } from '../types/Bookmark'
|
|
9
10
|
import { DprConfig } from '../types/DprConfig'
|
|
10
11
|
import localsHelper from '../utils/localsHelper'
|
|
12
|
+
import { FeatureFlagService, isBooleanFlagEnabled } from '../services/featureFlagService'
|
|
11
13
|
|
|
12
14
|
const getQueryParamAsString = (query: ParsedQs, name: string) => (query[name] ? query[name].toString() : null)
|
|
13
15
|
const getDefinitionsPath = (query: ParsedQs) => getQueryParamAsString(query, 'dataProductDefinitionsPath')
|
|
@@ -38,12 +40,19 @@ export const errorRequestHandler =
|
|
|
38
40
|
return next()
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
export const setupResources = (
|
|
43
|
+
export const setupResources = (
|
|
44
|
+
services: Services,
|
|
45
|
+
layoutPath: string,
|
|
46
|
+
env: Environment,
|
|
47
|
+
config?: DprConfig,
|
|
48
|
+
): RequestHandler => {
|
|
42
49
|
return async (req, res, next) => {
|
|
43
50
|
populateValidationErrors(req, res)
|
|
44
51
|
try {
|
|
52
|
+
await setFeatures(res, services.featureFlagService)
|
|
45
53
|
await populateDefinitions(services, req, res, config)
|
|
46
54
|
await populateRequestedReports(services, res)
|
|
55
|
+
setupRequestAwareNunjucks(env, res)
|
|
47
56
|
return next()
|
|
48
57
|
} catch (error) {
|
|
49
58
|
return errorRequestHandler(layoutPath)(error, req, res, next)
|
|
@@ -51,6 +60,32 @@ export const setupResources = (services: Services, layoutPath: string, config?:
|
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
62
|
|
|
63
|
+
const setupRequestAwareNunjucks = (env: Environment, res: Response) => {
|
|
64
|
+
env.addGlobal('getLocals', () => ({ locals: { ...res.locals, ...res.app.locals } }))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const setFeatures = async (res: Response, featureFlagService: FeatureFlagService) => {
|
|
68
|
+
if (res.app.locals.featureFlags === undefined) {
|
|
69
|
+
res.app.locals.featureFlags = {
|
|
70
|
+
flags: {},
|
|
71
|
+
lastUpdated: new Date().getTime() - 601 * 1000,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const { featureFlags } = res.app.locals
|
|
75
|
+
const currentTime = new Date().getTime()
|
|
76
|
+
const timeSinceLastUpdatedSeconds = (currentTime - featureFlags.lastUpdated) / 1000
|
|
77
|
+
const shouldUpdate = timeSinceLastUpdatedSeconds > 600
|
|
78
|
+
if (shouldUpdate) {
|
|
79
|
+
// Refresh every 10 mins
|
|
80
|
+
res.app.locals.featureFlags.lastUpdated = currentTime
|
|
81
|
+
const flags = await featureFlagService.getFlags().catch((e) => {
|
|
82
|
+
res.app.locals.featureFlags.lastUpdated = currentTime - 601 * 1000
|
|
83
|
+
throw e
|
|
84
|
+
})
|
|
85
|
+
res.app.locals.featureFlags.flags = Object.fromEntries(flags.flags.map((flag) => [flag.key, flag]))
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
54
89
|
const populateValidationErrors = (req: Request, res: Response) => {
|
|
55
90
|
const errors = req.flash(`DPR_ERRORS`)
|
|
56
91
|
if (errors && errors[0]) {
|
|
@@ -126,7 +161,7 @@ export const populateRequestedReports = async (services: Services, res: Response
|
|
|
126
161
|
res.locals['bookmarkingEnabled'] = services.bookmarkService.enabled
|
|
127
162
|
res.locals['collectionsEnabled'] = services.productCollectionService.enabled
|
|
128
163
|
res.locals['requestMissingEnabled'] = services.missingReportService.enabled
|
|
129
|
-
res.locals['saveDefaultsEnabled'] =
|
|
164
|
+
res.locals['saveDefaultsEnabled'] = isBooleanFlagEnabled('saveDefaultsEnabled', res.app)
|
|
130
165
|
|
|
131
166
|
if (res.locals['bookmarkingEnabled']) {
|
|
132
167
|
const bookmarks = await services.bookmarkService.getAllBookmarks(dprUser.id)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=require("test-app/routes/integrationTests/
|
|
1
|
+
"use strict";var s=require("test-app/routes/integrationTests/appStateUtils"),o=require("../../../../../cypress-tests/cypressUtils");context("Download report",()=>{const d="/embedded/platform/";let t,l;before(()=>{(0,o.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult20"),cy.task("stubRequestSuccessResult100"),cy.visit(d),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(e,i)=>!!i.textContent?.includes("Successful Report")&&!!i.textContent?.includes("this will succeed")}).within(()=>{cy.findByRole("link",{name:"Request report"}).click()})}),(0,o.checkA11y)(),cy.findByRole("button",{name:/Request/}).click(),(0,o.checkA11y)(),cy.findByRole("heading",{level:1,name:/Successful Report/}).should("be.visible"),cy.url().then(e=>{l=e})}),beforeEach(()=>{cy.visit(l)}),describe("Enabling download",()=>{it("should show the enable download button",()=>{cy.findByLabelText(/Enable download/).should("exist").should("be.visible"),cy.findByRole("heading",{name:"To download this report"}).should("not.exist")}),it("should show the download disabled message with link to form",()=>{cy.findByLabelText(/Enable download/).click(),cy.url().should("have.string","/report/download-disabled"),cy.findByRole("heading",{name:"To download this report"}).should("be.visible"),cy.findByRole("link",{name:"Fill out a form"})}),it("should go to the request download form",()=>{cy.findByLabelText(/Enable download/).click(),cy.findByRole("link",{name:"Fill out a form"}).click(),cy.url().then(e=>{t=e}),cy.url().should("match",/\/embedded\/platform\/dpr\/download-report\/request-download\/request-examples\/request-example-success\/tableId\/tblId_[0-9]+\/form/),cy.location().should(e=>{expect(e.search).to.match(/.*reportUrl=\/embedded\/platform\/dpr\/view-report\/async\/report\/request-examples\/request-example-success\/tblId_[0-9]+\/report/)})})}),describe("Requesting download",()=>{it("should prefill the user data in the request form",()=>{cy.visit(t),cy.findByRole("textbox",{name:"What is your Full name?"}).should("have.value","Test User"),cy.findByRole("textbox",{name:"What is your Email address?"}).should("have.value","test@user.com")}),it("should validate the required fields",()=>{cy.visit(t),cy.findByRole("alert").should("not.exist"),cy.findAllByRole("paragraph").contains("Enter your Job title").should("not.exist"),cy.findAllByRole("paragraph").contains("provide information on how you will use this data").should("not.exist"),cy.get("#more-detail-error").should("not.be.visible"),cy.findByRole("button",{name:/Submit request/}).click(),cy.findByRole("alert").should("exist"),cy.findAllByRole("paragraph").contains("Enter your Job title").should("exist"),cy.findAllByRole("paragraph").contains("provide information on how you will use this data").should("exist")}),it("should submit the download request",()=>{cy.visit(t),cy.findByRole("textbox",{name:"What is your Job title?"}).type("Software engineer"),cy.findByRole("textbox",{name:"Can you provide more detail"}).type("I like this report"),cy.findByRole("button",{name:"Submit request"}).click(),cy.findByText(/You have been granted permission/).should("be.visible"),cy.url().as("downloadRequestSubmittedPage"),cy.url().and("match",/dpr\/download-report\/request-download\/request-examples\/request-example-success\/tableId\/tblId_[0-9]+\/form\/submitted/),cy.findByRole("link",{name:/Return to report to download/}).click(),cy.findAllByRole("heading").contains("Successful Report").should("exist"),cy.findByRole("button",{name:/download/}).should("be.visible"),cy.task("stubRequestSuccessResult10MissingFirstRow"),cy.findByRole("button",{name:/download/}).click(),cy.task("checkContents10RowExcelValid").should("equal",!0)}),it("should redirect on trying to download after having the permission to download removed",()=>{(0,s.updateRedisState)("downloadPermissions",[]),cy.findByRole("heading",{name:/To download this report/}).should("not.exist"),cy.findByRole("button",{name:/download/}).click(),cy.findByRole("heading",{name:/To download this report/}).should("be.visible")})})});
|
|
2
2
|
//# sourceMappingURL=tests.cy.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/dpr/routes/journeys/download-report/tests.cy.ts"],
|
|
4
|
-
"sourcesContent": ["import { updateRedisState } from 'test-app/routes/integrationTests/
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAAiC,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { updateRedisState } from 'test-app/routes/integrationTests/appStateUtils'\nimport { checkA11y, executeReportStubs } from '../../../../../cypress-tests/cypressUtils'\n\ncontext('Download report', () => {\n const path = '/embedded/platform/'\n let downloadRequestFormPage: string\n let viewReportUrl: string\n\n before(() => {\n executeReportStubs()\n cy.task('stubDefinitionRequestExamplesSuccess')\n cy.task('stubRequestSuccessResult20')\n cy.task('stubRequestSuccessResult100')\n cy.visit(path)\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return (\n Boolean(element.textContent?.includes('Successful Report')) &&\n Boolean(element.textContent?.includes('this will succeed'))\n )\n },\n }).within(() => {\n cy.findByRole('link', { name: 'Request report' }).click()\n })\n })\n checkA11y()\n cy.findByRole('button', { name: /Request/ }).click()\n checkA11y()\n cy.findByRole('heading', { level: 1, name: /Successful Report/ }).should('be.visible')\n cy.url().then((url) => {\n viewReportUrl = url\n })\n })\n\n beforeEach(() => {\n cy.visit(viewReportUrl)\n })\n\n describe('Enabling download', () => {\n it('should show the enable download button', () => {\n cy.findByLabelText(/Enable download/)\n .should('exist')\n .should('be.visible')\n cy.findByRole('heading', { name: 'To download this report' }).should('not.exist')\n })\n\n it('should show the download disabled message with link to form', () => {\n cy.findByLabelText(/Enable download/).click()\n cy.url().should('have.string', '/report/download-disabled')\n cy.findByRole('heading', { name: 'To download this report' }).should('be.visible')\n cy.findByRole('link', { name: 'Fill out a form' })\n })\n\n it('should go to the request download form', () => {\n cy.findByLabelText(/Enable download/).click()\n cy.findByRole('link', { name: 'Fill out a form' }).click()\n\n cy.url().then((url) => {\n downloadRequestFormPage = url\n })\n\n cy.url().should(\n 'match',\n /\\/embedded\\/platform\\/dpr\\/download-report\\/request-download\\/request-examples\\/request-example-success\\/tableId\\/tblId_[0-9]+\\/form/,\n )\n cy.location().should((location) => {\n expect(location.search).to.match(\n /.*reportUrl=\\/embedded\\/platform\\/dpr\\/view-report\\/async\\/report\\/request-examples\\/request-example-success\\/tblId_[0-9]+\\/report/,\n )\n })\n })\n })\n\n describe('Requesting download', () => {\n it('should prefill the user data in the request form', () => {\n cy.visit(downloadRequestFormPage)\n cy.findByRole('textbox', { name: 'What is your Full name?' }).should('have.value', 'Test User')\n cy.findByRole('textbox', { name: 'What is your Email address?' }).should('have.value', 'test@user.com')\n })\n\n it('should validate the required fields', () => {\n cy.visit(downloadRequestFormPage)\n cy.findByRole('alert').should('not.exist')\n\n cy.findAllByRole('paragraph').contains('Enter your Job title').should('not.exist')\n cy.findAllByRole('paragraph').contains('provide information on how you will use this data').should('not.exist')\n cy.get('#more-detail-error').should('not.be.visible')\n\n cy.findByRole('button', { name: /Submit request/ }).click()\n\n cy.findByRole('alert').should('exist')\n cy.findAllByRole('paragraph').contains('Enter your Job title').should('exist')\n cy.findAllByRole('paragraph').contains('provide information on how you will use this data').should('exist')\n })\n\n it('should submit the download request', () => {\n cy.visit(downloadRequestFormPage)\n cy.findByRole('textbox', { name: 'What is your Job title?' }).type('Software engineer')\n cy.findByRole('textbox', { name: 'Can you provide more detail' }).type('I like this report')\n\n cy.findByRole('button', { name: 'Submit request' }).click()\n cy.findByText(/You have been granted permission/).should('be.visible')\n\n cy.url().as('downloadRequestSubmittedPage')\n\n cy.url().and(\n 'match',\n /dpr\\/download-report\\/request-download\\/request-examples\\/request-example-success\\/tableId\\/tblId_[0-9]+\\/form\\/submitted/,\n )\n cy.findByRole('link', { name: /Return to report to download/ }).click()\n cy.findAllByRole('heading').contains('Successful Report').should('exist')\n cy.findByRole('button', { name: /download/ }).should('be.visible')\n\n cy.task('stubRequestSuccessResult10MissingFirstRow')\n cy.findByRole('button', { name: /download/ }).click()\n cy.task('checkContents10RowExcelValid').should('equal', true)\n })\n\n it('should redirect on trying to download after having the permission to download removed', () => {\n updateRedisState('downloadPermissions', [])\n cy.findByRole('heading', { name: /To download this report/ }).should('not.exist')\n cy.findByRole('button', { name: /download/ }).click()\n cy.findByRole('heading', { name: /To download this report/ }).should('be.visible')\n })\n })\n})\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["import_appStateUtils", "import_cypressUtils", "path", "downloadRequestFormPage", "viewReportUrl", "_", "element", "url", "location"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { updateRedisState } from 'test-app/routes/integrationTests/
|
|
1
|
+
import { updateRedisState } from 'test-app/routes/integrationTests/appStateUtils'
|
|
2
2
|
import { checkA11y, executeReportStubs } from '../../../../../cypress-tests/cypressUtils'
|
|
3
3
|
|
|
4
4
|
context('Download report', () => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("../../../../../../../test-app/routes/integrationTests/
|
|
1
|
+
"use strict";var e=require("../../../../../../../test-app/routes/integrationTests/appStateUtils"),s=require("../../../../../types/UserReports");context("Bookmarks list",()=>{const t="/embedded/platform/dpr/my-reports/bookmarks/list";before(()=>{cy.task("resetStubs"),cy.task("resetRedis"),cy.task("stubDefinitions"),cy.task("stubSingleSummaries"),cy.task("stubDefinitionRequestExamplesSuccess")}),it("is accessible",()=>{(0,e.setRedisState)({requestedReports:[],recentlyViewedReports:[],bookmarks:[{reportId:"request-examples",id:"request-example-success",type:s.ReportType.REPORT}],downloadPermissions:[{reportId:"request-examples",id:"request-example-success"}],defaultFilters:[]}),cy.visit(t),cy.injectAxe(),cy.checkA11y(),cy.findAllByText(/Successful Report/).should("be.visible")})});
|
|
2
2
|
//# sourceMappingURL=tests.cy.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/dpr/routes/journeys/my-reports/bookmarks/list/tests.cy.ts"],
|
|
4
|
-
"sourcesContent": ["import { setRedisState } from '../../../../../../../test-app/routes/integrationTests/
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAA8B,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import { setRedisState } from '../../../../../../../test-app/routes/integrationTests/appStateUtils'\nimport { ReportType } from '../../../../../types/UserReports'\n\ncontext('Bookmarks list', () => {\n const path = '/embedded/platform/dpr/my-reports/bookmarks/list'\n\n before(() => {\n cy.task('resetStubs')\n cy.task('resetRedis')\n cy.task('stubDefinitions')\n cy.task('stubSingleSummaries')\n cy.task('stubDefinitionRequestExamplesSuccess')\n })\n\n it('is accessible', () => {\n setRedisState({\n requestedReports: [],\n recentlyViewedReports: [],\n bookmarks: [\n {\n reportId: 'request-examples',\n id: 'request-example-success',\n type: ReportType.REPORT,\n },\n ],\n downloadPermissions: [{ reportId: 'request-examples', id: 'request-example-success' }],\n defaultFilters: [],\n })\n cy.visit(path)\n cy.injectAxe()\n cy.checkA11y()\n cy.findAllByText(/Successful Report/).should('be.visible')\n })\n})\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAA8B,+EAC9BC,EAA2B,4CAE3B,QAAQ,iBAAkB,IAAM,CAC9B,MAAMC,EAAO,mDAEb,OAAO,IAAM,CACX,GAAG,KAAK,YAAY,EACpB,GAAG,KAAK,YAAY,EACpB,GAAG,KAAK,iBAAiB,EACzB,GAAG,KAAK,qBAAqB,EAC7B,GAAG,KAAK,sCAAsC,CAChD,CAAC,EAED,GAAG,gBAAiB,IAAM,IACxB,iBAAc,CACZ,iBAAkB,CAAC,EACnB,sBAAuB,CAAC,EACxB,UAAW,CACT,CACE,SAAU,mBACV,GAAI,0BACJ,KAAM,aAAW,MACnB,CACF,EACA,oBAAqB,CAAC,CAAE,SAAU,mBAAoB,GAAI,yBAA0B,CAAC,EACrF,eAAgB,CAAC,CACnB,CAAC,EACD,GAAG,MAAMA,CAAI,EACb,GAAG,UAAU,EACb,GAAG,UAAU,EACb,GAAG,cAAc,mBAAmB,EAAE,OAAO,YAAY,CAC3D,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_appStateUtils", "import_UserReports", "path"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setRedisState } from '../../../../../../../test-app/routes/integrationTests/
|
|
1
|
+
import { setRedisState } from '../../../../../../../test-app/routes/integrationTests/appStateUtils'
|
|
2
2
|
import { ReportType } from '../../../../../types/UserReports'
|
|
3
3
|
|
|
4
4
|
context('Bookmarks list', () => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var l=require("@networkMocks/definitionSummaries");context("Catalogue collections",()=>{const
|
|
1
|
+
"use strict";var l=require("@networkMocks/definitionSummaries"),i=require("cypress-tests/cypressUtils");context("Catalogue collections",()=>{const s="/embedded/platform/";describe("Check catalogue collections work properly",()=>{it("should allow the user to choose from any collection",()=>{(0,i.stubBaseTasks)(),cy.task("stubDefinitions"),cy.task("stubGetProductCollections"),cy.task("getProductCollection1"),cy.task("stubDefinitionUnprintable"),cy.task("stubDefinitionEmptyReport"),cy.task("stubDefinitionMockReportVariant35"),cy.visit(s),cy.findByRole("combobox",{name:/Your collections/}).should("be.visible").within(()=>cy.findAllByRole("option").should("have.length",3)),cy.findByDisplayValue(/Full catalogue/).should("be.visible");const o=l.summaries.reduce((e,t)=>e+(t.dashboards?.length??0)+t.variants.length,0);cy.findAllByText((e,t)=>new RegExp(`Showing ${o} of ${o} reports`).test(t?.textContent||"")).should("be.visible"),cy.findByLabelText(/Reports catalogue.*/i).within(()=>{cy.findByRole("row",{name:(e,t)=>!!t.textContent?.includes("Interactive Report with async filters")}).within(()=>{cy.findByRole("button",{name:/Add bookmark/}).click()})}),cy.findByRole("combobox",{name:/Your collections/}).select("My Starter Pack");const n=[l.summaries[0],l.summaries[1]].reduce((e,t)=>e+(t.dashboards?.length??0)+t.variants.length,0);cy.findAllByText((e,t)=>new RegExp(`Showing ${n} of ${n} reports`).test(t?.textContent||"")).should("be.visible"),cy.findByRole("combobox",{name:/Your collections/}).select("Full catalogue"),cy.findAllByText((e,t)=>new RegExp(`Showing ${o} of ${o} reports`).test(t?.textContent||"")).should("be.visible")})})});
|
|
2
2
|
//# sourceMappingURL=tests.cy.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/dpr/routes/journeys/product-collection/selected/tests.cy.ts"],
|
|
4
|
-
"sourcesContent": ["import { summaries } from '@networkMocks/definitionSummaries'\n\ncontext('Catalogue collections', () => {\n const path = '/embedded/platform/'\n\n describe('Check catalogue collections work properly', () => {\n it('should allow the user to choose from any collection', () => {\n
|
|
5
|
-
"mappings": "aAAA,IAAAA,EAA0B,
|
|
6
|
-
"names": ["import_definitionSummaries", "path", "totalReports", "acc", "cur", "_text", "el", "_", "element", "totalReportsStarterPack"]
|
|
4
|
+
"sourcesContent": ["import { summaries } from '@networkMocks/definitionSummaries'\nimport { stubBaseTasks } from 'cypress-tests/cypressUtils'\n\ncontext('Catalogue collections', () => {\n const path = '/embedded/platform/'\n\n describe('Check catalogue collections work properly', () => {\n it('should allow the user to choose from any collection', () => {\n stubBaseTasks()\n cy.task('stubDefinitions')\n cy.task('stubGetProductCollections')\n cy.task('getProductCollection1')\n cy.task('stubDefinitionUnprintable')\n cy.task('stubDefinitionEmptyReport')\n cy.task('stubDefinitionMockReportVariant35')\n\n cy.visit(path)\n\n cy.findByRole('combobox', { name: /Your collections/ })\n .should('be.visible')\n .within(() => cy.findAllByRole('option').should('have.length', 3))\n cy.findByDisplayValue(/Full catalogue/).should('be.visible')\n\n const totalReports = summaries.reduce((acc, cur) => acc + (cur.dashboards?.length ?? 0) + cur.variants.length, 0)\n cy.findAllByText((_text, el) =>\n new RegExp(`Showing ${totalReports} of ${totalReports} reports`).test(el?.textContent || ''),\n ).should('be.visible')\n\n cy.findByLabelText(/Reports catalogue.*/i).within(() => {\n cy.findByRole('row', {\n name: (_, element) => {\n return Boolean(element.textContent?.includes('Interactive Report with async filters'))\n },\n }).within(() => {\n cy.findByRole('button', { name: /Add bookmark/ }).click()\n })\n })\n\n cy.findByRole('combobox', { name: /Your collections/ }).select('My Starter Pack')\n const totalReportsStarterPack = [summaries[0], summaries[1]].reduce(\n (acc, cur) => acc + (cur.dashboards?.length ?? 0) + cur.variants.length,\n 0,\n )\n cy.findAllByText((_text, el) =>\n new RegExp(`Showing ${totalReportsStarterPack} of ${totalReportsStarterPack} reports`).test(\n el?.textContent || '',\n ),\n ).should('be.visible')\n\n cy.findByRole('combobox', { name: /Your collections/ }).select('Full catalogue')\n cy.findAllByText((_text, el) =>\n new RegExp(`Showing ${totalReports} of ${totalReports} reports`).test(el?.textContent || ''),\n ).should('be.visible')\n })\n })\n})\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAA0B,6CAC1BC,EAA8B,sCAE9B,QAAQ,wBAAyB,IAAM,CACrC,MAAMC,EAAO,sBAEb,SAAS,4CAA6C,IAAM,CAC1D,GAAG,sDAAuD,IAAM,IAC9D,iBAAc,EACd,GAAG,KAAK,iBAAiB,EACzB,GAAG,KAAK,2BAA2B,EACnC,GAAG,KAAK,uBAAuB,EAC/B,GAAG,KAAK,2BAA2B,EACnC,GAAG,KAAK,2BAA2B,EACnC,GAAG,KAAK,mCAAmC,EAE3C,GAAG,MAAMA,CAAI,EAEb,GAAG,WAAW,WAAY,CAAE,KAAM,kBAAmB,CAAC,EACnD,OAAO,YAAY,EACnB,OAAO,IAAM,GAAG,cAAc,QAAQ,EAAE,OAAO,cAAe,CAAC,CAAC,EACnE,GAAG,mBAAmB,gBAAgB,EAAE,OAAO,YAAY,EAE3D,MAAMC,EAAe,YAAU,OAAO,CAACC,EAAKC,IAAQD,GAAOC,EAAI,YAAY,QAAU,GAAKA,EAAI,SAAS,OAAQ,CAAC,EAChH,GAAG,cAAc,CAACC,EAAOC,IACvB,IAAI,OAAO,WAAWJ,CAAY,OAAOA,CAAY,UAAU,EAAE,KAAKI,GAAI,aAAe,EAAE,CAC7F,EAAE,OAAO,YAAY,EAErB,GAAG,gBAAgB,sBAAsB,EAAE,OAAO,IAAM,CACtD,GAAG,WAAW,MAAO,CACnB,KAAM,CAACC,EAAGC,IACD,EAAQA,EAAQ,aAAa,SAAS,uCAAuC,CAExF,CAAC,EAAE,OAAO,IAAM,CACd,GAAG,WAAW,SAAU,CAAE,KAAM,cAAe,CAAC,EAAE,MAAM,CAC1D,CAAC,CACH,CAAC,EAED,GAAG,WAAW,WAAY,CAAE,KAAM,kBAAmB,CAAC,EAAE,OAAO,iBAAiB,EAChF,MAAMC,EAA0B,CAAC,YAAU,CAAC,EAAG,YAAU,CAAC,CAAC,EAAE,OAC3D,CAACN,EAAKC,IAAQD,GAAOC,EAAI,YAAY,QAAU,GAAKA,EAAI,SAAS,OACjE,CACF,EACA,GAAG,cAAc,CAACC,EAAOC,IACvB,IAAI,OAAO,WAAWG,CAAuB,OAAOA,CAAuB,UAAU,EAAE,KACrFH,GAAI,aAAe,EACrB,CACF,EAAE,OAAO,YAAY,EAErB,GAAG,WAAW,WAAY,CAAE,KAAM,kBAAmB,CAAC,EAAE,OAAO,gBAAgB,EAC/E,GAAG,cAAc,CAACD,EAAOC,IACvB,IAAI,OAAO,WAAWJ,CAAY,OAAOA,CAAY,UAAU,EAAE,KAAKI,GAAI,aAAe,EAAE,CAC7F,EAAE,OAAO,YAAY,CACvB,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_definitionSummaries", "import_cypressUtils", "path", "totalReports", "acc", "cur", "_text", "el", "_", "element", "totalReportsStarterPack"]
|
|
7
7
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { summaries } from '@networkMocks/definitionSummaries'
|
|
2
|
+
import { stubBaseTasks } from 'cypress-tests/cypressUtils'
|
|
2
3
|
|
|
3
4
|
context('Catalogue collections', () => {
|
|
4
5
|
const path = '/embedded/platform/'
|
|
5
6
|
|
|
6
7
|
describe('Check catalogue collections work properly', () => {
|
|
7
8
|
it('should allow the user to choose from any collection', () => {
|
|
8
|
-
|
|
9
|
-
cy.task('resetRedis')
|
|
9
|
+
stubBaseTasks()
|
|
10
10
|
cy.task('stubDefinitions')
|
|
11
11
|
cy.task('stubGetProductCollections')
|
|
12
12
|
cy.task('getProductCollection1')
|