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:
@@ -0,0 +1,30 @@
|
||||
export type AdminRecord = {
|
||||
id: string;
|
||||
full_name: string;
|
||||
email: string;
|
||||
username: string;
|
||||
status: "active" | "inactive";
|
||||
role?: string;
|
||||
};
|
||||
|
||||
export const ADMIN_COLUMNS = [
|
||||
"row",
|
||||
"full name",
|
||||
"email",
|
||||
"username",
|
||||
"status",
|
||||
"actions",
|
||||
];
|
||||
|
||||
export const makeAdmin = (
|
||||
overrides: Partial<AdminRecord> = {},
|
||||
index = 1,
|
||||
): AdminRecord => ({
|
||||
id: `507f1f77bcf86cd7994390${(10 + index).toString().padStart(2, "0")}`,
|
||||
full_name: `E2E Admin ${index}`,
|
||||
email: `e2e-admin-${index}@example.com`,
|
||||
username: `e2e-admin-${index}`,
|
||||
status: "active",
|
||||
role: "admin",
|
||||
...overrides,
|
||||
});
|
||||
Reference in New Issue
Block a user