Skip to content

Commit

Permalink
update frontend to consider openapi changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbdias committed Jul 5, 2024
1 parent 7fa4115 commit 1e748f3
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const ComponentMap: Record<TriggerTypes, (props: IPropsComponent) => 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 {
Expand Down
3 changes: 3 additions & 0 deletions web/src/components/TestPlugins/EntryPointFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions web/src/components/TestPlugins/FormFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions web/src/constants/Common.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
3 changes: 3 additions & 0 deletions web/src/constants/Demo.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]: [],
};
}
12 changes: 12 additions & 0 deletions web/src/constants/Plugins.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = {
Expand Down
3 changes: 3 additions & 0 deletions web/src/constants/Test.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export enum TriggerTypes {
kafka = 'kafka',
cypress = 'cypress',
playwright = 'playwright',
artillery = 'artillery',
k6 = 'k6',
playwrightengine = 'playwrightengine',
}

export enum ImportTypes {
Expand Down
1 change: 1 addition & 0 deletions web/src/models/Test.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Test.FromRawTest = ({
trigger: Trigger(rawTrigger || {}),
summary: Summary(summary),
outputs: outputs.map((rawOutput, index) => TestOutput(rawOutput, index)),
pollingProfile: '',
};
};

Expand Down
1 change: 1 addition & 0 deletions web/src/models/TestRun.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const TestRun = ({
testSuiteRunId: testSuiteRunId ? Number(testSuiteRunId) : 0,
linter: LinterResult(linter),
requiredGatesResult: RequiredGatesResult(requiredGatesResult),
runGroupId: ''
};
};

Expand Down
1 change: 1 addition & 0 deletions web/src/models/TestSuiteRun.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const TestSuiteRun = ({
version,
pass,
fail,
runGroupId: '',
};
};

Expand Down
19 changes: 19 additions & 0 deletions web/src/models/Trigger.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ const EntryData = {
method: 'Kafka',
};
},
// TODO: think on how to decouple this
[TriggerTypes.artillery](request: TRequest) {

Check warning on line 65 in web/src/models/Trigger.model.ts

View workflow job for this annotation

GitHub Actions / WebUI unit tests

'request' is defined but never used
return {
entryPoint: '',
method: '',
};
},
[TriggerTypes.k6](request: TRequest) {

Check warning on line 71 in web/src/models/Trigger.model.ts

View workflow job for this annotation

GitHub Actions / WebUI unit tests

'request' is defined but never used
return {
entryPoint: '',
method: '',
};
},
[TriggerTypes.playwrightengine](request: TRequest) {

Check warning on line 77 in web/src/models/Trigger.model.ts

View workflow job for this annotation

GitHub Actions / WebUI unit tests

'request' is defined but never used
return {
entryPoint: '',
method: '',
};
},
};

const Trigger = ({
Expand Down
22 changes: 22 additions & 0 deletions web/src/models/TriggerResult.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ({
Expand Down
6 changes: 6 additions & 0 deletions web/src/services/Test.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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 = () => ({
Expand Down

0 comments on commit 1e748f3

Please sign in to comment.