Skip to content

Commit 9dc7aa9

Browse files
committed
feat: add hybrid testing support with mini testing module selection
1 parent db18381 commit 9dc7aa9

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
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
@@ -721,6 +721,8 @@ function RunTest({ endpoints, filtered, apiCollectionId, disabled, runTestFromOu
721721
generateLabelForSlackIntegration={generateLabelForSlackIntegration}
722722
generateLabelForTeamsIntegration={generateLabelForTeamsIntegration}
723723
getLabel={getLabel}
724+
isHybridTestingEnabled={isHybridTestingEnabled}
725+
miniTestingServiceNames={miniTestingServiceNames}
724726
/>
725727
<AdvancedSettingsComponent dispatchConditions={dispatchConditions} conditions={conditions} />
726728
</>
@@ -895,6 +897,8 @@ function RunTest({ endpoints, filtered, apiCollectionId, disabled, runTestFromOu
895897
generateLabelForSlackIntegration={generateLabelForSlackIntegration}
896898
generateLabelForTeamsIntegration={generateLabelForTeamsIntegration}
897899
getLabel={getLabel}
900+
isHybridTestingEnabled={isHybridTestingEnabled}
901+
miniTestingServiceNames={miniTestingServiceNames}
898902
/>
899903

900904
</VerticalStack>
@@ -928,6 +932,8 @@ function RunTest({ endpoints, filtered, apiCollectionId, disabled, runTestFromOu
928932
generateLabelForSlackIntegration={generateLabelForSlackIntegration}
929933
generateLabelForTeamsIntegration={generateLabelForTeamsIntegration}
930934
getLabel={getLabel}
935+
isHybridTestingEnabled={isHybridTestingEnabled}
936+
miniTestingServiceNames={miniTestingServiceNames}
931937
/>
932938
<AdvancedSettingsComponent dispatchConditions={dispatchConditions} conditions={conditions} />
933939
</>

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Dropdown from "../../../components/layouts/Dropdown";
44
import SingleDate from "../../../components/layouts/SingleDate";
55
import func from "@/util/func"
66

7+
const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes, testRunTimeOptions, testRolesArr, maxConcurrentRequestsOptions, slackIntegrated, generateLabelForSlackIntegration,getLabel, timeFieldsDisabled, teamsTestingWebhookIntegrated, generateLabelForTeamsIntegration, isHybridTestingEnabled, miniTestingServiceNames}) => {
78
const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes, testRunTimeOptions, testRolesArr, maxConcurrentRequestsOptions, slackIntegrated, generateLabelForSlackIntegration,getLabel, timeFieldsDisabled, teamsTestingWebhookIntegrated, generateLabelForTeamsIntegration}) => {
89
const reducer = (state, action) => {
910
switch (action.type) {
@@ -12,7 +13,7 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
1213
let hourlyLabel = testRun.hourlyLabel;
1314
if(hourlyLabel !== "Now"){
1415
const val = hourlyTimes.filter((item) => item.label === hourlyLabel)[0].value;
15-
scheduledEpoch += parseInt(val) * 60 * 60;
16+
scheduledEpoch += parseInt(val) * 60 * 60;
1617
}
1718
const timeNow = new Date().getTime() / 1000;
1819
if(Math.abs(timeNow - scheduledEpoch) < 86400){
@@ -52,7 +53,7 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
5253
recurringWeekly = true;
5354
} else if (runType === 'Monthly') {
5455
recurringMonthly = true;
55-
}
56+
}
5657
setTestRun(prev => ({
5758
...prev,
5859
recurringDaily,
@@ -63,7 +64,7 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
6364
}));
6465
}} />
6566
<div style={{ width: "100%" }}>
66-
<SingleDate
67+
<SingleDate
6768
dispatch={dispatch}
6869
data={state.data}
6970
dataKey="selectedDate"
@@ -152,6 +153,21 @@ const RunTestConfiguration = ({ testRun, setTestRun, runTypeOptions, hourlyTimes
152153
}));
153154
}} />
154155
</HorizontalGrid>
156+
{
157+
isHybridTestingEnabled && miniTestingServiceNames?.length > 0 ?
158+
<Dropdown
159+
label="Select Testing Module"
160+
menuItems={miniTestingServiceNames}
161+
initial={miniTestingServiceNames?.[0]?.value}
162+
selected={(requests) => {
163+
const miniTestingServiceNameOption = getLabel(miniTestingServiceNames, requests)
164+
setTestRun(prev => ({
165+
...prev,
166+
miniTestingServiceName: miniTestingServiceNameOption.value
167+
}))
168+
}}
169+
/> : <></>
170+
}
155171
<Checkbox
156172
label={slackIntegrated ? "Send slack alert post test completion" : generateLabelForSlackIntegration()}
157173
checked={testRun.sendSlackAlert}

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, State state, int periodInSeconds, String name, int testRunTime, int maxConcurrentRequests, boolean sendSlackAlert, boolean sendMsTeamsAlert, String miniTestingServiceName) {

0 commit comments

Comments
 (0)