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 registry testid #2022

Merged
merged 2 commits into from
Mar 18, 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 @@ -71,7 +71,12 @@ const CardHeader = ({ registry }: { registry: RegistryResponseType }) => {

const Registry = ({ registry }: { registry: RegistryResponseType }) => {
return (
<DFLink className="flex flex-col" to={`/registries/${registry.type}`} unstyled>
<DFLink
className="flex flex-col"
to={`/registries/${registry.type}`}
unstyled
data-testid={registry?.type + 'Id'}
>
<Card
className={cn(
'relative group p-2 pb-3 flex flex-col',
Expand All @@ -85,19 +90,28 @@ const Registry = ({ registry }: { registry: RegistryResponseType }) => {
<CardHeader registry={registry} />
<div className="flex mt-6 gap-x-[48px] justify-center items-center w-[322px]">
<div className="flex flex-col justify-center text-p4 text-gray-900 dark:text-text-text-and-icon">
<span className="text-h1 text-gray-900 dark:text-text-input-value">
<span
className="text-h1 text-gray-900 dark:text-text-input-value"
data-testid="totalRegistriesId"
>
{abbreviateNumber(registry.registries ?? 0)}
</span>
Registries
</div>
<div className="flex flex-col justify-center text-p4 text-gray-900 dark:text-text-text-and-icon">
<span className="text-h1 text-gray-900 dark:text-text-input-value">
<span
className="text-h1 text-gray-900 dark:text-text-input-value"
data-testid="totalRepositoriesId"
>
{abbreviateNumber(registry.repositories ?? 0)}
</span>
Repositories
</div>
<div className="flex flex-col justify-center text-p4 text-gray-900 dark:text-text-text-and-icon">
<span className="text-h1 text-gray-900 dark:text-text-input-value">
<span
className="text-h1 text-gray-900 dark:text-text-input-value"
data-testid="totalImagesId"
>
{abbreviateNumber(registry.images ?? 0)}
</span>
Images
Expand Down Expand Up @@ -133,7 +147,10 @@ const Registries = () => {
</div>
<Suspense
fallback={
<div className="mx-4 my-10 flex gap-x-4 gap-y-10 flex-wrap">
<div
className="mx-4 my-10 flex gap-x-4 gap-y-10 flex-wrap"
data-testid="registriesCardSkeletonId"
>
<RegistrySkeleton />
</div>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,10 @@ const CountWidget = () => {
</div>

<div className="flex flex-col items-start">
<span className="text-h1 dark:text-text-input-value">
<span
className="text-h1 dark:text-text-input-value"
data-testid="totalRegistriesId"
>
{abbreviateNumber(registries)}
</span>
<span className="text-p1">Total registries</span>
Expand All @@ -352,7 +355,10 @@ const CountWidget = () => {
</div>

<div className="flex flex-col items-start">
<span className="text-h1 dark:text-text-input-value">
<span
className="text-h1 dark:text-text-input-value"
data-testid="totalRepositoriesId"
>
{abbreviateNumber(repositories)}
</span>
<span className="text-p1">Total repositories</span>
Expand All @@ -364,7 +370,10 @@ const CountWidget = () => {
</div>

<div className="flex flex-col items-start">
<span className="text-h1 dark:text-text-input-value">
<span
className="text-h1 dark:text-text-input-value"
data-testid="totalImagesId"
>
{abbreviateNumber(images)}
</span>
<span className="text-p1">Total images</span>
Expand Down Expand Up @@ -540,7 +549,15 @@ const RegistryAccountsResults = () => {
}
/>
</div>
<Suspense fallback={<TableSkeleton columns={7} rows={DEFAULT_PAGE_SIZE} />}>
<Suspense
fallback={
<TableSkeleton
columns={7}
rows={DEFAULT_PAGE_SIZE}
data-testid="registryAccountSkeletonId"
/>
}
>
<RegistryAccountsTable
onTableAction={onTableAction}
setShowDeleteDialog={setShowDeleteDialog}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,23 @@ export const Pagination = ({
<div className="flex justify-end items-center gap-4">
<div className={`text-gray-500 dark:text-text-text-and-icon text-p4`}>
Showing{' '}
<span className="text-black dark:text-text-input-value">
<span className="text-black dark:text-text-input-value" data-testid="showingId">
{currentShowing[0]}-{currentShowing[1]}
</span>
{!approximatePagination ? (
<>
<span> of</span>
<span className="text-black dark:text-text-input-value"> {totalRows}</span>
<span
className="text-black dark:text-text-input-value"
data-testid="ofTotalRowsId"
>
{' '}
{totalRows}
</span>
</>
) : null}
</div>
<div className={cn(`flex flex-row flex-nowrap`)}>
<div className={cn(`flex flex-row flex-nowrap`)} data-testid="pageButtonId">
<PageButton
data-testid="pagination-prev"
label={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ const CustomTable = <TData extends RowData>(
);
})}
>
<button className="dark:text-text-input-value flex items-center gap-1">
<button
className="dark:text-text-input-value flex items-center gap-1"
data-testid="showRowId"
>
{table.getState().pagination.pageSize}{' '}
<div className="h-3 w-3">
<TableChevronDown />
Expand Down
Loading