This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEVPROD-1135 Add timeout test status (#2272)
- Loading branch information
Showing
7 changed files
with
92 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/pages/task/taskTabs/testsTable/TestStatusBadge/TestStatusBadge.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Styled from "@emotion/styled"; | ||
import { size } from "constants/tokens"; | ||
import { CustomMeta, CustomStoryObj } from "test_utils/types"; | ||
import { TestStatus } from "types/test"; | ||
import TestStatusBadge from "."; | ||
|
||
export default { | ||
component: TestStatusBadge, | ||
} satisfies CustomMeta<typeof TestStatusBadge>; | ||
|
||
export const Default: CustomStoryObj<typeof TestStatusBadge> = { | ||
render: (args) => ( | ||
<Container> | ||
{Object.values(TestStatus).map((status) => ( | ||
<TestStatusBadge {...args} status={status} key={status} /> | ||
))} | ||
</Container> | ||
), | ||
argTypes: {}, | ||
args: {}, | ||
}; | ||
|
||
const Container = Styled.div` | ||
display: flex; | ||
gap: ${size.s}; | ||
`; |
40 changes: 40 additions & 0 deletions
40
.../task/taskTabs/testsTable/TestStatusBadge/__snapshots__/TestStatusBadge.stories.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Snapshot Tests TestStatusBadge.stories Default 1`] = ` | ||
<div> | ||
<div | ||
class="css-8cvf0s-Container et5ujl80" | ||
> | ||
<div | ||
class="leafygreen-ui-ud6teo" | ||
> | ||
Fail | ||
</div> | ||
<div | ||
class="leafygreen-ui-ixbeze" | ||
> | ||
Skip | ||
</div> | ||
<div | ||
class="leafygreen-ui-1qtf7xy" | ||
> | ||
Silent Fail | ||
</div> | ||
<div | ||
class="leafygreen-ui-n4itms" | ||
> | ||
Pass | ||
</div> | ||
<div | ||
class="leafygreen-ui-ohl2hc" | ||
> | ||
all | ||
</div> | ||
<div | ||
class="leafygreen-ui-ud6teo" | ||
> | ||
Timeout | ||
</div> | ||
</div> | ||
</div> | ||
`; |
18 changes: 18 additions & 0 deletions
18
src/pages/task/taskTabs/testsTable/TestStatusBadge/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Variant } from "@leafygreen-ui/badge"; | ||
import { TestStatus } from "types/test"; | ||
|
||
export const statusToBadgeColor = { | ||
[TestStatus.Pass]: Variant.Green, | ||
[TestStatus.Fail]: Variant.Red, | ||
[TestStatus.SilentFail]: Variant.Blue, | ||
[TestStatus.Skip]: Variant.Yellow, | ||
[TestStatus.Timeout]: Variant.Red, | ||
}; | ||
|
||
export const statusCopy = { | ||
[TestStatus.Pass]: "Pass", | ||
[TestStatus.Fail]: "Fail", | ||
[TestStatus.Skip]: "Skip", | ||
[TestStatus.SilentFail]: "Silent Fail", | ||
[TestStatus.Timeout]: "Timeout", | ||
}; |
9 changes: 6 additions & 3 deletions
9
...k/taskTabs/testsTable/TestStatusBadge.tsx → ...Tabs/testsTable/TestStatusBadge/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import Badge, { Variant } from "@leafygreen-ui/badge"; | ||
import { statusToBadgeColor, statusCopy } from "constants/test"; | ||
import { TestStatus } from "types/test"; | ||
import { statusToBadgeColor, statusCopy } from "./constants"; | ||
|
||
interface TestStatusBadgeProps { | ||
status: string; | ||
status: TestStatus; | ||
} | ||
|
||
export const TestStatusBadge: React.FC<TestStatusBadgeProps> = ({ status }) => ( | ||
const TestStatusBadge: React.FC<TestStatusBadgeProps> = ({ status }) => ( | ||
<Badge | ||
variant={statusToBadgeColor[status?.toLowerCase()] || Variant.LightGray} | ||
key={status} | ||
> | ||
{statusCopy[status?.toLowerCase()] || status} | ||
</Badge> | ||
); | ||
|
||
export default TestStatusBadge; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ export enum TestStatus { | |
SilentFail = "silentfail", | ||
Pass = "pass", | ||
All = "all", | ||
Timeout = "timeout", | ||
} |