Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI add data test id #2268

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,7 @@ const ScanResults = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,7 @@ const MalwareScans = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ const MostExploitableMalwares = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ const UniqueMalwares = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const GroupedResultsBenchmarkSkeleton = () => {

export const GroupedResultsSkeleton = () => {
return (
<div className="-mt-4">
<div className="-mt-4" data-testid="tableSkeletonWrapperId">
<RectSkeleton height="h-10" width="w-80" padding="p-2" />
<GroupedResultsBenchmarkSkeleton />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const CloudPostureResults = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { ModelCloudCompliance } from '@/api/generated';
import { DFLink } from '@/components/DFLink';
import { EllipsisIcon } from '@/components/icons/common/Ellipsis';
import { ErrorStandardLineIcon } from '@/components/icons/common/ErrorStandardLine';
import { FilterIcon } from '@/components/icons/common/Filter';
import { PostureStatusBadgeIcon } from '@/components/SeverityBadge';
import { PostureIcon } from '@/components/sideNavigation/icons/Posture';
Expand All @@ -35,7 +36,6 @@ import {
import {
DEFAULT_PAGE_SIZE,
useGetControls,
usePageParams,
useScanResultsByControl,
useScanStatus,
} from '@/features/postures/components/scan-result/cloud/hooks';
Expand Down Expand Up @@ -76,6 +76,7 @@ export const CloudPostureResultsGrouped = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down Expand Up @@ -128,8 +129,23 @@ const CloudPostureResultsGroupedCheckType = () => {
const controls = useGetControls();
const { mode } = useTheme();

if (!controls || controls.length === 0) {
return (
<div className="flex items-center justify-center gap-x-2 text-text-text-and-icon min-h-[384px]">
<div className="h-6 w-6 shrink-0">
<ErrorStandardLineIcon />
</div>
<div className="text-h3">No data available</div>
</div>
);
}

return (
<Accordion type="single" collapsible>
<Accordion
type="single"
collapsible
data-testid="cloudPostureResultsGroupedCheckTypeId"
>
{controls.map((control) => {
return (
<AccordionItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,7 @@ const Accounts = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,7 @@ const PostureResults = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ const RegistryImagesTagsResults = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ const MostExploitableSecrets = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1737,6 +1737,7 @@ const ScanResults = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,7 @@ const SecretScans = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ const UniqueSecrets = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export const CloudResourcesTable = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const ContainersTable = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const HostsTable = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export const KubernetesTable = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const PodsTable = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ const MostExploitableVulnerabilities = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const RuntimeBom = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ const UniqueVulnerabilities = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,7 @@ const CVEResults = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,7 @@ const VulnerabilityScans = () => {
onClick={() => {
setFiltersExpanded((prev) => !prev);
}}
data-testid="filterButtonIdForTable"
>
Filter
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe(`Component Button`, () => {
const { getByTestId } = renderUI(
<Button
id="id"
data-testid="button-id"
color="default"
startIcon={<Plus />}
endIcon={<Plus />}
Expand All @@ -39,6 +40,7 @@ describe(`Component Button`, () => {
const { getByTestId, getByText } = renderUI(
<Button
id="id"
data-testid="button-id"
color="default"
startIcon={<Plus />}
endIcon={<Plus />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
<button
ref={ref}
id={_id}
data-testid={`button-${_id}`}
disabled={disabled}
className={cn(
buttonCva({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ describe(`Component Modal`, () => {

return (
<>
<Button onClick={() => setOpen(true)} id="trigger-id" ref={ref}>
<Button
onClick={() => setOpen(true)}
id="trigger-id"
data-testid="button-trigger-id"
ref={ref}
>
Click to open
</Button>
<Modal
Expand Down Expand Up @@ -79,7 +84,12 @@ describe(`Component Modal`, () => {

return (
<>
<Button onClick={() => setOpen(true)} id="trigger-id" ref={ref}>
<Button
onClick={() => setOpen(true)}
id="trigger-id"
data-testid="button-trigger-id"
ref={ref}
>
Click to open
</Button>
<Modal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ describe(`Component SlidingModal`, () => {
return (
<>
<div className="some-test">
<Button onClick={() => setOpen(true)} id="trigger-id" ref={ref}>
<Button
onClick={() => setOpen(true)}
id="trigger-id"
data-testid="button-trigger-id"
ref={ref}
>
Click to open
</Button>
</div>
Expand Down Expand Up @@ -81,7 +86,12 @@ describe(`Component SlidingModal`, () => {

return (
<>
<Button onClick={() => setOpen(true)} id="trigger-id" ref={ref}>
<Button
onClick={() => setOpen(true)}
id="trigger-id"
data-testid="button-trigger-id"
ref={ref}
>
Click to open
</Button>
<SlidingModal
Expand Down
Loading