@ministryofjustice/hmpps-digital-prison-reporting-frontend 4.26.4 → 4.26.6
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/all.scss +13 -24
- package/dpr/components/_reports/report/view.njk +1 -1
- package/dpr/components/_reports/report-data-table/style.scss +13 -24
- package/dpr/components/_reports/report-data-table/view.njk +2 -2
- package/dpr/components/_reports/report-data-table-wrapper/view.njk +3 -3
- package/dpr/routes/journeys/view-report/async/report/tests.cy.js +1 -1
- package/dpr/routes/journeys/view-report/async/report/tests.cy.js.map +3 -3
- package/dpr/routes/journeys/view-report/async/report/tests.cy.ts +841 -841
- package/dpr/utils/DataTableBuilder/DataTableBuilder.js +1 -1
- package/dpr/utils/DataTableBuilder/DataTableBuilder.js.map +2 -2
- package/dpr/utils/DataTableBuilder/DataTableBuilder.ts +1 -1
- package/package.json +2 -2
package/dpr/all.scss
CHANGED
|
@@ -872,23 +872,7 @@ ul.dpr-card-group__item__filters-list {
|
|
|
872
872
|
|
|
873
873
|
.dpr-table-container {
|
|
874
874
|
position: relative;
|
|
875
|
-
|
|
876
|
-
#dpr-data-table-list {
|
|
877
|
-
.govuk-table__header {
|
|
878
|
-
padding-right: govuk-spacing(4);
|
|
879
|
-
white-space: nowrap;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
.govuk-table__cell {
|
|
883
|
-
padding-right: govuk-spacing(4);
|
|
884
|
-
}
|
|
885
875
|
|
|
886
|
-
.govuk-table__body {
|
|
887
|
-
tr.govuk-table__row:nth-child(odd) {
|
|
888
|
-
background-color: govuk-colour("light-grey");
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
876
|
|
|
893
877
|
.dpr-section-header {
|
|
894
878
|
border-bottom: 0px;
|
|
@@ -1143,15 +1127,20 @@ ul.dpr-card-group__item__filters-list {
|
|
|
1143
1127
|
}
|
|
1144
1128
|
}
|
|
1145
1129
|
|
|
1146
|
-
.dpr-table-container--list
|
|
1147
|
-
.govuk-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1130
|
+
.dpr-table-container--list {
|
|
1131
|
+
.govuk-table__header {
|
|
1132
|
+
padding-right: govuk-spacing(4);
|
|
1133
|
+
white-space: nowrap;
|
|
1134
|
+
}
|
|
1151
1135
|
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1136
|
+
.govuk-table__cell {
|
|
1137
|
+
padding-right: govuk-spacing(4);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
.govuk-table__body {
|
|
1141
|
+
tr.govuk-table__row:nth-child(odd) {
|
|
1142
|
+
background-color: govuk-colour("light-grey");
|
|
1143
|
+
}
|
|
1155
1144
|
}
|
|
1156
1145
|
}
|
|
1157
1146
|
|
|
@@ -2,23 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
.dpr-table-container {
|
|
4
4
|
position: relative;
|
|
5
|
-
|
|
6
|
-
#dpr-data-table-list {
|
|
7
|
-
.govuk-table__header {
|
|
8
|
-
padding-right: govuk-spacing(4);
|
|
9
|
-
white-space: nowrap;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.govuk-table__cell {
|
|
13
|
-
padding-right: govuk-spacing(4);
|
|
14
|
-
}
|
|
15
5
|
|
|
16
|
-
.govuk-table__body {
|
|
17
|
-
tr.govuk-table__row:nth-child(odd) {
|
|
18
|
-
background-color: govuk-colour("light-grey");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
6
|
|
|
23
7
|
.dpr-section-header {
|
|
24
8
|
border-bottom: 0px;
|
|
@@ -273,15 +257,20 @@
|
|
|
273
257
|
}
|
|
274
258
|
}
|
|
275
259
|
|
|
276
|
-
.dpr-table-container--list
|
|
277
|
-
.govuk-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
260
|
+
.dpr-table-container--list {
|
|
261
|
+
.govuk-table__header {
|
|
262
|
+
padding-right: govuk-spacing(4);
|
|
263
|
+
white-space: nowrap;
|
|
264
|
+
}
|
|
281
265
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
266
|
+
.govuk-table__cell {
|
|
267
|
+
padding-right: govuk-spacing(4);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.govuk-table__body {
|
|
271
|
+
tr.govuk-table__row:nth-child(odd) {
|
|
272
|
+
background-color: govuk-colour("light-grey");
|
|
273
|
+
}
|
|
285
274
|
}
|
|
286
275
|
}
|
|
287
276
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% from "govuk/components/table/macro.njk" import govukTable %}
|
|
2
2
|
|
|
3
|
-
{% macro dprDataTable(dataTable, classification
|
|
3
|
+
{% macro dprDataTable(dataTable, classification) %}
|
|
4
4
|
{% set rows = dataTable.rows %}
|
|
5
5
|
{% set head = dataTable.head %}
|
|
6
6
|
{% set colCount = dataTable.colCount %}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
head: head,
|
|
14
14
|
rows: rows,
|
|
15
15
|
attributes: {
|
|
16
|
-
'id': 'dpr-data-table
|
|
16
|
+
'id': 'dpr-data-table',
|
|
17
17
|
'data-classification': classification,
|
|
18
18
|
'data-col-length': colCount
|
|
19
19
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{% from "../report-data-table/view.njk" import dprDataTable %}
|
|
2
2
|
{% from "govuk/components/tabs/macro.njk" import govukTabs %}
|
|
3
3
|
|
|
4
|
-
{% macro dprDataTableWrapper(dataTables, classification
|
|
4
|
+
{% macro dprDataTableWrapper(dataTables, classification) %}
|
|
5
5
|
|
|
6
6
|
{% if dataTables.length > 1 %}
|
|
7
7
|
{% set tabItems = [] %}
|
|
8
8
|
{% for dataTable in dataTables %}
|
|
9
9
|
|
|
10
10
|
{% set dataTableHtml %}
|
|
11
|
-
{{ dprDataTable(dataTable, classification
|
|
11
|
+
{{ dprDataTable(dataTable, classification) }}
|
|
12
12
|
{% endset -%}
|
|
13
13
|
|
|
14
14
|
{% set tabItems = (tabItems.push({
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
|
|
23
23
|
{{ govukTabs({ items: tabItems}) }}
|
|
24
24
|
{% else %}
|
|
25
|
-
{{ dprDataTable(dataTables[0], classification
|
|
25
|
+
{{ dprDataTable(dataTables[0], classification) }}
|
|
26
26
|
{% endif %}
|
|
27
27
|
{% endmacro %}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var n=require("../../../../../../../cypress-tests/cypressUtils");context("Viewing a report",()=>{const t="/embedded/platform/";let i,d;describe("List report page",()=>{before(()=>{(0,n.executeReportStubs)(),cy.task("stubDefinitionRequestExamplesSuccess"),cy.task("stubRequestSuccessResult10"),cy.task("stubRequestSuccessResult20"),cy.task("stubRequestSuccessResult100"),(0,n.requestReport)({name:"Successful Report",description:"this will succeed",path:t}),cy.url().then(c=>{i=c;const l=c.split("/");d=l[l.length-2]})}),beforeEach(()=>{cy.visit(i)}),describe("Column interactions",()=>{const c=()=>{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(0).within(()=>{cy.findAllByRole("columnheader").should("have.length",5)})})})},l=()=>{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(0).within(()=>{cy.findAllByRole("columnheader").should("have.length",4)})})})},s=()=>{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(),c(),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,o)=>{switch(o){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(),s(),cy.findByRole("button",{name:"Apply columns"}).click(),l(),cy.findByLabelText(/Successful Report/).within(()=>{cy.findAllByRole("rowgroup").eq(0).within(()=>{cy.findAllByRole("columnheader").each((e,o)=>{switch(o){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(),s(),cy.findByRole("button",{name:"Apply columns"}).click(),l(),cy.findAllByRole("group").contains(/Show columns/).click(),cy.findByRole("link",{name:"Reset columns"}).click(),c()}),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,o)=>{switch(o){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(0).within(()=>{cy.findAllByRole("columnheader").should("have.length",2)})})})})})})});
|
|
1
|
+
"use strict";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(/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
|