Skip to content

Commit

Permalink
Adding file name to failed test case list (#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigatk committed Mar 23, 2024
1 parent cb5dedf commit 11529ba
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ describe("RepositoryCoveragePage", () => {
const { findByTestId } = render(
<LocationProvider history={createHistory(createMemorySource("/ui"))}>
<QueryParamProvider reachHistory={globalHistory}>
<RepositoryCoveragePage orgPart="my-org" repoPart="my-no-coverage-repo" />
<RepositoryCoveragePage
orgPart="my-org"
repoPart="my-no-coverage-repo"
/>
</QueryParamProvider>
</LocationProvider>,
);
Expand Down
12 changes: 12 additions & 0 deletions ui/src/TestCase/TestCaseFailurePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const useStyles = makeStyles(() => ({
userSelect: "text",
"-webkit-user-select": "text",
},
testCaseFileName: {
display: "block",
paddingTop: "10px",
},
}));

interface TestCaseFailurePanelProps {
Expand Down Expand Up @@ -103,6 +107,14 @@ const TestCaseFailurePanel = ({
{testCase.packageName || testCase.testSuiteName || ""}.
{testCase.className} {testCase.name}
</span>
{testCase.fileName && (
<span
className={classes.testCaseFileName}
data-testid={`test-case-file-name-${testCaseIdentifier}`}
>
{testCase.fileName}
</span>
)}
</Typography>
</AccordionSummary>
<AccordionDetails className={classes.failureMessage}>
Expand Down
33 changes: 33 additions & 0 deletions ui/src/TestCase/__tests__/TestCaseFailurePanel.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<TestCaseFailurePanel testCase={testCase} publicId="12345" />,
);

expect(queryByTestId("test-case-file-name-2-1")).toHaveTextContent(
"failing-spec.ts",
);
});

function createTestCaseWithFailure(failure: TestFailure): TestCase {
return {
idx: 1,
Expand Down
1 change: 1 addition & 0 deletions ui/src/model/TestRunModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ interface TestCase {
publicId: string;
name: string;
testSuiteName: string;
fileName?: string;
packageName: string;
className: string;
fullName: string;
Expand Down

0 comments on commit 11529ba

Please sign in to comment.