diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b6edc5d5..dcc5a33dc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,10 +10,11 @@ jobs: main: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 20 + cache: 'npm' - name: Install run: npm install diff --git a/cypress.config.ts b/cypress.config.ts index 66cd17539..5eaa9e5ed 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -3,14 +3,14 @@ import { defineConfig } from "cypress" export default defineConfig({ projectId: "tbpt8b", chromeWebSecurity: false, - screenshotOnRunFailure: false, - video: false, + screenshotOnRunFailure: true, + video: true, viewportWidth: 1280, viewportHeight: 1024, defaultCommandTimeout: 10000, + pageLoadTimeout: 30000, requestTimeout: 10000, env: { - baseUrlAcc: "https://acc.api.wonen.zaken.amsterdam.nl/api/v1/", baseUrlData: "https://api.data.amsterdam.nl/", userHh: "handhaver-noreply@amsterdam.nl", userHhj: "handhavingsjurist-noreply@amsterdam.nl", @@ -36,8 +36,8 @@ export default defineConfig({ }, component: { devServer: { - framework: "create-react-app", - bundler: "webpack" + framework: "react", + bundler: "vite" } } }) diff --git a/cypress/README.md b/cypress/README.md index 300ad037a..2ac066771 100644 --- a/cypress/README.md +++ b/cypress/README.md @@ -1,16 +1,25 @@ # Zaken frontend - Cypress integration ## Local testing + +Start your local env: + +```JavaScript +npm run acc +``` + To open the Cypress UI, enter the following command after installing dependencies: - `npx cypress open` or `npm run cy` ## Run specific tests -- `npm run cy:run -- --spec "cypress/integration/my-spec.js"` +```JavaScript +npm run cy:run -- --spec "cypress/integration/my-spec.js" +``` ## Global variables -Global Cypress variables can be found in `cypress.json` in the root of the project. You can acces them by using: `Cypress.env("emailPm")`. +Global Cypress variables can be found in `cypress.config.ts` in the root of the project. You can acces them by using: `Cypress.env("emailPm")`. ## Credentials or secrets diff --git a/cypress/e2e/020_visit/visit.plan.authorization.spec.js b/cypress/e2e/020_visit/visit.plan.authorization.spec.js index 0577a0684..c3c980151 100644 --- a/cypress/e2e/020_visit/visit.plan.authorization.spec.js +++ b/cypress/e2e/020_visit/visit.plan.authorization.spec.js @@ -4,7 +4,7 @@ import visit from "../../fixtures/visit.json" describe('Plan "huisbezoek"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -29,7 +29,7 @@ describe('Plan "huisbezoek"', () => { describe('Go to "Bezoek inplannen" form', () => { it("Click on task Bezoek inplannen", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as("getTasks") cy.wait("@getTasks").then(() => { cy.get("tbody>tr") @@ -39,7 +39,7 @@ describe('Plan "huisbezoek"', () => { }) it("Bezoek inplannen page is visible", () => { - const url = `${Cypress.env("baseUrlAcc")}themes/*/schedule-types/` + const url = `**/themes/*/schedule-types/` cy.intercept(url).as("getScheduleTypes") cy.wait("@getScheduleTypes").then(() => { cy.get("h1") diff --git a/cypress/e2e/020_visit/visit.plan.spec.js b/cypress/e2e/020_visit/visit.plan.spec.js index b64bd439f..0d332926f 100644 --- a/cypress/e2e/020_visit/visit.plan.spec.js +++ b/cypress/e2e/020_visit/visit.plan.spec.js @@ -10,7 +10,7 @@ beforeEach(() => { describe('Test visit.plan.spec', () => { it("Go to Adresoverzicht and select address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Test visit.plan.spec', () => { cy.get(`[data-testid="submit"]`).click(); - const urlCases = `${Cypress.env("baseUrlAcc")}cases/*/`; + const urlCases = `**/cases/*/`; cy.intercept(urlCases).as("getCase"); cy.wait("@getCase").then(() => { cy.get("tbody>tr").contains("td", "Bezoek inplannen"); @@ -50,9 +50,7 @@ describe('Test visit.plan.spec', () => { it("Schedule `Huisbezoek`", () => { cy.goToCaseDetailPage(); - const urlScheduleTypes = `${Cypress.env( - "baseUrlAcc" - )}themes/*/schedule-types/`; + const urlScheduleTypes = "**/themes/*/schedule-types/"; cy.intercept(urlScheduleTypes).as("getScheduleTypes"); cy.get("tbody>tr").contains("td", "Bezoek inplannen").click(); @@ -88,7 +86,7 @@ describe('Test visit.plan.spec', () => { .contains("Bezoek inplannen") .click(); - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/`; + const url = `**/cases/*/events/`; cy.intercept(url).as("getEvents"); cy.wait("@getEvents").then(() => { cy.history("Bezoek ingepland", "Datum"); diff --git a/cypress/e2e/020_visit/visit.result.access.granted.spec.js b/cypress/e2e/020_visit/visit.result.access.granted.spec.js index fb91a96ae..ce2a016bf 100644 --- a/cypress/e2e/020_visit/visit.result.access.granted.spec.js +++ b/cypress/e2e/020_visit/visit.result.access.granted.spec.js @@ -12,14 +12,14 @@ beforeEach(() => { describe("Test visit.result.access.granted.spec", () => { it("Mock TOP result for visit", () => { - const urlCases = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const urlCases = `**/addresses/*/cases/`; cy.intercept(urlCases).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { cy.get("h1").contains(`${address.street}, ${address.zipCode}`); }); - const urlCase = `${Cypress.env("baseUrlAcc")}cases/*/`; + const urlCase = `**/cases/*/`; cy.intercept(urlCase).as("getCase"); cy.scrollTo(0, 400); @@ -42,7 +42,7 @@ describe("Test visit.result.access.granted.spec", () => { cy.testDueDate("tbody>tr>td", 0); - const url = `${Cypress.env("baseUrlAcc")}users/`; + const url = `**/users/`; cy.intercept(url).as("getUsers"); cy.visit(`/zaken/${caseId}/huisbezoek/${taskId}`); @@ -73,7 +73,7 @@ describe("Test visit.result.access.granted.spec", () => { cy.get('[data-testid="notes"').type(visit.notes); - const url = `${Cypress.env("baseUrlAcc")}cases/*/`; + const url = `**/cases/*/`; cy.intercept(url).as("getDebriefTask"); cy.get('button[data-testid="submit"]').contains("Toevoegen").click(); diff --git a/cypress/e2e/020_visit/visit.result.nobody.present.hold.spec.js b/cypress/e2e/020_visit/visit.result.nobody.present.hold.spec.js index 3f3f5cf01..be1ed6c93 100644 --- a/cypress/e2e/020_visit/visit.result.nobody.present.hold.spec.js +++ b/cypress/e2e/020_visit/visit.result.nobody.present.hold.spec.js @@ -13,7 +13,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => { it('Intercept TOP URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -49,7 +49,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => { // check dueDate cy.testDueDate("tbody>tr>td", 0) - const url = `${Cypress.env("baseUrlAcc")}users/` + const url = `**/users/` cy.intercept(url).as('getUsers') cy.visit(`/zaken/${caseId}/huisbezoek/${taskId}`) @@ -105,7 +105,7 @@ describe('Result "huisbezoek" with nobody present and hold', () => { }) it('Submit form and check for plan new visit', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as('getEvents') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/020_visit/visit.result.nobody.present.spec.js b/cypress/e2e/020_visit/visit.result.nobody.present.spec.js index 0b4c53b9c..431b29cc1 100644 --- a/cypress/e2e/020_visit/visit.result.nobody.present.spec.js +++ b/cypress/e2e/020_visit/visit.result.nobody.present.spec.js @@ -13,7 +13,7 @@ describe('Result "huisbezoek" with nobody present', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Result "huisbezoek" with nobody present', () => { it('Intercept TOP URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -50,7 +50,7 @@ describe('Result "huisbezoek" with nobody present', () => { cy.testDueDate("tbody>tr>td", 0) - const url = `${Cypress.env("baseUrlAcc")}users/` + const url = `**/users/` cy.intercept(url).as('getUsers') cy.visit(`/zaken/${caseId}/huisbezoek/${taskId}`) @@ -121,7 +121,7 @@ describe('Result "huisbezoek" with nobody present', () => { }) it('Submit form and check for plan new visit', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as('getEvents') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/025_taskOverview/01-select.task.spec.js b/cypress/e2e/025_taskOverview/01-select.task.spec.js index 0efe76453..64651f1bf 100644 --- a/cypress/e2e/025_taskOverview/01-select.task.spec.js +++ b/cypress/e2e/025_taskOverview/01-select.task.spec.js @@ -10,14 +10,14 @@ beforeEach(() => { describe("Test select.task.spec", () => { it("Pick up task and put away in Takenoverzicht", () => { - const urlTasks = `${Cypress.env("baseUrlAcc")}tasks/*`; + const urlTasks = `**/tasks/*`; cy.intercept(urlTasks).as("getTasks"); cy.visit("/taken"); cy.wait("@getTasks").then(() => { cy.get("h1").contains("Takenoverzicht"); }); - const urlTasksUpdate = `${Cypress.env("baseUrlAcc")}tasks/*/`; + const urlTasksUpdate = `**/tasks/*/`; cy.intercept(urlTasksUpdate).as("updateTask"); const checkBox = cy.get('[type="checkbox"][title="Beschikbaar"]').first(); checkBox.check(); diff --git a/cypress/e2e/030_debrief/01-debrief.no.violation.spec.js b/cypress/e2e/030_debrief/01-debrief.no.violation.spec.js index 5e508188f..53ca085b8 100644 --- a/cypress/e2e/030_debrief/01-debrief.no.violation.spec.js +++ b/cypress/e2e/030_debrief/01-debrief.no.violation.spec.js @@ -20,7 +20,7 @@ describe("Test debrief.no.violation.spec", () => { cy.get('[data-testid="feedback"]').type(debrief.descriptionNoViolation); - const url = `${Cypress.env("baseUrlAcc")}cases/*/`; + const url = `**/cases/*/`; cy.intercept(url).as("getNextTask"); cy.get('button[data-testid="submit"]') @@ -58,7 +58,7 @@ describe("Test debrief.no.violation.spec", () => { .contains("Taak afronden") .click(); - const urlEvents = `${Cypress.env("baseUrlAcc")}cases/*/events/`; + const urlEvents = `**/cases/*/events/`; cy.intercept(urlEvents).as("getEvents"); cy.wait("@getEvents").then(() => { cy.history(debrief.noViolationNextTask, roles.PM); diff --git a/cypress/e2e/030_debrief/01a-debrief.other.theme.spec.js b/cypress/e2e/030_debrief/01a-debrief.other.theme.spec.js index cdcf41829..2b0c7a75b 100644 --- a/cypress/e2e/030_debrief/01a-debrief.other.theme.spec.js +++ b/cypress/e2e/030_debrief/01a-debrief.other.theme.spec.js @@ -11,7 +11,7 @@ describe('Process Debrief - Other Theme"', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Process Debrief - Other Theme"', () => { it('Intercept Debrief URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -72,7 +72,7 @@ describe('Process Debrief - Other Theme"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/030_debrief/01b-debrief.violation.spec.js b/cypress/e2e/030_debrief/01b-debrief.violation.spec.js index c25936162..b9622c28c 100644 --- a/cypress/e2e/030_debrief/01b-debrief.violation.spec.js +++ b/cypress/e2e/030_debrief/01b-debrief.violation.spec.js @@ -11,7 +11,7 @@ describe('Process Debrief - Violation"', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -31,7 +31,7 @@ describe('Process Debrief - Violation"', () => { it('Intercept Debrief URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -68,7 +68,7 @@ describe('Process Debrief - Violation"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/030_debrief/01c-debrief.authorization.spec.js b/cypress/e2e/030_debrief/01c-debrief.authorization.spec.js index 9da57f4c7..e4ed106f1 100644 --- a/cypress/e2e/030_debrief/01c-debrief.authorization.spec.js +++ b/cypress/e2e/030_debrief/01c-debrief.authorization.spec.js @@ -11,7 +11,7 @@ describe('Process Debrief - Authorization required"', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Process Debrief - Authorization required"', () => { it('Intercept Debrief URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { diff --git a/cypress/e2e/030_debrief/02-feedback.reporter.spec.js b/cypress/e2e/030_debrief/02-feedback.reporter.spec.js index 907635c4e..a478cd71a 100644 --- a/cypress/e2e/030_debrief/02-feedback.reporter.spec.js +++ b/cypress/e2e/030_debrief/02-feedback.reporter.spec.js @@ -5,7 +5,7 @@ import address from "../../fixtures/address.json" describe('Process Feedback reporter"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -48,7 +48,7 @@ describe('Process Feedback reporter"', () => { }) it("Check Terugkoppeling melder event in history", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { diff --git a/cypress/e2e/030_debrief/03-report.short.spec.js b/cypress/e2e/030_debrief/03-report.short.spec.js index c9d4e7455..dda440614 100644 --- a/cypress/e2e/030_debrief/03-report.short.spec.js +++ b/cypress/e2e/030_debrief/03-report.short.spec.js @@ -33,7 +33,7 @@ describe("Test report.short.spec", () => { cy.get(`[role="dialog"]`).find("button").contains("Taak afronden").click(); - const url = `${Cypress.env("baseUrlAcc")}cases/*/`; + const url = `**/cases/*/`; cy.intercept(url).as("getNextTask"); cy.wait("@getNextTask").then(() => { diff --git a/cypress/e2e/030_debrief/03-report.spec.js b/cypress/e2e/030_debrief/03-report.spec.js index 20f1d1d6f..c017b67e3 100644 --- a/cypress/e2e/030_debrief/03-report.spec.js +++ b/cypress/e2e/030_debrief/03-report.spec.js @@ -5,7 +5,7 @@ import address from "../../fixtures/address.json" describe('Process Report Visit"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -132,7 +132,7 @@ describe('Process Report Visit"', () => { cy.testDueDate("tbody>tr>td", 2) }) it("Check next task is 'Nakijken aanschrijving(en)'", () => { - // const url = `${Cypress.env("baseUrlAcc")}cases/*/` + // const url = `**/cases/*/` // cy.intercept(url).as('getNextTask') // cy.wait('@getNextTask').then(() => { diff --git a/cypress/e2e/030_debrief/debrief.additional.research.spec.js b/cypress/e2e/030_debrief/debrief.additional.research.spec.js index 24c2e5e63..57670d8d3 100644 --- a/cypress/e2e/030_debrief/debrief.additional.research.spec.js +++ b/cypress/e2e/030_debrief/debrief.additional.research.spec.js @@ -11,7 +11,7 @@ describe('Process Debrief - No violation"', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -33,7 +33,7 @@ describe('Process Debrief - No violation"', () => { it('Intercept Debrief URL and load page', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getTasks') cy.wait('@getTasks').then(({ response }) => { @@ -70,7 +70,7 @@ describe('Process Debrief - No violation"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') diff --git a/cypress/e2e/040_summon/01.summon.warning.vv.spec.js b/cypress/e2e/040_summon/01.summon.warning.vv.spec.js index e4e73d66b..34d11a67d 100644 --- a/cypress/e2e/040_summon/01.summon.warning.vv.spec.js +++ b/cypress/e2e/040_summon/01.summon.warning.vv.spec.js @@ -6,7 +6,7 @@ import summon from "../../fixtures/summon.json" describe('Process Summon"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -85,7 +85,7 @@ describe('Process Summon"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') @@ -111,7 +111,7 @@ describe('Process Summon"', () => { }) it("Check next task is 'Uitzetten vervolgstap'", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { diff --git a/cypress/e2e/040_summon/02.summon.closing.spec.js b/cypress/e2e/040_summon/02.summon.closing.spec.js index bdcfc80f0..6f86c2179 100644 --- a/cypress/e2e/040_summon/02.summon.closing.spec.js +++ b/cypress/e2e/040_summon/02.summon.closing.spec.js @@ -6,7 +6,7 @@ import summon from "../../fixtures/summon.json" describe('Process Summon"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -76,7 +76,7 @@ describe('Process Summon"', () => { }) it('Submit form and check debrief status', () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.get('button[data-testid="submit"]') @@ -99,7 +99,7 @@ describe('Process Summon"', () => { }) it("Check next task is 'Uitzetten vervolgstap'", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { diff --git a/cypress/e2e/050_nextStep/next.step.close.case.spec.js b/cypress/e2e/050_nextStep/next.step.close.case.spec.js index 5d2e92b78..adab1ca73 100644 --- a/cypress/e2e/050_nextStep/next.step.close.case.spec.js +++ b/cypress/e2e/050_nextStep/next.step.close.case.spec.js @@ -4,7 +4,7 @@ import address from "../../fixtures/address.json" describe('Select Next Step - closing case"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -23,7 +23,7 @@ describe('Select Next Step - closing case"', () => { }) it("Select to close this case", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { @@ -48,7 +48,7 @@ describe('Select Next Step - closing case"', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as('getEvents') cy.wait('@getEvents').then(() => { cy.get("h1").contains("Zaakdetails") diff --git a/cypress/e2e/050_nextStep/next.step.recheck.spec.js b/cypress/e2e/050_nextStep/next.step.recheck.spec.js index d4f7a9904..e5336aa75 100644 --- a/cypress/e2e/050_nextStep/next.step.recheck.spec.js +++ b/cypress/e2e/050_nextStep/next.step.recheck.spec.js @@ -4,7 +4,7 @@ import address from "../../fixtures/address.json" describe('Select Next Step - closing case"', () => { it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -23,7 +23,7 @@ describe('Select Next Step - closing case"', () => { }) it("Select to close this case", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as('getNextTask') cy.wait('@getNextTask').then(() => { @@ -48,7 +48,7 @@ describe('Select Next Step - closing case"', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as('getEvents') cy.wait('@getEvents').then(() => { cy.get("h1").contains("Zaakdetails") diff --git a/cypress/e2e/060_closeCase/1.close.case.handhaver.spec.js b/cypress/e2e/060_closeCase/1.close.case.handhaver.spec.js index 30e5d8271..ea0b63927 100644 --- a/cypress/e2e/060_closeCase/1.close.case.handhaver.spec.js +++ b/cypress/e2e/060_closeCase/1.close.case.handhaver.spec.js @@ -10,7 +10,7 @@ beforeEach(() => { describe("Select Next Step - closing case as handhaver", () => { it('Go to Adresoverzicht and case has task "Afsluiten zaak"', () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -28,7 +28,7 @@ describe("Select Next Step - closing case as handhaver", () => { cy.get("tbody>tr>td").eq(2).should("contain", roles.PM); - const url = `${Cypress.env("baseUrlAcc")}themes/*/case-close-reasons/`; + const url = `**/themes/*/case-close-reasons/`; cy.intercept(url).as("getCloseReasons"); cy.get("tbody>tr").contains("td", "Zaak afsluiten").click(); diff --git a/cypress/e2e/060_closeCase/2.close.case.handhavingsjurist.spec.js b/cypress/e2e/060_closeCase/2.close.case.handhavingsjurist.spec.js index 189729216..7168e8c2d 100644 --- a/cypress/e2e/060_closeCase/2.close.case.handhavingsjurist.spec.js +++ b/cypress/e2e/060_closeCase/2.close.case.handhavingsjurist.spec.js @@ -10,7 +10,7 @@ beforeEach(() => { describe("Select Next Step - closing case as handhavingsjurist", () => { it('Go to Adresoverzicht and case has task "Afsluiten zaak"', () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -28,7 +28,7 @@ describe("Select Next Step - closing case as handhavingsjurist", () => { cy.get("tbody>tr>td").eq(2).should("contain", roles.PM); - const url = `${Cypress.env("baseUrlAcc")}themes/*/case-close-reasons/`; + const url = `**/themes/*/case-close-reasons/`; cy.intercept(url).as("getCloseReasons"); cy.get("tbody>tr").contains("td", "Zaak afsluiten").click(); diff --git a/cypress/e2e/060_closeCase/3.close.case.toezichthouder.spec.js b/cypress/e2e/060_closeCase/3.close.case.toezichthouder.spec.js index ee25057c1..aa6236130 100644 --- a/cypress/e2e/060_closeCase/3.close.case.toezichthouder.spec.js +++ b/cypress/e2e/060_closeCase/3.close.case.toezichthouder.spec.js @@ -10,7 +10,7 @@ beforeEach(() => { describe("Select Next Step - closing case as toezichthouder", () => { it('Go to Adresoverzicht and case has task "Afsluiten zaak"', () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -28,7 +28,7 @@ describe("Select Next Step - closing case as toezichthouder", () => { cy.get("tbody>tr>td").eq(2).should("contain", roles.PM); - const url = `${Cypress.env("baseUrlAcc")}themes/*/case-close-reasons/`; + const url = `**/themes/*/case-close-reasons/`; cy.intercept(url).as("getCloseReasons"); cy.get("tbody>tr").contains("td", "Zaak afsluiten").click(); diff --git a/cypress/e2e/060_closeCase/4.close.case.no.violation.spec.js b/cypress/e2e/060_closeCase/4.close.case.no.violation.spec.js index f1e0e8ece..f3e04bc88 100644 --- a/cypress/e2e/060_closeCase/4.close.case.no.violation.spec.js +++ b/cypress/e2e/060_closeCase/4.close.case.no.violation.spec.js @@ -11,7 +11,7 @@ beforeEach(() => { describe('Close case as projectmedwerker"', () => { it('Go to Adresoverzicht and case has task "Afsluiten zaak"', () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/`; + const url = `**/addresses/*/cases/`; cy.intercept(url).as("getCases"); cy.visit(`/adres/${address.bagId}`); cy.wait("@getCases").then(() => { @@ -26,7 +26,7 @@ describe('Close case as projectmedwerker"', () => { it("Intercept Afronding URL and load page", () => { cy.goToCaseDetailPage(); - const url = `${Cypress.env("baseUrlAcc")}cases/*/`; + const url = `**/cases/*/`; cy.intercept(url).as("getTasks"); //force intercept @@ -42,7 +42,7 @@ describe('Close case as projectmedwerker"', () => { const caseId = closingTask?.case; const taskId = closingTask.case_user_task_id; - const url = `${Cypress.env("baseUrlAcc")}themes/*/case-close-reasons`; + const url = `**/themes/*/case-close-reasons`; cy.intercept(url).as("getCloseReasons"); cy.get("h4").contains(debrief.closingTask2); cy.get("tbody>tr") @@ -79,7 +79,7 @@ describe('Close case as projectmedwerker"', () => { .contains("Verwerken") .click(); - const urlEvents = `${Cypress.env("baseUrlAcc")}cases/*/events/`; + const urlEvents = `**/cases/*/events/`; cy.intercept(urlEvents).as("getEvents"); cy.wait("@getEvents").then(() => { cy.history("Zaak afgerond", "Projectmedewerker"); diff --git a/cypress/e2e/070_extra_tasks/01.correspondence.spec.js b/cypress/e2e/070_extra_tasks/01.correspondence.spec.js index 4ee2a74e1..10d634206 100644 --- a/cypress/e2e/070_extra_tasks/01.correspondence.spec.js +++ b/cypress/e2e/070_extra_tasks/01.correspondence.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "Correspondentie', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "Correspondentie', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Correspondence", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "Correspondentie', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") @@ -77,7 +77,7 @@ describe('Add extra task "Correspondentie', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -129,7 +129,7 @@ describe('Add extra task "Correspondentie', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { diff --git a/cypress/e2e/070_extra_tasks/02.callback.request.spec.js b/cypress/e2e/070_extra_tasks/02.callback.request.spec.js index ce0518c09..8b0618ac6 100644 --- a/cypress/e2e/070_extra_tasks/02.callback.request.spec.js +++ b/cypress/e2e/070_extra_tasks/02.callback.request.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "Callback request', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "Callback request', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Terugbelverzoek", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "Callback request', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") @@ -77,7 +77,7 @@ describe('Add extra task "Callback request', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -129,7 +129,7 @@ describe('Add extra task "Callback request', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { diff --git a/cypress/e2e/070_extra_tasks/03.objection.file.spec.js b/cypress/e2e/070_extra_tasks/03.objection.file.spec.js index 57147b1ad..65972f55c 100644 --- a/cypress/e2e/070_extra_tasks/03.objection.file.spec.js +++ b/cypress/e2e/070_extra_tasks/03.objection.file.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "Objection File', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "Objection File', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Aanleveren bezwaardossier", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "Objection File', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") @@ -77,7 +77,7 @@ describe('Add extra task "Objection File', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as('getCases') cy.visit(`/adres/${address.bagId}`) cy.wait('@getCases').then(() => { @@ -130,7 +130,7 @@ describe('Add extra task "Objection File', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { diff --git a/cypress/e2e/070_extra_tasks/04.new.signal.spec.js b/cypress/e2e/070_extra_tasks/04.new.signal.spec.js index eefd60494..c345ff2bd 100644 --- a/cypress/e2e/070_extra_tasks/04.new.signal.spec.js +++ b/cypress/e2e/070_extra_tasks/04.new.signal.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "New signal', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "New signal', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Verwerken nieuwe melding", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "New signal', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") diff --git a/cypress/e2e/070_extra_tasks/05.extra.information.spec.js b/cypress/e2e/070_extra_tasks/05.extra.information.spec.js index e4e4da59f..66a2b60db 100644 --- a/cypress/e2e/070_extra_tasks/05.extra.information.spec.js +++ b/cypress/e2e/070_extra_tasks/05.extra.information.spec.js @@ -11,7 +11,7 @@ describe('Add extra task "Extra Information', () => { }) it("Go to Adresoverzicht and check address", () => { - const url = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const url = `**/addresses/*/cases/` cy.intercept(url).as("getCases") cy.visit(`/adres/${address.bagId}`) cy.wait("@getCases").then(() => { @@ -40,7 +40,7 @@ describe('Add extra task "Extra Information', () => { describe("Submit in form 'Taak opvoeren'", () => { it("Select Task Extra informatie", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/processes/` + const url = `**/cases/*/processes/` cy.intercept(url).as("getProcesses") cy.wait("@getProcesses").then(() => { cy.get('[data-testid="workflowProcess"]') @@ -59,7 +59,7 @@ describe('Add extra task "Extra Information', () => { }) it("Request is successfully processed", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/events/` + const url = `**/cases/*/events/` cy.intercept(url).as("getEvents") cy.wait("@getEvents").then(() => { cy.get("h4") diff --git a/cypress/support/address.js b/cypress/support/address.js index 4a5bb2ebd..9e20434a9 100644 --- a/cypress/support/address.js +++ b/cypress/support/address.js @@ -11,7 +11,7 @@ Cypress.Commands.add("selectAddress", (queryString, addressString) => { const urlAddress = `${Cypress.env("baseUrlData")}atlas/search/postcode/*` cy.intercept(urlAddress).as("getAddress") - const urlCases = `${Cypress.env("baseUrlAcc")}addresses/*/cases/` + const urlCases = `**/addresses/*/cases/` cy.intercept(urlCases).as("getCases") cy.visit(`/?query=${queryString}`) diff --git a/cypress/support/case.js b/cypress/support/case.js index 61c983dae..2e93a2aee 100644 --- a/cypress/support/case.js +++ b/cypress/support/case.js @@ -7,7 +7,7 @@ const PATH = "cypress/fixtures/case.json" Cypress.Commands.add("setCaseId", () => { - const url = `${Cypress.env("baseUrlAcc")}cases/*/` + const url = `**/cases/*/` cy.intercept(url).as("getCase") cy.wait("@getCase", { timeout: 20000 }) diff --git a/cypress/support/kcLogin.js b/cypress/support/kcLogin.js index e319ec977..47ed6b01a 100644 --- a/cypress/support/kcLogin.js +++ b/cypress/support/kcLogin.js @@ -1,6 +1,6 @@ Cypress.Commands.add("kcLogin", (username, password) => { - const kcRoot = "https://iam.amsterdam.nl"; + const kcRoot = "https://acc.iam.amsterdam.nl"; const kcRealm = "datapunt-ad-acc"; const kcClient = "wonen-zaaksysteem-frontend"; const kcRedirectUri = "http://localhost:2999/"; @@ -58,7 +58,7 @@ Cypress.Commands.add("kcLogin", (username, password) => { }); Cypress.Commands.add("kcLogout", () => { - const kcRoot = "https://iam.amsterdam.nl"; + const kcRoot = "https://acc.iam.amsterdam.nl"; const kcRealm = "datapunt-ad-acc"; const kcRedirectUri = "http://localhost:2999/"; return cy.request({ diff --git a/cypress/support/login.js b/cypress/support/login.js index 7f25966a6..81d5dd673 100644 --- a/cypress/support/login.js +++ b/cypress/support/login.js @@ -32,7 +32,7 @@ Cypress.Commands.add("login", (email, password) => { cy.get("#password").should("be.visible").type(password, { log: false }); - const url = `${Cypress.env("baseUrlAcc")}is-authorized/`; + const url = `**/is-authorized/`; cy.intercept(url).as("isAuthorized"); cy.get("#kc-login").click(); diff --git a/cypress_testflow_complete.json b/cypress_testflow_complete.json deleted file mode 100644 index 88dd341a1..000000000 --- a/cypress_testflow_complete.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "projectId": "tbpt8b", - "chromeWebSecurity": false, - "baseUrl": "http://localhost:2999/", - "screenshotOnRunFailure": false, - "video": false, - "viewportWidth": 1280, - "viewportHeight": 1024, - "env": { - "baseUrlAcc": "https://acc.api.wonen.zaken.amsterdam.nl/api/v1/", - "baseUrlData": "https://api.data.amsterdam.nl/", - "userHh": "handhaver-noreply@amsterdam.nl", - "userHhj": "handhavingsjurist-noreply@amsterdam.nl", - "userPm": "projectmedewerker-noreply@amsterdam.nl", - "userTh": "toezichthouder-noreply@amsterdam.nl" - }, - "testFiles": [ - "010_addCase/themes/vakantieverhuur/add.case.anonymous.no.ad.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.nobody.present.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.access.granted.spec.js", - "030_debrief/01-debrief.no.violation.spec.js", - "030_debrief/03-report.short.spec.js", - "050_nextStep/*.js", - "060_closeCase/*.js", - "010_addCase/themes/vakantieverhuur/add.case.not.anonymous.ad.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.access.granted.spec.js", - "030_debrief/01a-debrief.other.theme.spec.js", - "030_debrief/03-report.short.spec.js", - "050_nextStep/*.js", - "060_closeCase/*.js", - "010_addCase/themes/vakantieverhuur/add.case.not.anonymous.ad.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.access.granted.spec.js", - "030_debrief/01b-debrief.violation.spec.js", - "030_debrief/03-report.spec.js", - "040_summon/summon.spec.js", - "050_nextStep/next.step.recheck.spec.js", - "020_visit/visit.plan.spec.js", - "010_addCase/themes/vakantieverhuur/add.case.anonymous.no.ad.spec.js", - "020_visit/visit.plan.spec.js", - "020_visit/visit.result.access.granted.spec.js", - "030_debrief/01c-debrief.authorization.spec.js", - "020_visit/visit.plan.authorization.spec.js", - "010_addCase/themes/vakantieverhuur/add.case.errors.spec.js", - "010_addCase/roles/handhaver/add.case.disabled.spec.js", - "010_addCase/roles/handhavingsjurist/add.case.disabled.spec.js", - "010_addCase/roles/toezichthouder/add.case.disabled.spec.js", - "010_addCase/themes/vakantieverhuur/add.case.anonymous.no.ad.spec.js", - "070_extra_tasks/*" - ] - } diff --git a/index.html b/index.html index d8f74a46e..1df17d979 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,19 @@ %REACT_APP_PAGE_TITLE% - + diff --git a/package-lock.json b/package-lock.json index 4183cf47c..587bc657d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6095,9 +6095,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001587", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", - "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", + "version": "1.0.30001643", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz", + "integrity": "sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg==", "funding": [ { "type": "opencollective", @@ -6111,7 +6111,8 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/caseless": { "version": "0.12.0", diff --git a/src/app/components/case/Workflow/columns.tsx b/src/app/components/case/Workflow/columns.tsx index 7fdc08774..401108b84 100644 --- a/src/app/components/case/Workflow/columns.tsx +++ b/src/app/components/case/Workflow/columns.tsx @@ -6,7 +6,7 @@ import TaskButton from "app/components/case/tasks/TaskButton/TaskButton" import taskActionMap from "./utils/taskActionMap" import LockIcon from "./components/LockIcon" import TableAction from "app/components/shared/TableAction/TableAction" -import SelectTask from "./components/SelectTask" +import SelectTaskWorkflow from "./components/SelectTaskWorkflow" // This width value (113px) is the width of a date + edit icon including the spacing between them const Span = styled.span` @@ -31,7 +31,7 @@ export default (execPost: (payload?: any) => Promise) => ( }, { header: "Opgepakt door", dataIndex: "owner", - render: (owner: any, task: any) => + render: (owner: any, task: any) => }, { header: "Slotdatum", dataIndex: "due_date", diff --git a/src/app/components/case/Workflow/components/SelectTask.tsx b/src/app/components/case/Workflow/components/SelectTaskWorkflow.tsx similarity index 84% rename from src/app/components/case/Workflow/components/SelectTask.tsx rename to src/app/components/case/Workflow/components/SelectTaskWorkflow.tsx index 13b7f45d2..292b71b6a 100644 --- a/src/app/components/case/Workflow/components/SelectTask.tsx +++ b/src/app/components/case/Workflow/components/SelectTaskWorkflow.tsx @@ -26,13 +26,14 @@ const StyledCheckbox = styled(Checkbox)` margin-left: -8px; ` -const SelectTask: React.FC = ({ task }) => { +const SelectTaskWorkflow: React.FC = ({ task }) => { const { case_user_task_id: taskId, owner: taskOwner, case: caseId } = task const [isChecked, setIsChecked] = useState(false) const [loading, setLoading] = useState(false) const [me, { isBusy }] = useUsersMe() const [, { execPatch }] = useTask(taskId) - const apiUrl = makeApiUrl("cases", caseId) + const apiUrl = makeApiUrl("cases", caseId, "workflows") + const { getContextItem, updateContextItem } = useContextCache("cases", apiUrl) useEffect(() => { @@ -49,25 +50,26 @@ const SelectTask: React.FC = ({ task }) => { .then((resp: any) => { if (resp.status === 200) { // Owner is siuccesfully changed so update context tp prevent a hard page reload for just a checkbox. - const caseItem = getContextItem() + const response = getContextItem() + const workflows = response?.results // Find the index of the workflow containing the task to be updated - const workflowIndex = caseItem.workflows.findIndex((workflow: any) => + const workflowIndex = workflows.findIndex((workflow: any) => workflow.tasks.some((task: any) => task.case_user_task_id === taskId) ) // If the workflow containing the task is found if (workflowIndex !== -1) { // Find the index of the task within the workflow - const taskIndex = caseItem.workflows[workflowIndex].tasks.findIndex((task: any) => + const taskIndex = workflows[workflowIndex].tasks.findIndex((task: any) => task.case_user_task_id === taskId ) // If the task is found within the workflow if (taskIndex !== -1) { // Make a deep copy of the original case object (Optional: to maintain immutability) - const updatedCase = structuredClone(caseItem) + const updatedResponse = structuredClone(response) // Update the task as needed - updatedCase.workflows[workflowIndex].tasks[taskIndex].owner = resp.data.owner + updatedResponse.results[workflowIndex].tasks[taskIndex].owner = resp.data.owner // Update context of the case - updateContextItem(updatedCase) + updateContextItem(updatedResponse) } else { console.error("Task not found within the workflow.") } @@ -95,4 +97,4 @@ const SelectTask: React.FC = ({ task }) => { ) } -export default SelectTask +export default SelectTaskWorkflow