index.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /// <reference types="cypress" />
  2. /// <reference types="../../index.d.ts" />
  3. export const getMaterialUINotifications = () => {
  4. return cy.get("#notistack-snackbar .MuiBox-root > h6");
  5. };
  6. export const getMaterialUIDeletePopoverButton = () => {
  7. return cy.get(".MuiDialogActions-root > button").contains(/delete/i);
  8. };
  9. export const getMaterialUIFormItemError = ({
  10. id,
  11. }: IGetMaterialUIFormItemErrorParams) => {
  12. return cy.get(`#${id}-helper-text`);
  13. };
  14. export const getMaterialUILoadingCircular = () => {
  15. return cy.get(".MuiCircularProgress-root");
  16. };
  17. export const getMaterialUIColumnHeader = (index: number) => {
  18. return cy.get(`.MuiDataGrid-columnHeader[aria-colindex="${index}"]`);
  19. };
  20. export const fillMaterialUIForm = () => {
  21. cy.fixture("mock-post").then((mockPost) => {
  22. cy.get("#title").clear();
  23. cy.get("#title").type(mockPost.title);
  24. cy.get("#content").clear();
  25. cy.get("#content").type(mockPost.content);
  26. cy.get("#status").click();
  27. cy.get("#status-option-0").click();
  28. cy.get("#category").click();
  29. cy.get("#category-option-0").click();
  30. });
  31. };