From 11529ba4473bcd7a8dd88ac0dacdf936a976ef00 Mon Sep 17 00:00:00 2001 From: Craig Atkinson Date: Sat, 23 Mar 2024 08:42:42 -0500 Subject: [PATCH] Adding file name to failed test case list (#1208) --- .../__tests__/RepositoryCoveragePage.spec.tsx | 5 ++- ui/src/TestCase/TestCaseFailurePanel.tsx | 12 +++++++ .../__tests__/TestCaseFailurePanel.spec.tsx | 33 +++++++++++++++++++ ui/src/model/TestRunModel.ts | 1 + 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/ui/src/Repository/Coverage/__tests__/RepositoryCoveragePage.spec.tsx b/ui/src/Repository/Coverage/__tests__/RepositoryCoveragePage.spec.tsx index c9a1c924b..d6b841d0e 100644 --- a/ui/src/Repository/Coverage/__tests__/RepositoryCoveragePage.spec.tsx +++ b/ui/src/Repository/Coverage/__tests__/RepositoryCoveragePage.spec.tsx @@ -81,7 +81,10 @@ describe("RepositoryCoveragePage", () => { const { findByTestId } = render( - + , ); diff --git a/ui/src/TestCase/TestCaseFailurePanel.tsx b/ui/src/TestCase/TestCaseFailurePanel.tsx index 46479f725..fc78e83be 100644 --- a/ui/src/TestCase/TestCaseFailurePanel.tsx +++ b/ui/src/TestCase/TestCaseFailurePanel.tsx @@ -30,6 +30,10 @@ const useStyles = makeStyles(() => ({ userSelect: "text", "-webkit-user-select": "text", }, + testCaseFileName: { + display: "block", + paddingTop: "10px", + }, })); interface TestCaseFailurePanelProps { @@ -103,6 +107,14 @@ const TestCaseFailurePanel = ({ {testCase.packageName || testCase.testSuiteName || ""}. {testCase.className} {testCase.name} + {testCase.fileName && ( + + {testCase.fileName} + + )} diff --git a/ui/src/TestCase/__tests__/TestCaseFailurePanel.spec.tsx b/ui/src/TestCase/__tests__/TestCaseFailurePanel.spec.tsx index 2c5756225..66dd017ff 100644 --- a/ui/src/TestCase/__tests__/TestCaseFailurePanel.spec.tsx +++ b/ui/src/TestCase/__tests__/TestCaseFailurePanel.spec.tsx @@ -423,6 +423,39 @@ describe("TestCaseFailurePanel", () => { ); }); + it("should show file name when it is present", () => { + const testCase: TestCase = { + idx: 1, + testSuiteIdx: 2, + publicId: "12345", + name: "Test Case", + testSuiteName: "My Test Suite", + packageName: "The Tests", + className: "", + fullName: "Test Case", + fileName: "failing-spec.ts", + duration: 1.2, + passed: false, + skipped: false, + hasSystemOut: true, + hasSystemErr: true, + hasSystemOutTestCase: false, + hasSystemErrTestCase: false, + hasSystemOutTestSuite: true, + hasSystemErrTestSuite: true, + failure: null, + createdTimestamp: moment("2020-04-25").toDate(), + }; + + const { queryByTestId } = render( + , + ); + + expect(queryByTestId("test-case-file-name-2-1")).toHaveTextContent( + "failing-spec.ts", + ); + }); + function createTestCaseWithFailure(failure: TestFailure): TestCase { return { idx: 1, diff --git a/ui/src/model/TestRunModel.ts b/ui/src/model/TestRunModel.ts index 6bfb4b183..602a728d9 100644 --- a/ui/src/model/TestRunModel.ts +++ b/ui/src/model/TestRunModel.ts @@ -86,6 +86,7 @@ interface TestCase { publicId: string; name: string; testSuiteName: string; + fileName?: string; packageName: string; className: string; fullName: string;