Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
63e3e94
[NU-2475] provide active test case ID to redux
Dzuming Mar 11, 2026
dbd9cb3
[NU-2472] fix test
Dzuming Mar 12, 2026
030e2a0
Merge branch 'staging' into NU-2475-provide-active-test-case-info-to-…
Dzuming Mar 12, 2026
0b89481
fix errors
Dzuming Mar 12, 2026
a48a3b4
[NU-2475] get active test case from state
Dzuming Mar 12, 2026
cb1b349
[NU-2472] provide default test cases to imported scenario
Dzuming Mar 13, 2026
cc73af5
[NU-2475] handle multiple test cases
Dzuming Mar 16, 2026
9258dbf
[NU-2475] display all test cases in presets
Dzuming Mar 16, 2026
3ecfea7
[NU-2475] change active test case
Dzuming Mar 16, 2026
9067a8a
[NU-2475] clear test case state on change
Dzuming Mar 17, 2026
1b2d6f9
[NU-2475] add save as test case dialog
Dzuming Mar 17, 2026
40b2c5a
[NU-2475] improvements
Dzuming Mar 17, 2026
bdfc880
Merge branch 'NU-2475-add-option-to-handle-multiple-test-cases' into …
Dzuming Mar 17, 2026
2181b2c
Merge branch 'staging' into NU-2475-provide-active-test-case-info-to-…
Dzuming Mar 18, 2026
ca77646
resolve conflicts
Dzuming Mar 18, 2026
da3a454
Merge branch 'staging' into NU-2475-provide-active-test-case-info-to-…
Dzuming Mar 18, 2026
e545a9f
Merge branch 'NU-2475-provide-active-test-case-info-to-redux' into NU…
Dzuming Mar 18, 2026
cbd0e5c
Merge branch 'staging' into NU-2475-add-option-to-handle-multiple-tes…
Dzuming Mar 18, 2026
2a69366
[NU-2475] fix build
Dzuming Mar 18, 2026
6526fc5
Merge branch 'staging' into NU-2475-add-option-to-handle-multiple-tes…
Dzuming Mar 18, 2026
28200b4
[NU-2475] fix action on test case header
Dzuming Mar 18, 2026
e2845b7
Do not encode single test case
jedrz Mar 18, 2026
f98de32
[NU-2475] fix checking test data per test case
Dzuming Mar 18, 2026
e53c355
[NU-2475] pass test case to specific item
Dzuming Mar 19, 2026
a51b3ec
[NU-2475] change test assertion results redux state
Dzuming Mar 19, 2026
41431d3
Merge branch 'staging' into NU-2475-add-option-to-handle-multiple-tes…
Dzuming Mar 19, 2026
12ac6a4
[NU-2475] item is still collapsable
Dzuming Mar 20, 2026
b979bc6
[NU-2475] change active assertion on run test from test cases panel
Dzuming Mar 20, 2026
2c81da4
[NU-2475] handle TEST_CASE_ASSERTION_RESULTS_FAILED state
Dzuming Mar 20, 2026
4193119
[NU-2475] fix getValidationTestCasesErrors
Dzuming Mar 20, 2026
4adbbe0
[NU-2475] getDefaultActiveTestCaseId with fallback
Dzuming Mar 20, 2026
5f95961
[NU-2475] don't allow to update testCaseId
Dzuming Mar 20, 2026
3f71ff8
[NU-2475] early return when testCaseToRUn undefined
Dzuming Mar 20, 2026
6b10324
[NU-2475] use immer in testCaseReducer
Dzuming Mar 20, 2026
5bd08da
[NU-2475] change null to udefined in footer
Dzuming Mar 20, 2026
4cdbd8a
[NU-2475] Ordering issue w handleRun
Dzuming Mar 20, 2026
0f2444d
[NU-2475] fix typing problem of nodeAssertionResults
Dzuming Mar 20, 2026
15c3440
[NU-2475] remove redundant async from changeActiveTestCase
Dzuming Mar 20, 2026
c3c3a19
[NU-2475] rename handleRunNextTestCase into handleRunTestCaseById.
Dzuming Mar 20, 2026
8f676d9
[NU-2475] rename isGetActiveTestCaseAssertionResultLoading
Dzuming Mar 20, 2026
8329b6a
Merge branch 'staging' into NU-2475-add-option-to-handle-multiple-tes…
Dzuming Mar 20, 2026
b327cf0
Merge branch 'NU-2475-add-option-to-handle-multiple-test-cases' into …
Dzuming Mar 20, 2026
c5bd4dc
[NU-2475] leave single initial testCase
Dzuming Mar 20, 2026
9a46db7
Merge branch 'NU-2475-add-option-to-handle-multiple-test-cases' into …
Dzuming Mar 20, 2026
2e5caf0
[NU-2475] add add test case action
Dzuming Mar 23, 2026
4224ea9
[NU-2475] add validation to test case adding
Dzuming Mar 23, 2026
f82911c
[NU-2475] add e2e test
Dzuming Mar 24, 2026
b20f6c6
[NU-2475] resolve review comments
Dzuming Mar 24, 2026
b309449
Merge branch 'staging' into NU-2475-add-option-to-handle-multiple-tes…
Dzuming Mar 24, 2026
8b45544
[NU-2475] show only single test case when testCases.multipleEnabled: …
Dzuming Mar 24, 2026
ec18f18
[NU-2475] hide run all button
Dzuming Mar 24, 2026
5052077
[NU-2475] fix last run info
Dzuming Mar 24, 2026
98d5aa9
[NU-2475] resolving more code review comments
Dzuming Mar 24, 2026
21ed672
[NU-2475] fix build
Dzuming Mar 24, 2026
5bb626b
Merge branch 'NU-2475-add-option-to-handle-multiple-test-cases' into …
Dzuming Mar 24, 2026
15c84c1
Updated snapshots (#9117)
github-actions[bot] Mar 24, 2026
2f78705
Merge branch 'staging' into NU-2475-add-option-to-handle-multiple-tes…
Dzuming Mar 25, 2026
f7d3ffc
Merge branch 'staging' into NU-2475-add-option-to-save-as-test-case
Dzuming Mar 26, 2026
aabee31
Merge branch 'staging' into NU-2475-add-option-to-save-as-test-case
Dzuming Mar 26, 2026
4ec41b0
[NU-2475] allow test case renaming
Dzuming Mar 26, 2026
a86690c
[NU-2475] add multipleEnabled to docker settings
Dzuming Mar 26, 2026
0ff714a
Merge branch 'staging' into NU-2475-add-option-to-save-as-test-case
Dzuming Mar 26, 2026
ef21a7a
Merge branch 'NU-2475-add-option-to-save-as-test-case' into NU-2475-a…
Dzuming Mar 26, 2026
ca0f72e
Merge branch 'staging' into NU-2475-allow-test-case-renaming
Dzuming Mar 27, 2026
fb3c4c1
[NU-2475] add option to edit test case name
Dzuming Mar 27, 2026
be46fad
[NU-2475] various fixing with naming of test case
Dzuming Mar 30, 2026
f3fb60e
[NU-2475] move useTestCaseNameEdit to separate custom hook
Dzuming Mar 30, 2026
c91e746
[NU-2475] resolve review comments
Dzuming Mar 30, 2026
59a497b
Merge branch 'staging' into NU-2475-allow-test-case-renaming
Dzuming Mar 30, 2026
ad478b4
[NU-2475] resolve validation error for editing position
Dzuming Mar 30, 2026
4c5fc5b
Merge remote-tracking branch 'origin/NU-2475-allow-test-case-renaming…
Dzuming Mar 30, 2026
48d2717
[NU-2475] only writer user type can edit and add test case
Dzuming Mar 30, 2026
bb1cc17
[NU-2475] add option to remove test case
Dzuming Mar 30, 2026
e9fe0a7
Merge branch 'staging' into NU-2475-remove-test-case
Dzuming Apr 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions designer/client/cypress/e2e/testCases.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,22 @@ const openEditNameInput = () => {
cy.get('[data-testid="edit-test-case-name"]').click();
};

const openEditNameInput = () => {
cy.get('[data-testid="edit-test-case-name"]').click();
};

const clickDeleteTestCase = () => {
cy.get('[data-testid="delete-test-case"]').click();
};

const confirmDeleteTestCase = () => {
cy.get('[data-testid="confirm-delete-test-case"]').click();
};

const cancelDeleteTestCase = () => {
cy.get('[data-testid="cancel-delete-test-case"]').click();
};

const expandAssertionItem = (nodeId: string) => {
cy.get(`[id="${nodeId}-header"]`).find('[data-testid="ExpandMoreIcon"]').click();
};
Expand Down
26 changes: 24 additions & 2 deletions designer/client/src/actions/nk/testCasesActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import type { WithUuid } from "../../components/graph/node-modal/appendUuid";
import type { ExpressionObj } from "../../components/graph/node-modal/editors/expression/types";
import type { TestingDataRecords } from "../../components/modals/TestingDataRecords/Table";
import type { TestCase } from "../../reducers/graph/testCase";
import { getTestCaseAssertions, getTestCaseAssertionsForNode, getTestData, getTestCaseMocks } from "../../reducers/selectors/testCases";
import {
getTestCaseAssertions,
getTestCaseAssertionsForNode,
getTestCases,
getTestData,
getTestCaseMocks,
} from "../../reducers/selectors/testCases";
import { getActiveTestCaseId } from "../../reducers/selectors/testing";
import type { ThunkAction } from "../reduxTypes";
import { changeActiveTestCase } from "./testingActions";
Expand All @@ -25,7 +31,8 @@ export type Mocks = Record<string, Mock>;

export type TestCasesActions =
| { type: "UPDATE_TEST_CASE"; testCaseId: string; updates: Omit<Partial<TestCase>, "id"> }
| { type: "ADD_TEST_CASE"; testCase: TestCase };
| { type: "ADD_TEST_CASE"; testCase: TestCase }
| { type: "REMOVE_TEST_CASE"; testCaseId: string };

export function setTestCaseAssertions(nodeId: string, updater: (prev: WithUuid<Assertion>[]) => WithUuid<Assertion>[]): ThunkAction {
return (dispatch, getState) => {
Expand Down Expand Up @@ -101,3 +108,18 @@ export function addTestCase(testCase: TestCase): ThunkAction {
dispatch(changeActiveTestCase(testCase.id));
};
}

export function removeTestCase(testCaseId: string): ThunkAction {
return (dispatch, getState) => {
const testCases = getTestCases(getState());
const deletedIndex = testCases.findIndex((tc) => tc.id === testCaseId);
const remaining = testCases.filter((tc) => tc.id !== testCaseId);
const nextActive = remaining[deletedIndex] ?? remaining[deletedIndex - 1];

dispatch({ type: "REMOVE_TEST_CASE", testCaseId });

if (nextActive) {
dispatch(changeActiveTestCase(nextActive.id));
}
};
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EditOutlined } from "@mui/icons-material";
import { Box, FormHelperText, InputBase, styled, Typography } from "@mui/material";
import { CheckOutlined, CloseOutlined, DeleteOutlined, EditOutlined } from "@mui/icons-material";
import { Box, Divider, FormHelperText, InputBase, styled, Typography } from "@mui/material";
import React, { useCallback } from "react";
import { useTranslation } from "react-i18next";

Expand All @@ -13,6 +13,7 @@ import { WindowKind } from "../../../../../../windowManager/WindowKind";
import { StyledButton } from "../../../../styledButton";
import { InfoTooltip } from "../../../editors/InfoTooltip/InfoTooltip";
import { TypeSelect } from "../../../fragment-input-definition/TypeSelect";
import { useTestCaseDelete } from "./useTestCaseDelete";
import { useTestCaseNameEdit } from "./useTestCaseNameEdit";

export const TestCaseSelect = () => {
Expand All @@ -27,6 +28,15 @@ export const TestCaseSelect = () => {
activeTestCaseOption?.label,
);

const {
isConfirming,
isDisabled: isDeleteDisabled,
disabledTooltip,
startDeleting,
cancelDelete,
confirmDelete,
} = useTestCaseDelete(activeTestCaseOption?.value, testCaseOptions.length, isEditing);

const { open } = useWindows();
const onDisplayEnterpriseInfo = useCallback(() => {
open({ kind: WindowKind.enterpriseFeatureInfo, layoutData: { width: 500 } });
Expand Down Expand Up @@ -58,16 +68,45 @@ export const TestCaseSelect = () => {
/>
{loggedUser.isWriter() && (
<>
<InfoTooltip title={"Edit name"} variant={"hover"} enterDelay={500}>
<StyledButton
data-testid="edit-test-case-name"
onClick={startEditing}
disabled={isEditing}
sx={{ display: "flex", justifyContent: "center", alignItems: "center" }}
>
<EditOutlined fontSize="small" />
</StyledButton>
</InfoTooltip>
{isConfirming ? (
<>
<InfoTooltip title={t("testCaseDelete.confirm", "Confirm deletion")} variant={"hover"} enterDelay={500}>
<StyledButton data-testid="confirm-delete-test-case" onClick={confirmDelete}>
<CheckOutlined fontSize="small" />
</StyledButton>
</InfoTooltip>
<InfoTooltip title={t("testCaseDelete.cancel", "Cancel deletion")} variant={"hover"} enterDelay={500}>
<StyledButton data-testid="cancel-delete-test-case" onClick={cancelDelete}>
<CloseOutlined fontSize="small" />
</StyledButton>
</InfoTooltip>
</>
) : (
<>
<InfoTooltip title={"Edit name"} variant={"hover"} enterDelay={500}>
<StyledButton
data-testid="edit-test-case-name"
onClick={startEditing}
disabled={isEditing}
sx={{ display: "flex", justifyContent: "center", alignItems: "center" }}
>
<EditOutlined fontSize="small" />
</StyledButton>
</InfoTooltip>
<InfoTooltip
title={disabledTooltip ?? t("testCaseDelete.delete", "Delete test case")}
variant={"hover"}
enterDelay={500}
>
<span>
<StyledButton data-testid="delete-test-case" onClick={startDeleting} disabled={isDeleteDisabled}>
<DeleteOutlined fontSize="small" />
</StyledButton>
</span>
</InfoTooltip>
</>
)}
<Divider orientation="vertical" flexItem sx={{ mx: 0.5 }} />
<InfoTooltip title={"Save as"} variant={"hover"} enterDelay={500}>
<StyledButton
data-testid="save-as-test-case"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";

import { removeTestCase } from "../../../../../../actions/nk/testCasesActions";
import { useAppDispatch } from "../../../../../../store/storeHelpers";

export const useTestCaseDelete = (activeTestCaseId: string | undefined, testCasesCount: number, isEditing: boolean) => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

const [isConfirming, setIsConfirming] = useState(false);

const isOnlyOne = testCasesCount <= 1;
const isDisabled = isOnlyOne || isEditing;

const disabledTooltip = isEditing
? t("testCaseDelete.disabledEditing", "Finish editing before deleting")
: isOnlyOne
? t("testCaseDelete.disabledOnlyOne", "Cannot delete the only test case")
: undefined;

const startDeleting = useCallback(() => setIsConfirming(true), []);

const cancelDelete = useCallback(() => setIsConfirming(false), []);

const confirmDelete = useCallback(() => {
if (!activeTestCaseId) return;
dispatch(removeTestCase(activeTestCaseId));
setIsConfirming(false);
}, [dispatch, activeTestCaseId]);

return { isConfirming, isDisabled, disabledTooltip, startDeleting, cancelDelete, confirmDelete };
};
3 changes: 3 additions & 0 deletions designer/client/src/components/graph/styledButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export const StyledButton = styled(Button)(({ theme }) =>
height: 35,
fontWeight: "bold",
fontSize: 20,
display: "flex",
justifyContent: "center",
alignItems: "center",
},
]),
);
5 changes: 5 additions & 0 deletions designer/client/src/reducers/graph/testCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ export const testCaseReducer: Reducer<ScenarioGraph["testCases"]> = produce((dra
break;
}

case "REMOVE_TEST_CASE": {
draft.list = draft.list.filter((tc) => tc.id !== action.testCaseId);
break;
}

case "DELETE_NODES":
draft.list = cleanTestCaseState(draft, action.ids);
break;
Expand Down
Loading