Skip to content

Commit f99ddba

Browse files
committed
feat: add hybrid testing support with mini testing module selection
1 parent 6170a2d commit f99ddba

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/RunTest.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,8 @@ function RunTest({ endpoints, filtered, apiCollectionId, disabled, runTestFromOu
737737
generateLabelForTeamsIntegration={generateLabelForTeamsIntegration}
738738
getLabel={getLabel}
739739
jiraProjectMap={jiraProjectMap}
740+
isHybridTestingEnabled={isHybridTestingEnabled}
741+
miniTestingServiceNames={miniTestingServiceNames}
740742
/>
741743
<AdvancedSettingsComponent dispatchConditions={dispatchConditions} conditions={conditions} />
742744
</>
@@ -912,6 +914,8 @@ function RunTest({ endpoints, filtered, apiCollectionId, disabled, runTestFromOu
912914
generateLabelForTeamsIntegration={generateLabelForTeamsIntegration}
913915
getLabel={getLabel}
914916
jiraProjectMap={jiraProjectMap}
917+
isHybridTestingEnabled={isHybridTestingEnabled}
918+
miniTestingServiceNames={miniTestingServiceNames}
915919
/>
916920

917921
</VerticalStack>
@@ -946,6 +950,8 @@ function RunTest({ endpoints, filtered, apiCollectionId, disabled, runTestFromOu
946950
generateLabelForTeamsIntegration={generateLabelForTeamsIntegration}
947951
getLabel={getLabel}
948952
jiraProjectMap={jiraProjectMap}
953+
isHybridTestingEnabled={isHybridTestingEnabled}
954+
miniTestingServiceNames={miniTestingServiceNames}
949955
/>
950956
<AdvancedSettingsComponent dispatchConditions={dispatchConditions} conditions={conditions} />
951957
</>

apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/RunTestConfiguration.jsx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import SingleDate from "../../../components/layouts/SingleDate";
55
import func from "@/util/func"
66
import DropdownSearch from '../../../components/shared/DropdownSearch';
77

8-
const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes, testRunTimeOptions, testRolesArr, maxConcurrentRequestsOptions, slackIntegrated, generateLabelForSlackIntegration,getLabel, timeFieldsDisabled, teamsTestingWebhookIntegrated, generateLabelForTeamsIntegration, jiraProjectMap}) => {
8+
const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes, testRunTimeOptions, testRolesArr, maxConcurrentRequestsOptions, slackIntegrated, generateLabelForSlackIntegration,getLabel, timeFieldsDisabled, teamsTestingWebhookIntegrated, generateLabelForTeamsIntegration, , isHybridTestingEnabled, miniTestingServiceNames, jiraProjectMap}) => {
99
const reducer = (state, action) => {
1010
switch (action.type) {
1111
case "update":
1212
let scheduledEpoch = new Date(action.obj['selectedDate']).getTime() / 1000;
1313
let hourlyLabel = testRun.hourlyLabel;
1414
if(hourlyLabel !== "Now"){
1515
const val = hourlyTimes.filter((item) => item.label === hourlyLabel)[0].value;
16-
scheduledEpoch += parseInt(val) * 60 * 60;
16+
scheduledEpoch += parseInt(val) * 60 * 60;
1717
}
1818
const timeNow = new Date().getTime() / 1000;
1919
if(Math.abs(timeNow - scheduledEpoch) < 86400){
@@ -43,7 +43,7 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
4343
value: ele.issueType
4444
}))
4545
: [];
46-
46+
4747
const severitiesArr = func.getAktoSeverities()
4848
const allSeverity = severitiesArr.map((x) => {return{value: x, label: func.toSentenceCase(x), id: func.toSentenceCase(x)}})
4949

@@ -54,9 +54,9 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
5454
jiraProjectMap[firstProject]?.[0]?.issueType
5555
? jiraProjectMap[firstProject][0].issueType
5656
: "";
57-
57+
5858
const checkPrevToggle = !testRun?.autoTicketingDetails?.shouldCreateTickets;
59-
59+
6060
if (checkPrevToggle) {
6161
setTestRun((prev) => ({
6262
...prev,
@@ -104,7 +104,7 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
104104
recurringWeekly = true;
105105
} else if (runType === 'Monthly') {
106106
recurringMonthly = true;
107-
}
107+
}
108108
setTestRun(prev => ({
109109
...prev,
110110
recurringDaily,
@@ -115,7 +115,7 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
115115
}));
116116
}} />
117117
<div style={{ width: "100%" }}>
118-
<SingleDate
118+
<SingleDate
119119
dispatch={dispatch}
120120
data={state.data}
121121
dataKey="selectedDate"
@@ -204,6 +204,21 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
204204
}));
205205
}} />
206206
</HorizontalGrid>
207+
{
208+
isHybridTestingEnabled && miniTestingServiceNames?.length > 0 ?
209+
<Dropdown
210+
label="Select Testing Module"
211+
menuItems={miniTestingServiceNames}
212+
initial={miniTestingServiceNames?.[0]?.value}
213+
selected={(requests) => {
214+
const miniTestingServiceNameOption = getLabel(miniTestingServiceNames, requests)
215+
setTestRun(prev => ({
216+
...prev,
217+
miniTestingServiceName: miniTestingServiceNameOption.value
218+
}))
219+
}}
220+
/> : <></>
221+
}
207222
<Checkbox
208223
label={slackIntegrated ? "Send slack alert post test completion" : generateLabelForSlackIntegration()}
209224
checked={testRun.sendSlackAlert}
@@ -241,7 +256,7 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
241256
placeHolder={"Select Issue Type"}
242257
initial={testRun.autoTicketingDetails.issueType}
243258
/>
244-
<DropdownSearch
259+
<DropdownSearch
245260
optionsList={allSeverity}
246261
placeholder={"Select Severity"}
247262
setSelected={(val) => {setTestRun(prev => ({ ...prev, autoTicketingDetails: { ...prev.autoTicketingDetails, severities: val } })) }}

libs/dao/src/main/java/com/akto/dto/testing/TestingRun.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public TestingRun(int scheduleTimestamp, String userEmail, TestingEndpoints test
7373
this.isNewTestRun = true;
7474
}
7575

76-
public TestingRun(int scheduleTimestamp, String userEmail, TestingEndpoints testingEndpoints, int testIdConfig, State state, int periodInSeconds, String name, int testRunTime, int maxConcurrentRequests, boolean sendSlackAlert) {
77-
this(scheduleTimestamp, userEmail,testingEndpoints,testIdConfig, state, periodInSeconds, name, testRunTime, maxConcurrentRequests, sendSlackAlert, false);
76+
public TestingRun(int scheduleTimestamp, String userEmail, TestingEndpoints testingEndpoints, int testIdConfig, State state, int periodInSeconds, String name, int testRunTime, int maxConcurrentRequests, boolean sendSlackAlert, String miniTestingServiceName) {
77+
this(scheduleTimestamp, userEmail,testingEndpoints,testIdConfig, state, periodInSeconds, name, testRunTime, maxConcurrentRequests, sendSlackAlert, false, miniTestingServiceName);
7878
}
7979

8080
public TestingRun(int scheduleTimestamp, String userEmail, TestingEndpoints testingEndpoints, int testIdConfig,

0 commit comments

Comments
 (0)