From 1e748f39bc518c31ee1c14d14ddcd0a13ff70e18 Mon Sep 17 00:00:00 2001 From: Daniel Dias Date: Fri, 5 Jul 2024 17:19:34 -0300 Subject: [PATCH] update frontend to consider openapi changes --- .../RunDetailTriggerResponseFactory.tsx | 3 +++ .../TestPlugins/EntryPointFactory.tsx | 3 +++ .../components/TestPlugins/FormFactory.tsx | 3 +++ web/src/constants/Common.constants.ts | 3 +++ web/src/constants/Demo.constants.ts | 3 +++ web/src/constants/Plugins.constants.ts | 12 ++++++++++ web/src/constants/Test.constants.ts | 3 +++ web/src/models/Test.model.ts | 1 + web/src/models/TestRun.model.ts | 1 + web/src/models/TestSuiteRun.model.ts | 1 + web/src/models/Trigger.model.ts | 19 ++++++++++++++++ web/src/models/TriggerResult.model.ts | 22 +++++++++++++++++++ web/src/services/Test.service.ts | 6 +++++ 13 files changed, 80 insertions(+) diff --git a/web/src/components/RunDetailTriggerResponse/RunDetailTriggerResponseFactory.tsx b/web/src/components/RunDetailTriggerResponse/RunDetailTriggerResponseFactory.tsx index 016bf36dc9..2ab7da57e3 100644 --- a/web/src/components/RunDetailTriggerResponse/RunDetailTriggerResponseFactory.tsx +++ b/web/src/components/RunDetailTriggerResponse/RunDetailTriggerResponseFactory.tsx @@ -19,6 +19,9 @@ const ComponentMap: Record React.React [TriggerTypes.traceid]: RunDetailTriggerData, [TriggerTypes.cypress]: RunDetailTriggerData, [TriggerTypes.playwright]: RunDetailTriggerData, + [TriggerTypes.artillery]: RunDetailTriggerData, // TODO: remove this later + [TriggerTypes.k6]: RunDetailTriggerData, + [TriggerTypes.playwrightengine]: RunDetailTriggerData, }; interface IProps extends IPropsComponent { diff --git a/web/src/components/TestPlugins/EntryPointFactory.tsx b/web/src/components/TestPlugins/EntryPointFactory.tsx index 53536511e3..f61844098a 100644 --- a/web/src/components/TestPlugins/EntryPointFactory.tsx +++ b/web/src/components/TestPlugins/EntryPointFactory.tsx @@ -11,6 +11,9 @@ const EntryPointFactoryMap = { [TriggerTypes.traceid]: TriggerHeaderBarTraceID, [TriggerTypes.cypress]: () => null, [TriggerTypes.playwright]: () => null, + [TriggerTypes.artillery]: () => null, + [TriggerTypes.k6]: () => null, + [TriggerTypes.playwrightengine]: () => null, }; interface IProps { diff --git a/web/src/components/TestPlugins/FormFactory.tsx b/web/src/components/TestPlugins/FormFactory.tsx index 08ac33169e..dd034b2bd2 100644 --- a/web/src/components/TestPlugins/FormFactory.tsx +++ b/web/src/components/TestPlugins/FormFactory.tsx @@ -10,6 +10,9 @@ const FormFactoryMap = { [TriggerTypes.traceid]: () => null, [TriggerTypes.cypress]: () => null, [TriggerTypes.playwright]: () => null, + [TriggerTypes.artillery]: () => null, + [TriggerTypes.k6]: () => null, + [TriggerTypes.playwrightengine]: () => null, }; interface IProps { diff --git a/web/src/constants/Common.constants.ts b/web/src/constants/Common.constants.ts index a91bac071c..2ff2248516 100644 --- a/web/src/constants/Common.constants.ts +++ b/web/src/constants/Common.constants.ts @@ -76,4 +76,7 @@ export enum SupportedPlugins { TraceID = 'TraceID', Cypress = 'Cypress', Playwright = 'Playwright', + Artillery = 'Artillery', // TODO: think on how to remove this + K6 = 'K6', + PlaywrightEngine = 'PlaywrightEngine', } diff --git a/web/src/constants/Demo.constants.ts b/web/src/constants/Demo.constants.ts index ab6948bf1e..114d5414d2 100644 --- a/web/src/constants/Demo.constants.ts +++ b/web/src/constants/Demo.constants.ts @@ -231,5 +231,8 @@ export function getDemoByPluginMap(demos: Demo[]) { [SupportedPlugins.Cypress]: [], [SupportedPlugins.Playwright]: [], [SupportedPlugins.Kafka]: (pokeshopDemoMap && pokeshopDemoMap[SupportedPlugins.Kafka]) || [], + [SupportedPlugins.Artillery]: [], + [SupportedPlugins.K6]: [], + [SupportedPlugins.PlaywrightEngine]: [], }; } diff --git a/web/src/constants/Plugins.constants.ts b/web/src/constants/Plugins.constants.ts index d809858f2e..e5bbc13dd7 100644 --- a/web/src/constants/Plugins.constants.ts +++ b/web/src/constants/Plugins.constants.ts @@ -68,6 +68,15 @@ const Playwright: IPlugin = { requestType: TriggerTypes.traceid, }; +const NoOp: IPlugin = { // TODO: think on how to remove this + name: SupportedPlugins.Artillery, + title: 'NoOp', + description: 'NoOp', + isActive: false, + demoList: [], + type: TriggerTypes.traceid, +}; + export const Plugins = { [SupportedPlugins.REST]: Rest, [SupportedPlugins.GRPC]: GRPC, @@ -84,6 +93,9 @@ export const TriggerTypeToPlugin = { [TriggerTypes.traceid]: Plugins.TraceID, [TriggerTypes.cypress]: Plugins.Cypress, [TriggerTypes.playwright]: Plugins.Playwright, + [TriggerTypes.artillery]: NoOp, + [TriggerTypes.k6]: NoOp, + [TriggerTypes.playwrightengine]: NoOp, } as const; export const CreateTriggerTypeToPlugin = { diff --git a/web/src/constants/Test.constants.ts b/web/src/constants/Test.constants.ts index a70fd8caf3..5682b75f2c 100644 --- a/web/src/constants/Test.constants.ts +++ b/web/src/constants/Test.constants.ts @@ -12,6 +12,9 @@ export enum TriggerTypes { kafka = 'kafka', cypress = 'cypress', playwright = 'playwright', + artillery = 'artillery', + k6 = 'k6', + playwrightengine = 'playwrightengine', } export enum ImportTypes { diff --git a/web/src/models/Test.model.ts b/web/src/models/Test.model.ts index 1db2ba151c..81246fcf77 100644 --- a/web/src/models/Test.model.ts +++ b/web/src/models/Test.model.ts @@ -47,6 +47,7 @@ Test.FromRawTest = ({ trigger: Trigger(rawTrigger || {}), summary: Summary(summary), outputs: outputs.map((rawOutput, index) => TestOutput(rawOutput, index)), + pollingProfile: '', }; }; diff --git a/web/src/models/TestRun.model.ts b/web/src/models/TestRun.model.ts index e4dbcc3678..62b83f3b7b 100644 --- a/web/src/models/TestRun.model.ts +++ b/web/src/models/TestRun.model.ts @@ -149,6 +149,7 @@ const TestRun = ({ testSuiteRunId: testSuiteRunId ? Number(testSuiteRunId) : 0, linter: LinterResult(linter), requiredGatesResult: RequiredGatesResult(requiredGatesResult), + runGroupId: '' }; }; diff --git a/web/src/models/TestSuiteRun.model.ts b/web/src/models/TestSuiteRun.model.ts index ba033a7073..73a9a72e95 100644 --- a/web/src/models/TestSuiteRun.model.ts +++ b/web/src/models/TestSuiteRun.model.ts @@ -42,6 +42,7 @@ const TestSuiteRun = ({ version, pass, fail, + runGroupId: '', }; }; diff --git a/web/src/models/Trigger.model.ts b/web/src/models/Trigger.model.ts index 64c611a054..44d8cb2a69 100644 --- a/web/src/models/Trigger.model.ts +++ b/web/src/models/Trigger.model.ts @@ -61,6 +61,25 @@ const EntryData = { method: 'Kafka', }; }, + // TODO: think on how to decouple this + [TriggerTypes.artillery](request: TRequest) { + return { + entryPoint: '', + method: '', + }; + }, + [TriggerTypes.k6](request: TRequest) { + return { + entryPoint: '', + method: '', + }; + }, + [TriggerTypes.playwrightengine](request: TRequest) { + return { + entryPoint: '', + method: '', + }; + }, }; const Trigger = ({ diff --git a/web/src/models/TriggerResult.model.ts b/web/src/models/TriggerResult.model.ts index 6acc3c797b..8fc0456de9 100644 --- a/web/src/models/TriggerResult.model.ts +++ b/web/src/models/TriggerResult.model.ts @@ -60,6 +60,28 @@ const ResponseData = { statusCode: 0, }; }, + // TODO: review this + [TriggerTypes.artillery](response: object) { + return { + body: get(response, 'id', ''), + headers: [], + statusCode: 200, + }; + }, + [TriggerTypes.k6](response: object) { + return { + body: get(response, 'id', ''), + headers: [], + statusCode: 200, + }; + }, + [TriggerTypes.playwrightengine](response: object) { + return { + body: get(response, 'id', ''), + headers: [], + statusCode: 200, + }; + }, }; const TriggerResult = ({ diff --git a/web/src/services/Test.service.ts b/web/src/services/Test.service.ts index be970eed38..c69917455b 100644 --- a/web/src/services/Test.service.ts +++ b/web/src/services/Test.service.ts @@ -37,6 +37,9 @@ const TriggerServiceMap = { [SupportedPlugins.TraceID]: TraceIDService, [SupportedPlugins.Cypress]: CypressService, [SupportedPlugins.Playwright]: CypressService, + [SupportedPlugins.Artillery]: CypressService, + [SupportedPlugins.K6]: CypressService, + [SupportedPlugins.PlaywrightEngine]: CypressService, } as const; const TriggerServiceByTypeMap = { @@ -46,6 +49,9 @@ const TriggerServiceByTypeMap = { [TriggerTypes.cypress]: CypressService, [TriggerTypes.playwright]: CypressService, [TriggerTypes.kafka]: KafkaService, + [TriggerTypes.artillery]: CypressService, + [TriggerTypes.k6]: CypressService, + [TriggerTypes.playwrightengine]: CypressService, } as const; const TestService = () => ({