From 4b12db3a326d3e55951bc03206e176a2eb16979e Mon Sep 17 00:00:00 2001 From: Rodrigo Quelca Date: Fri, 30 Aug 2024 11:42:16 -0400 Subject: [PATCH] add e2e test for end event summaryScreen --- tests/e2e/specs/EndEventRedirect.spec.js | 40 +++++++++++++++++ tests/e2e/specs/TaskRedirect.spec.js | 55 ++++++++++++++++-------- 2 files changed, 78 insertions(+), 17 deletions(-) diff --git a/tests/e2e/specs/EndEventRedirect.spec.js b/tests/e2e/specs/EndEventRedirect.spec.js index 517b9d30e..e3608c2c3 100644 --- a/tests/e2e/specs/EndEventRedirect.spec.js +++ b/tests/e2e/specs/EndEventRedirect.spec.js @@ -14,6 +14,46 @@ function initializeTaskAndScreenIntercepts(method, url, response) { ); } describe("End Event Redirect (Process completed) ", () => { + it("Element destination type is summaryScreen", () => { + initializeTaskAndScreenIntercepts( + "GET", + "http://localhost:5173/api/1.1/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission,elementDestination", + { + id: 1, + advanceStatus: "open", + component: "task-screen", + allow_interstitial: false, + elementDestination: { + type: 'taskList', + value: 'http://localhost:5173/tasks', + }, + user: { + id: 1 + }, + screen: SingleScreen.screens[0], + process_request: { + id: 1, + status: "ACTIVE" + } + } + ); + + cy.visit("/?scenario=TaskRedirect", {}); + + cy.get(".form-group").find("button").click(); + + + cy.socketEventNext("ProcessMaker\\Events\\RedirectTo", { + params: [{ + endEventDestination: { + type:"summaryScreen", + value: null + } + }], + method: "processCompletedRedirect" + }); + cy.url().should("eq", "http://localhost:5173/requests/1"); + }); it("Element destination type is taskList", () => { initializeTaskAndScreenIntercepts( "GET", diff --git a/tests/e2e/specs/TaskRedirect.spec.js b/tests/e2e/specs/TaskRedirect.spec.js index 69f01f429..c433b7cb4 100644 --- a/tests/e2e/specs/TaskRedirect.spec.js +++ b/tests/e2e/specs/TaskRedirect.spec.js @@ -770,22 +770,43 @@ describe("On Task Completed (Submitting Task) ", () => { "GET", "http://localhost:5173/api/1.1/tasks/2?include=data,user,draft,requestor,processRequest,component,requestData,loopContext,bpmnTagName,interstitial,definition,userRequestPermission,elementDestination", { - id: 2, - advanceStatus: "open", - component: "task-screen", - allow_interstitial: false, - elementDestination: { - type: "taskSource", - value: "taskSource", - }, - user: { - id: 1 - }, - screen: SingleScreen.screens[0], - process_request: { - id: 1, - status: "ACTIVE" - } + "data": [ + { + "id": 585, + "uuid": "9ce21eaf-0991-495c-9f11-2e47b409acd5", + "user_id": 1, + "process_id": 7, + "process_request_id": 194, + "subprocess_request_id": null, + "element_id": "node_117", + "element_type": "task", + "element_name": "Form Task 222", + "status": "ACTIVE", + "element_index": 0, + "subprocess_start_event_id": null, + "completed_at": null, + "due_at": "2024-09-01T16:45:13+00:00", + "due_notified": 0, + "initiated_at": null, + "riskchanges_at": "2024-08-31T18:45:13+00:00", + "created_at": "2024-08-29T16:45:13+00:00", + "updated_at": "2024-08-29T16:45:13+00:00", + "version_id": 63, + "version_type": "ProcessMaker\\Models\\ScreenVersion", + "is_self_service": 0, + "self_service_groups": [], + "token_properties": [], + "is_priority": false, + "is_actionbyemail": false, + "user_viewed_at": null, + "advanceStatus": "open", + "draft": null, + "assignable_users": [ + 3 + ], + "can_view_parent_request": false, + } + ] } ); @@ -806,6 +827,6 @@ describe("On Task Completed (Submitting Task) ", () => { }], method: "redirectToTask" }); - // cy.url().should("eq", "http://localhost:5173/about"); + cy.url().should("eq", "http://localhost:5173/?scenario=TaskRedirect"); }); });