feat(tests, components): enhance Cypress commands and UI elements for improved testing and accessibility

- Added new Cypress commands for mocking admin-related API interactions, including list, create, update, delete, and change status functionalities.
- Introduced data-cy attributes across various components (e.g., Breadcrumbs, Forms, Tables) to improve testability and accessibility.
- Updated existing components to support new data-cy attributes for better integration with Cypress tests.
This commit is contained in:
AmirReza Jamali
2026-04-25 13:25:23 +03:30
parent 2a4f3e7e4b
commit eab516c7f3
24 changed files with 814 additions and 23 deletions
+4
View File
@@ -25,6 +25,7 @@ type PropsType<T extends FieldValues> = {
clearable?: boolean;
onClear?: () => void;
value?: string;
dataCy?: string;
} & (
| { placeholder?: string; defaultValue?: string }
| { placeholder: string; defaultValue?: string }
@@ -48,6 +49,7 @@ export function Select<T extends FieldValues>({
clearable = false,
onClear,
value: controlledValue,
dataCy,
...props
}: PropsType<T>) {
const id = useId();
@@ -107,6 +109,7 @@ export function Select<T extends FieldValues>({
onChange?.(e);
}}
onBlur={onBlur}
data-cy={dataCy}
className={cn(
"w-full appearance-none rounded-xl border border-stroke/70 bg-white/90 px-5.5 py-3 shadow-[0_1px_2px_rgba(16,24,40,0.04),0_8px_20px_rgba(16,24,40,0.04)] outline-none backdrop-blur-[1px] transition-all duration-200 focus:border-primary/70 focus:bg-white focus:shadow-[0_0_0_2px_rgba(59,130,246,0.14),0_10px_24px_rgba(59,130,246,0.08)] active:border-primary/70 dark:border-dark-3/80 dark:bg-dark-2/85 dark:focus:border-primary/80 dark:focus:shadow-[0_0_0_2px_rgba(59,130,246,0.2),0_10px_24px_rgba(15,23,42,0.45)] [&>option]:text-dark-5 dark:[&>option]:text-dark-6",
isOptionSelected && "text-dark dark:text-white",
@@ -133,6 +136,7 @@ export function Select<T extends FieldValues>({
<button
type="button"
onClick={handleClear}
data-cy={dataCy ? `${dataCy}-clear` : undefined}
className="absolute right-10 top-1/2 -translate-y-1/2 text-dark-5 transition hover:scale-110 hover:text-dark dark:text-dark-6 dark:hover:text-white"
>
<svg