From 59e7a981654c81ab0fd2cbc3aeca8009851597e6 Mon Sep 17 00:00:00 2001 From: Mikael Moilanen Date: Thu, 19 Sep 2024 09:44:55 +0300 Subject: [PATCH] Update sap wsdl schema --- backend/resources/projectinfo.wsdl | 1871 ++++++++++++----------- backend/src/components/sap/transform.ts | 4 +- docker/sap-mock/actuals.wsdl | 486 +++++- docker/sap-mock/projectinfo.wsdl | 1106 +++++++++++++- e2e/test/api/sap.test.ts | 25 +- 5 files changed, 2596 insertions(+), 896 deletions(-) mode change 120000 => 100644 docker/sap-mock/actuals.wsdl mode change 120000 => 100644 docker/sap-mock/projectinfo.wsdl diff --git a/backend/resources/projectinfo.wsdl b/backend/resources/projectinfo.wsdl index 056259eb..6e1c1800 100644 --- a/backend/resources/projectinfo.wsdl +++ b/backend/resources/projectinfo.wsdl @@ -1,8 +1,8 @@ - - - - - + + + + + + Company Code + + + + + + + + + + Project code + + + + + + + + + + Boolean Variable (X=true, -=false, space=unknown) + + + + + + + + + + System Status + + + + + + + + + + + + + + + + Return table + + + + + + + + + + Project + + + + + + + + + + + + + + + + + + + + + Return Parameter + + + + + Message type: S Success, E Error, W Warning, I Info, A Abort + + + + + + + + + + Message Class + + + + + + + + + + Message Number + + + + + + + + + + + Message Text + + + + + + + + + + Application Log: Log Number + + + + + + + + + + Application Log: Internal Message Serial Number + + + + + + + + + + + Message Variable + + + + + + + + + + Message Variable + + + + + + + + + + Message Variable + + + + + + + + + + Message Variable + + + + + + + + + + Parameter Name + + + + + + + + + + Lines in parameter + + + + + Field in parameter + + + + + + + + + + Logical system from which message originates + + + + + + + + + + + + Project + + + + + Project definition (internal) + + + + + + + + + + + Project definition + + + + + + + + + + PS: Short description (1st text line) + + + + + + + + + + Name of Person Responsible for Creating the Object + + + + + + + + + + Date on Which Record Was Created + + + + + Name of Person Who Changed Object + + + + + + + + + + Last Changed On + + + + + Number of the responsible person (project manager) + + + + + + + + + + + Name of responsible person (Project manager) + + + + + + + + + + Applicant number + + + + + + + + + + + Applicant + + + + + + + + + + Company code for the project + + + + + + + + + + Profit Center + + + + + + + + + + Project planned start date + + + + + Project planned finish date + + + + + Plant + + + + + + + + + + System Status + + + + + + + + + + + + + Network + + + + + + + + Network + + + + + Order Number + + + + + + + + + + Description + + + + + + + + + + Work breakdown structure element (WBS element) + + + + + + + + + + + Current number of the appropriate project + + + + + + + + + + + Entered by + + + + + + + + + + Created on + + + + + Scheduled start + + + + + Scheduled finish + + + + + Scheduled release date + + + + + Basic start date + + + + + Basic finish date + + + + + Actual start date + + + + + Confirmed Order Finish Date + + + + + Actual release date + + + + + Last Changed By + + + + + + + + + + Change date for Order Master + + + + + Company Code + + + + + + + + + + Plant + + + + + + + + + + Location plant + + + + + + + + + + Technical completion date + + + + + Profit Center + + + + + + + + + + Sales Order Number + + + + + + + + + + Item Number in Sales Order + + + + + + + + + - Project code + Main work center for maintenance tasks - + - + + - - - - - + + + Activity + + + - Return table + Routing number of operations in the order - - - - - + + + + + + - + - Project + General counter for order + + + + + + - - - - - - - - - - - - - - Return Parameter - - - - - Message type: S Success, E Error, W Warning, I Info, - A Abort - - - - - - - - - - Message Class - - - - - - - - - - Message Number - - - - - - - - - - - Message Text - - - - - - - - - - Application log: log number - - - - - - - - - - Application log: Internal message serial number - - - - - - - - - - - Message Variable - - - - - - - - - - Message Variable - - - - - - - - - - Message Variable - - - - - - - - - - Message Variable - - - - - - - - - - Parameter Name - - - - - - - - - - Lines in parameter - - - - - Field in parameter - - - - - - - - - - Logical system from which message originates - - - - - - - - - - - - Project - - - - - Project definition (internal) - - - - - - - - - - - Project definition - - - - - - - - - - PS: Short description (1st text line) - - - - - - - - - - Name of Person Who Created the Object - - - - - - - - - - Date on Which Record Was Created - - - - - Name of person who changed object - - - - - - - - - - Date of Last Change - - - - - Number of the responsible person (project manager) - - - - - - - - - - - Name of responsible person (Project manager) - - - - - - - - - - Applicant number - - - - - - - - - - - Applicant - - - - - - - - - - Company code for the project - - - - - - - - - - Profit Center - - - - - - - - - - Project planned start date - - - - - Project planned finish date - - - - - Plant - - - - - - - - - - - - - Network - - - - - - - - Network - - - - - Order Number - - - - - - - - - - Description - - - - - - - - - - Work breakdown structure element (WBS element) - - - - - - - - - - - Current number of the appropriate project - - - - - - - - - - - Entered by - - - - - - - - - - Created on - - - - - Scheduled start - - - - - Scheduled finish - - - - - Scheduled release date - - - - - Basic start date - - - - - Basic finish date - - - - - Actual start date - - - - - Confirmed Order Finish Date - - - - - Actual release date - - - - - Last changed by - - - - - - - - - - Change date for Order Master - - - - - Company Code - - - - - - - - - - Plant - - - - - - - - - - Location plant - - - - - - - - - - Technical completion date - - - - - Profit Center - - - - - - - - - - Sales Order Number - - - - - - - - - - Item number in Sales Order - - - - - - - - - - - Main work center for maintenance tasks - - - - - - - - - - - - - Activity - - - - - Routing number of operations in the order - - - - - - - - - - - General counter for order - - - - - - - - - - - Activity Number - - - - - - - - - - Order Number - - - - - - - - - - Operation short text - - - - - - - - - - + + Activity Number + + + + + + + + + + Order Number + + + + + + + + + + Operation Short Text + + + + + + + + + + Current number of the appropriate project - - - - - - - - - - - + + + + + + + + + + Work breakdown structure element (WBS element) - - - - - - - - - - - Profit Center - - - - - - - - - - Plant - - - - - - - - - - - - Wbs - - - + + + + + + + + + + Profit Center + + + + + + + + + + Plant + + + + + + + + + + + + Wbs + + + - - - - - Wbs - - - - - WBS Element - - - - - - - - - - - + + + + Wbs + + + + + WBS Element + + + + + + + + + + + Work Breakdown Structure Element (WBS Element) - - - - - - - - - - + + + + + + + + + PS: Short description (1st text line) - - - - - - - - - - Object number - - - - - - - - - - + + + + + + + + + Object number + + + + + + + + + + Current number of the appropriate project - - - - - - - - - - - Name of Person Who Created the Object - - - - - - - - - - Date on Which Record Was Created - - - - - Name of person who changed object - - - - - - - - - - + + + + + + + + + + Name of Person Responsible for Creating the Object + + + + + + + + + + Date on Which Record Was Created + + + + + Name of Person Who Changed Object + + + + + + + + + + Date on which object was last changed - - - - - + + + + Number of the responsible person (project manager) - - - - - - - - - - - Applicant number - - - - - - - - - - - Applicant - - - - - - - - - - Level in Project Hierarchy - - - - - Requesting cost center - - - - - - - - - - Responsible cost center - - - - - - - - - - Project type - - - - - - - - - - Priority - - - - - - - - - - Plant - - - - - - - - - - Technically complete date - - - - - Reason for investment - - - - - - - - - - + + + + + + + + + + Applicant number + + + + + + + + + + + Applicant + + + + + + + + + + Level in Project Hierarchy + + + + + Requesting cost center + + + + + + + + + + Responsible cost center + + + + + + + + + + Project type + + + + + + + + + + Priority + + + + + + + + + + Plant + + + + + + + + + + 1st user field for 20 characters - WBS element- + + + + + + + + + + 2nd user field 20 digits - WBS element + + + + + + + + + + 3rd user-defined field 10 digits -WBS element + + + + + + + + + + 4th user-defined field 10 digits -WBS element + + + + + + + + + + 1st user field for values (length 10,3) WBS element + + + + + + + + + + + Technically complete date + + + + + Reason for investment + + + + + + + + + + Reason for environmental investment - - - - - - - - - - - - - Activity - - - + + + + + + + + + + + + Activity + + + - - - + + + @@ -979,8 +1090,16 @@ + + diff --git a/backend/src/components/sap/transform.ts b/backend/src/components/sap/transform.ts index fadcda8d..fa97936f 100644 --- a/backend/src/components/sap/transform.ts +++ b/backend/src/components/sap/transform.ts @@ -54,8 +54,8 @@ function preprocessProjectInfo(payload: any) { } const data = { - ...item, - WBS: transformWBS(item.WBS), + ...item['0'], + WBS: transformWBS(item['0'].WBS), } as const; return incomingSapProjectSchema.parse(data); diff --git a/docker/sap-mock/actuals.wsdl b/docker/sap-mock/actuals.wsdl deleted file mode 120000 index 9cdf1dd6..00000000 --- a/docker/sap-mock/actuals.wsdl +++ /dev/null @@ -1 +0,0 @@ -../../backend/resources/actuals.wsdl \ No newline at end of file diff --git a/docker/sap-mock/actuals.wsdl b/docker/sap-mock/actuals.wsdl new file mode 100644 index 00000000..87fa8fce --- /dev/null +++ b/docker/sap-mock/actuals.wsdl @@ -0,0 +1,485 @@ + + + + + + + + + + + + + Actuals + + + + + + + + + + Return table + + + + + + + + + + + + + + + + Order Number + + + + + + + + + + Posting Date + + + + + Posting Date + + + + + Work Breakdown Structure Element (WBS Element) + + + + + + + + + + Project definition + + + + + + + + + + + + + + + + + + + + + Return Parameter + + + + + Message type: S Success, E Error, W Warning, I Info, A Abort + + + + + + + + + + Message Class + + + + + + + + + + Message Number + + + + + + + + + + + Message Text + + + + + + + + + + Application log: log number + + + + + + + + + + Application log: Internal message serial number + + + + + + + + + + + Message Variable + + + + + + + + + + Message Variable + + + + + + + + + + Message Variable + + + + + + + + + + Message Variable + + + + + + + + + + Parameter Name + + + + + + + + + + Lines in parameter + + + + + Field in parameter + + + + + + + + + + Logical system from which message originates + + + + + + + + + + + + Actuals + + + + + Document Number + + + + + + + + + + Fiscal Year + + + + + + + + + + + Document Date + + + + + Posting Date + + + + + Date Document Was Created + + + + + Project definition + + + + + + + + + + Work Breakdown Structure Element (WBS Element) + + + + + + + + + + Order Number + + + + + + + + + + Operation Number + + + + + + + + + + CO Object Name + + + + + + + + + + Object type + + + + + + + + + + Cost Element + + + + + + + + + + Cost Element Description + + + + + + + + + + Transaction Currency + + + + + + + + + + Total Value in Transaction Currency + + + + + + + + + + + Debit/credit indicator + + + + + + + + + + Company ID of Trading Partner + + + + + + + + + + Document type of FI reference document + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docker/sap-mock/projectinfo.wsdl b/docker/sap-mock/projectinfo.wsdl deleted file mode 120000 index 1e63847d..00000000 --- a/docker/sap-mock/projectinfo.wsdl +++ /dev/null @@ -1 +0,0 @@ -../../backend/resources/projectinfo.wsdl \ No newline at end of file diff --git a/docker/sap-mock/projectinfo.wsdl b/docker/sap-mock/projectinfo.wsdl new file mode 100644 index 00000000..6e1c1800 --- /dev/null +++ b/docker/sap-mock/projectinfo.wsdl @@ -0,0 +1,1105 @@ + + + + + + + + + + + + + + + + + + + Company Code + + + + + + + + + + Project code + + + + + + + + + + Boolean Variable (X=true, -=false, space=unknown) + + + + + + + + + + System Status + + + + + + + + + + + + + + + + Return table + + + + + + + + + + Project + + + + + + + + + + + + + + + + + + + + + Return Parameter + + + + + Message type: S Success, E Error, W Warning, I Info, A Abort + + + + + + + + + + Message Class + + + + + + + + + + Message Number + + + + + + + + + + + Message Text + + + + + + + + + + Application Log: Log Number + + + + + + + + + + Application Log: Internal Message Serial Number + + + + + + + + + + + Message Variable + + + + + + + + + + Message Variable + + + + + + + + + + Message Variable + + + + + + + + + + Message Variable + + + + + + + + + + Parameter Name + + + + + + + + + + Lines in parameter + + + + + Field in parameter + + + + + + + + + + Logical system from which message originates + + + + + + + + + + + + Project + + + + + Project definition (internal) + + + + + + + + + + + Project definition + + + + + + + + + + PS: Short description (1st text line) + + + + + + + + + + Name of Person Responsible for Creating the Object + + + + + + + + + + Date on Which Record Was Created + + + + + Name of Person Who Changed Object + + + + + + + + + + Last Changed On + + + + + Number of the responsible person (project manager) + + + + + + + + + + + Name of responsible person (Project manager) + + + + + + + + + + Applicant number + + + + + + + + + + + Applicant + + + + + + + + + + Company code for the project + + + + + + + + + + Profit Center + + + + + + + + + + Project planned start date + + + + + Project planned finish date + + + + + Plant + + + + + + + + + + System Status + + + + + + + + + + + + + Network + + + + + + + + Network + + + + + Order Number + + + + + + + + + + Description + + + + + + + + + + Work breakdown structure element (WBS element) + + + + + + + + + + + Current number of the appropriate project + + + + + + + + + + + Entered by + + + + + + + + + + Created on + + + + + Scheduled start + + + + + Scheduled finish + + + + + Scheduled release date + + + + + Basic start date + + + + + Basic finish date + + + + + Actual start date + + + + + Confirmed Order Finish Date + + + + + Actual release date + + + + + Last Changed By + + + + + + + + + + Change date for Order Master + + + + + Company Code + + + + + + + + + + Plant + + + + + + + + + + Location plant + + + + + + + + + + Technical completion date + + + + + Profit Center + + + + + + + + + + Sales Order Number + + + + + + + + + + Item Number in Sales Order + + + + + + + + + + + Main work center for maintenance tasks + + + + + + + + + + + + + Activity + + + + + Routing number of operations in the order + + + + + + + + + + + General counter for order + + + + + + + + + + + Activity Number + + + + + + + + + + Order Number + + + + + + + + + + Operation Short Text + + + + + + + + + + Current number of the appropriate project + + + + + + + + + + + Work breakdown structure element (WBS element) + + + + + + + + + + + Profit Center + + + + + + + + + + Plant + + + + + + + + + + + + Wbs + + + + + + + + Wbs + + + + + WBS Element + + + + + + + + + + + Work Breakdown Structure Element (WBS Element) + + + + + + + + + + PS: Short description (1st text line) + + + + + + + + + + Object number + + + + + + + + + + Current number of the appropriate project + + + + + + + + + + + Name of Person Responsible for Creating the Object + + + + + + + + + + Date on Which Record Was Created + + + + + Name of Person Who Changed Object + + + + + + + + + + Date on which object was last changed + + + + + Number of the responsible person (project manager) + + + + + + + + + + + Applicant number + + + + + + + + + + + Applicant + + + + + + + + + + Level in Project Hierarchy + + + + + Requesting cost center + + + + + + + + + + Responsible cost center + + + + + + + + + + Project type + + + + + + + + + + Priority + + + + + + + + + + Plant + + + + + + + + + + 1st user field for 20 characters - WBS element- + + + + + + + + + + 2nd user field 20 digits - WBS element + + + + + + + + + + 3rd user-defined field 10 digits -WBS element + + + + + + + + + + 4th user-defined field 10 digits -WBS element + + + + + + + + + + 1st user field for values (length 10,3) WBS element + + + + + + + + + + + Technically complete date + + + + + Reason for investment + + + + + + + + + + Reason for environmental investment + + + + + + + + + + + + + Activity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/e2e/test/api/sap.test.ts b/e2e/test/api/sap.test.ts index 8d22d289..c87e2980 100644 --- a/e2e/test/api/sap.test.ts +++ b/e2e/test/api/sap.test.ts @@ -1,16 +1,9 @@ -import { expect, test } from '@playwright/test'; -import { login } from '@utils/page.js'; -import { DEV_USER, UserSessionObject } from '@utils/users.js'; +import { expect } from '@playwright/test'; +import { test } from '@utils/fixtures.js'; -test.describe('Project endpoints', () => { - let devSession: UserSessionObject; - - test.beforeAll(async ({ browser }) => { - devSession = await login(browser, DEV_USER); - }); - - test('SAP project import without WBS', async () => { - const res = await devSession.client.sap.getSapProject.mutate({ +test.describe.only('Project endpoints', () => { + test('SAP project import without WBS', async ({ devSession }) => { + const res = await devSession.session.client.sap.getSapProject.mutate({ projectId: 'A1111_00000', }); // NOTE: Full set of fields checked in 2 WBS / 2 Activities test. This checks the empty @@ -21,8 +14,8 @@ test.describe('Project endpoints', () => { }); }); - test('SAP project import with one WBS and one activity per WBS', async () => { - const res = await devSession.client.sap.getSapProject.mutate({ + test('SAP project import with one WBS and one activity per WBS', async ({ devSession }) => { + const res = await devSession.session.client.sap.getSapProject.mutate({ projectId: 'A1111_11000', }); @@ -44,8 +37,8 @@ test.describe('Project endpoints', () => { }); }); - test('SAP project import with two WBS and two activities per WBS', async () => { - const res = await devSession.client.sap.getSapProject.mutate({ + test('SAP project import with two WBS and two activities per WBS', async ({ devSession }) => { + const res = await devSession.session.client.sap.getSapProject.mutate({ projectId: 'A1111_22000', });