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:
Vendored
+29
@@ -2,8 +2,37 @@
|
||||
|
||||
declare global {
|
||||
namespace Cypress {
|
||||
interface AdminListMockOptions {
|
||||
users?: Record<string, any>[];
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
total?: number;
|
||||
statusCode?: number;
|
||||
delay?: number;
|
||||
alias?: string;
|
||||
query?: Record<string, string | number>;
|
||||
}
|
||||
|
||||
interface MutationMockOptions {
|
||||
statusCode?: number;
|
||||
delay?: number;
|
||||
alias?: string;
|
||||
message?: string;
|
||||
body?: Record<string, any>;
|
||||
}
|
||||
|
||||
interface Chainable {
|
||||
loginAsAdmin(): Chainable<void>;
|
||||
getByCy(value: string): Chainable<JQuery<HTMLElement>>;
|
||||
setAuthCookies(userOverrides?: Partial<Record<string, any>>): Chainable<void>;
|
||||
mockAdminsList(options?: AdminListMockOptions): Chainable<void>;
|
||||
mockCreateAdmin(options?: MutationMockOptions): Chainable<void>;
|
||||
mockUpdateAdmin(id: string, options?: MutationMockOptions): Chainable<void>;
|
||||
mockDeleteAdmin(id: string, options?: MutationMockOptions): Chainable<void>;
|
||||
mockChangeAdminStatus(
|
||||
id: string,
|
||||
options?: MutationMockOptions,
|
||||
): Chainable<void>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user