@m4l/testing 0.0.22 → 0.0.23-AQ200320226-1.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/e2e/commands/components/Accordions/commands.d.ts +4 -0
  2. package/e2e/commands/components/Accordions/commands.js +19 -0
  3. package/e2e/commands/components/Accordions/types.d.ts +63 -0
  4. package/e2e/commands/components/CommonActions/commands.d.ts +4 -0
  5. package/e2e/commands/components/CommonActions/commands.js +11 -0
  6. package/e2e/commands/components/CommonActions/types.d.ts +20 -0
  7. package/e2e/commands/components/DataGrid/commands.d.ts +1 -1
  8. package/e2e/commands/components/DataGrid/commands.js +29 -29
  9. package/e2e/commands/components/DataGrid/types.d.ts +109 -24
  10. package/e2e/commands/components/DynamicFilter/commands.d.ts +1 -1
  11. package/e2e/commands/components/DynamicFilter/types.d.ts +10 -3
  12. package/e2e/commands/components/DynamicSort/commands.d.ts +1 -1
  13. package/e2e/commands/components/DynamicSort/types.d.ts +17 -1
  14. package/e2e/commands/components/Filters/commands.d.ts +4 -0
  15. package/e2e/commands/components/Filters/commands.js +24 -0
  16. package/e2e/commands/components/Filters/types.d.ts +91 -0
  17. package/e2e/commands/components/Form/commands.d.ts +4 -0
  18. package/e2e/commands/components/Form/commands.js +11 -0
  19. package/e2e/commands/components/Form/cypress/assertInitialFormState/assertInitialFormState.d.ts +5 -0
  20. package/e2e/commands/components/Form/cypress/assertInitialFormState/assertInitialFormState.js +20 -0
  21. package/e2e/commands/components/Form/cypress/assertInitialFormState/type.d.ts +103 -0
  22. package/e2e/commands/components/Form/cypress/assertInitialFormState/type.js +1 -0
  23. package/e2e/commands/components/Form/cypress/assertMandatoryFields/assertMandatoryFields.d.ts +17 -0
  24. package/e2e/commands/components/Form/cypress/assertMandatoryFields/assertMandatoryFields.js +14 -0
  25. package/e2e/commands/components/Form/cypress/assertMandatoryFields/type.d.ts +28 -0
  26. package/e2e/commands/components/Form/cypress/assertMandatoryFields/type.js +1 -0
  27. package/e2e/commands/components/Form/cypress/constants.d.ts +3 -0
  28. package/e2e/commands/components/Form/cypress/constants.js +6 -0
  29. package/e2e/commands/components/Form/cypress/fillAndAssertFormFields/fillAndAssertFormFields.d.ts +8 -0
  30. package/e2e/commands/components/Form/cypress/fillAndAssertFormFields/fillAndAssertFormFields.js +29 -0
  31. package/e2e/commands/components/Form/cypress/fillAndAssertFormFields/type.d.ts +5 -0
  32. package/e2e/commands/components/Form/cypress/fillAndAssertFormFields/type.js +1 -0
  33. package/e2e/commands/components/Form/cypress/getFormScope/getFormScope.d.ts +20 -0
  34. package/e2e/commands/components/Form/cypress/getFormScope/getFormScope.js +8 -0
  35. package/e2e/commands/components/Form/cypress/proceedFormStep/proceedFormStep.d.ts +10 -0
  36. package/e2e/commands/components/Form/cypress/proceedFormStep/proceedFormStep.js +6 -0
  37. package/e2e/commands/components/Form/cypress/proceedFormStep/type.d.ts +13 -0
  38. package/e2e/commands/components/Form/helpers/getFieldNameDomElement.d.ts +7 -0
  39. package/e2e/commands/components/Form/helpers/getFieldNameDomElement.js +13 -0
  40. package/e2e/commands/components/Form/types.d.ts +87 -0
  41. package/e2e/commands/components/MenuActions/commands.d.ts +1 -1
  42. package/e2e/commands/components/MenuActions/commands.js +2 -2
  43. package/e2e/commands/components/MenuActions/types.d.ts +16 -1
  44. package/e2e/commands/components/Popover/commands.d.ts +1 -1
  45. package/e2e/commands/components/Popover/types.d.ts +6 -0
  46. package/e2e/commands/components/PropertyValue/commands.d.ts +1 -1
  47. package/e2e/commands/components/PropertyValue/types.d.ts +9 -4
  48. package/e2e/commands/components/Tab/commands.d.ts +1 -1
  49. package/e2e/commands/components/Tab/commands.js +3 -2
  50. package/e2e/commands/components/Tab/types.d.ts +19 -4
  51. package/e2e/commands/components/WindowBase/commands.d.ts +1 -1
  52. package/e2e/commands/components/WindowBase/commands.js +18 -10
  53. package/e2e/commands/components/WindowBase/types.d.ts +89 -7
  54. package/e2e/commands/components/index.d.ts +4 -0
  55. package/e2e/commands/index.d.ts +6 -0
  56. package/e2e/commands/register.d.ts +1 -2
  57. package/e2e/commands/register.js +11 -7
  58. package/e2e/cypress.d.js +1 -0
  59. package/e2e/cypress.d.ts +5 -1
  60. package/index.d.ts +1 -0
  61. package/index.js +23 -23
  62. package/package.json +33 -76
  63. package/testComponents/DataGrid/helpers.js +52 -30
  64. package/testComponents/DataGrid/types.d.ts +15 -3
  65. package/e2e/commands/components/DataGrid/export.d.ts +0 -7
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registers Accordions commands
3
+ */
4
+ export declare const registerDynamicAccordionsCommands: () => void;
@@ -0,0 +1,19 @@
1
+ const t = () => {
2
+ Cypress.Commands.add(
3
+ "m4lDynamicAccordionsValidate",
4
+ (e, o, r, a) => {
5
+ cy.get('[class*="M4LAccordion-accordionRoot"]').eq(r).as("currentAccordion"), cy.get("@currentAccordion").find('[class*="M4LAccordion-accordionSummary"]').should("have.text", a).click(), cy.get("@currentAccordion").within(() => {
6
+ cy.get('[class*="MuiCollapse-hidden"]').should("exist");
7
+ }), cy.get("@currentAccordion").find('[class*="M4LAccordion-accordionSummary"]').click(), cy.get("@currentAccordion").within(() => {
8
+ cy.get('[class*="MuiCollapse-entered"]').should("exist");
9
+ }), e(o).forEach((c) => {
10
+ cy.get("@currentAccordion").find('[class*="M4LAccordion-accordionDetails"]').find('[role="property-value-form-role"]').eq(c.index).within(() => {
11
+ cy.log(`Validating name ${c.key}`), cy.get('[class*="M4LPropertyValue-name"]').should("have.text", c.key), cy.log(`Validating value ${c.value}`), cy.get('[role="property-value-value-role"][class*="M4LPropertyValue-value"]').should("contain.text", c.value);
12
+ });
13
+ });
14
+ }
15
+ );
16
+ };
17
+ export {
18
+ t as r
19
+ };
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Property values accordion configuration
3
+ */
4
+ export type M4lPropertyValuesAccordionsConfig = {
5
+ /**
6
+ * @param title - The accordion title
7
+ */
8
+ title: string;
9
+ /**
10
+ * @param key - The property key
11
+ */
12
+ key: string;
13
+ /**
14
+ * @param value - The property value
15
+ */
16
+ value: any;
17
+ /**
18
+ * @param index - The property index
19
+ */
20
+ index: number;
21
+ };
22
+
23
+ declare global {
24
+ namespace Cypress {
25
+ interface Chainable {
26
+ /**
27
+ * Validates the accordions using the dynamic accordions hook.
28
+ * Collapses/expands by title and checks each property key-value.
29
+ * @example
30
+ * const mockAccordions: M4lPropertyValuesAccordionsConfig[] = [
31
+ * { title: 'Details', key: 'Name', value: 'Item 1', index: 0 },
32
+ * { title: 'Details', key: 'Status', value: 'Active', index: 1 },
33
+ * ];
34
+ * cy.m4lDynamicAccordionsValidate(
35
+ * (acc) => acc,
36
+ * mockAccordions,
37
+ * 0,
38
+ * 'Details'
39
+ * );
40
+ */
41
+ m4lDynamicAccordionsValidate(
42
+ /**
43
+ * @param accordions - Function that returns the accordion configurations
44
+ */
45
+ accordions: (mockAccordions: M4lPropertyValuesAccordionsConfig[]) => M4lPropertyValuesAccordionsConfig[],
46
+ /**
47
+ * @param mockAccordions - The accordion configurations
48
+ */
49
+ mockAccordions: M4lPropertyValuesAccordionsConfig[],
50
+ /**
51
+ * @param index - The accordion index
52
+ */
53
+ index: number,
54
+ /**
55
+ * @param title - The accordion title
56
+ */
57
+ title: string,
58
+ ): Chainable<Element>;
59
+ }
60
+ }
61
+ }
62
+
63
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registers CommonActions commands
3
+ */
4
+ export declare const registerCommonActionsCommands: () => void;
@@ -0,0 +1,11 @@
1
+ const n = () => {
2
+ Cypress.Commands.add(
3
+ "m4lConfirmActionIntro",
4
+ (o) => {
5
+ cy.get('[class*="M4LActionsContainer"]').should("contain", o).click();
6
+ }
7
+ );
8
+ };
9
+ export {
10
+ n as r
11
+ };
@@ -0,0 +1,20 @@
1
+ declare global {
2
+ namespace Cypress {
3
+ interface Chainable {
4
+ /**
5
+ * Finds the dialog action container, asserts it contains the option text, and clicks it.
6
+ * @example
7
+ * cy.m4lActionIntro('Accept');
8
+ * cy.m4lActionIntro('Cancel');
9
+ */
10
+ m4lConfirmActionIntro(
11
+ /**
12
+ * Button option
13
+ */
14
+ option: string,
15
+ ): Chainable<Element>;
16
+ }
17
+ }
18
+ }
19
+
20
+ export {};
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Registra los comandos de DataGrid
2
+ * Registers DataGrid commands
3
3
  */
4
4
  export declare const registerDataGridCommands: () => void;
@@ -1,42 +1,42 @@
1
- const u = () => {
2
- Cypress.Commands.add("m4lDataGrid", (e) => {
3
- cy.get(e).find('[class^="M4LDataGrid-root"]');
4
- }), Cypress.Commands.add("m4lDataGridValidateVisibleColumns", (e, d, l, r = 1) => {
5
- let a = 0, i = r;
6
- d(l).forEach((n) => {
7
- n.visible && (cy.log(`Validando columna visible: ${n.headerText} , index: ${i}`), i++, cy.m4lDataGrid(e).find("[role=row]").find(`[role=columnheader][aria-colindex=${i}]`).should("have.text", n.headerText), cy.m4lDataGrid(e).find("[role=row]").find(`[role=gridcell][aria-colindex=${i}]`).should("contain", n.value), cy.m4lDataGrid(e).find("[role=row]").find(`[role=columnheader][aria-colindex=${i}]`).then((s) => {
8
- const o = s.width();
9
- o !== void 0 && (a += o), cy.m4lDataGrid(e).find("[role=grid]").scrollTo(a, 0, { duration: 100, ensureScrollable: !1 });
1
+ const f = () => {
2
+ Cypress.Commands.add("m4lDataGrid", (i) => cy.get(i).find('[class^="M4LDataGrid-root"]').filter(":visible").first()), Cypress.Commands.add("m4lDataGridValidateVisibleColumns", (i, n, a, o = 1) => {
3
+ let l = 0, t = o;
4
+ n(a).forEach((r) => {
5
+ r.visible && (cy.log(`Validating visible column: ${r.headerText} , index: ${t}`), t++, cy.m4lDataGrid(i).find("[role=row]").find(`[role=columnheader][aria-colindex=${t}]`).should("have.text", r.headerText), cy.m4lDataGrid(i).find("[role=row]").find(`[role=gridcell][aria-colindex=${t}]`).should("contain", r.value), cy.m4lDataGrid(i).find("[role=row]").find(`[role=columnheader][aria-colindex=${t}]`).then((s) => {
6
+ const d = s.width();
7
+ d !== void 0 && (l += d), cy.m4lDataGrid(i).find("[role=grid]").scrollTo(l, 0, { duration: 100, ensureScrollable: !1 });
10
8
  }));
11
9
  });
12
- }), Cypress.Commands.add("m4lDataGridRow", (e, d, l) => {
13
- let r = 0, a = 0;
14
- const i = 10, n = d + 1;
10
+ }), Cypress.Commands.add("m4lDataGridRow", (i, n, a) => {
11
+ let o = 0, l = 0;
12
+ const t = 10, r = n + 1;
15
13
  function s() {
16
- return cy.m4lDataGrid(e).find("[role=row]").not('[aria-rowindex="1"]').filter(`[aria-rowindex="${n}"]`).then((o) => {
17
- if (o.length > 0) {
18
- const t = o[0].getBoundingClientRect();
19
- if (t.top >= 0 && t.left >= 0 && t.bottom <= (window.innerHeight || document.documentElement.clientHeight) && t.right <= (window.innerWidth || document.documentElement.clientWidth))
20
- return cy.wrap(o);
14
+ return cy.m4lDataGrid(i).find("[role=row]").not('[aria-rowindex="1"]').filter(`[aria-rowindex="${r}"]`).then((d) => {
15
+ if (d.length > 0) {
16
+ const e = d[0].getBoundingClientRect();
17
+ if (e.top >= 0 && e.left >= 0 && e.bottom <= (window.innerHeight || document.documentElement.clientHeight) && e.right <= (window.innerWidth || document.documentElement.clientWidth))
18
+ return cy.wrap(d);
21
19
  }
22
- if (a >= i)
23
- throw new Error(`No se encontró la fila ${n} después de ${i} intentos`);
24
- return a++, cy.m4lDataGrid(e).find("[role=row]").not('[aria-rowindex="1"]').filter((m, t) => {
25
- const c = t.getBoundingClientRect();
20
+ if (l >= t)
21
+ throw new Error(`Row ${r} was not found after ${t} attempts`);
22
+ return l++, cy.m4lDataGrid(i).find("[role=row]").not('[aria-rowindex="1"]').filter((m, e) => {
23
+ const c = e.getBoundingClientRect();
26
24
  return c.top >= 0 && c.left >= 0 && c.bottom <= (window.innerHeight || document.documentElement.clientHeight) && c.right <= (window.innerWidth || document.documentElement.clientWidth);
27
25
  }).first().then((m) => {
28
- const t = m.height() || 0;
29
- return r += t, cy.m4lDataGrid(e).find("[role=grid]").scrollTo(0, r, { duration: 100, ensureScrollable: !1 }).then(() => s());
26
+ const e = m.height() || 0;
27
+ return o += e, cy.m4lDataGrid(i).find("[role=grid]").scrollTo(0, o, { duration: 100, ensureScrollable: !1 }).then(() => s());
30
28
  });
31
29
  });
32
30
  }
33
- return s().find(`[role=gridcell][aria-colindex="${l}"]`);
34
- }), Cypress.Commands.add("m4lDataGridRowAction", (e, d, l = 1, r = 1) => {
35
- cy.m4lDataGridRow(e, l, r).find("button").eq(0).should("be.visible", { timeout: 1e4 }).click(), cy.m4lMenuActionsItem(d);
36
- }), Cypress.Commands.add("m4lDataGridFindAllColumns", (e) => {
37
- cy.m4lDataGrid(e).find('[class^="M4LDataGrid-actionsConfigContainer"]').find("button").eq(2).click();
31
+ return s().find(`[role=gridcell][aria-colindex="${a}"]`);
32
+ }), Cypress.Commands.add("m4lDataGridRowAction", (i, n, a = 1, o = 1) => {
33
+ cy.m4lDataGridRow(i, a, o).find("button").eq(0).should("be.visible", { timeout: 1e4 }).click(), cy.m4lMenuActionsItem(n);
34
+ }), Cypress.Commands.add("m4lDataGridFindAllColumns", (i) => {
35
+ cy.m4lDataGrid(i).find('[class^="M4LDataGrid-actionsConfigContainer"]').find("button").eq(2).click();
36
+ }), Cypress.Commands.add("m4lDataGridOrCardViewMode", (i, n) => {
37
+ cy.m4lDataGrid(i).find('[class*="M4LDataGrid-actionsConfigContainer"]').find('[class*="M4LDataGrid-containerLeftActions"]').find('button[aria-label="view-mode"]').click(), cy.get("[role=presentation]").find('[class^="MuiPaper-root"]').find("[role=button]").eq(n).click();
38
38
  });
39
39
  };
40
40
  export {
41
- u as r
41
+ f as r
42
42
  };
@@ -1,53 +1,138 @@
1
- import { M4LGetCypressDataGridColumnsConfig } from './export';
1
+ /**
2
+ * Column configuration for DataGrid in Cypress
3
+ */
4
+ export type M4LDataGridCypressColumn = {
5
+ /**
6
+ * @param key - The column key
7
+ */
8
+ key: string;
9
+ /**
10
+ * @param value - The column value
11
+ */
12
+ value: any;
13
+ /**
14
+ * @param headerText - The column header text
15
+ */
16
+ headerText: string;
17
+ /**
18
+ * @param visible - Indicates whether the column is visible
19
+ */
20
+ visible: boolean;
21
+ };
22
+
23
+ /**
24
+ * Function that gets the DataGrid column configuration
25
+ */
26
+ export type M4LGetCypressDataGridColumnsConfig<T> = (data: T) => M4LDataGridCypressColumn[];
27
+
2
28
  declare global {
3
29
  namespace Cypress {
4
30
  interface Chainable {
5
31
  /**
6
- * Obtiene el grid
7
- * @param selector selector del grid
8
- * @returns el grid
32
+ * Gets the grid. Returns the first visible M4LDataGrid under the selector.
33
+ * @param selector grid selector
34
+ * @returns the grid
35
+ * @example
36
+ * cy.m4lDataGrid('[class*="M4LDataGrid-root"]').find('[role=row]').should('have.length.at.least', 1);
9
37
  */
10
- m4lDataGrid(selector: string): Chainable<Element>
38
+ m4lDataGrid(selector: string ): Chainable<JQuery<HTMLElement>>
11
39
  /**
12
- * Valida las columnas visibles del grid
13
- * @param selector selector del grid
14
- * @param getColumnsConfig función que obtiene las columnas visibles del grid
15
- * @param mockData datos del grid
16
- * @param baseColumnIndex índice de la columna a obtener
40
+ * Validates the visible columns of the grid. Scrolls horizontally as needed for each column.
41
+ * @example
42
+ * const getColumns = (data: MockItem) => [
43
+ * { key: 'name', headerText: 'Name', value: data.name, visible: true },
44
+ * { key: 'code', headerText: 'Code', value: data.code, visible: true },
45
+ * ];
46
+ * cy.m4lDataGridValidateVisibleColumns('[class*="M4LDataGrid-root"]', getColumns, mockItem, 1);
17
47
  */
18
48
  m4lDataGridValidateVisibleColumns<T>(
49
+ /**
50
+ * Grid selector
51
+ */
19
52
  selector: string,
53
+ /**
54
+ * Function that gets the visible columns of the grid
55
+ */
20
56
  getColumnsConfig: M4LGetCypressDataGridColumnsConfig<T>,
57
+ /**
58
+ * Grid data
59
+ */
21
60
  mockData: T,
61
+ /**
62
+ * Column index to get
63
+ */
22
64
  baseColumnIndex?: number
23
65
  ): Chainable<void>;
24
66
  /**
25
- * Obtiene la fila del grid especificada por el índice de base 1, garantizando que esté visible en el viewport
26
- * @param selector selector del grid
27
- * @param targetRowBaseOneIndex índice de la fila a obtener
28
- * @param baseOneColumnIndex índice de la columna a obtener
29
- * @returns la fila del grid
67
+ * Gets the grid row specified by 1-based index, ensuring it is visible in the viewport.
68
+ * @example
69
+ * cy.m4lDataGridRow('[class*="M4LDataGrid-root"]', 2, 1).click(); // row 2, column 1
30
70
  */
31
- m4lDataGridRow(selector: string, targetRowBaseOneIndex: number, baseOneColumnIndex: number): Chainable<JQuery<HTMLElement>>;
71
+ m4lDataGridRow(
72
+ /**
73
+ * Grid selector
74
+ */
75
+ selector: string,
76
+ /**
77
+ * Row index to get
78
+ */
79
+ targetRowBaseOneIndex: number,
80
+ /**
81
+ * Column index to get
82
+ */
83
+ baseOneColumnIndex: number
84
+ ): Chainable<JQuery<HTMLElement>>;
32
85
  /**
33
- * Obtiene el rowAction del menuActions asociado a la fila del grid especificada por el índice de base 1
34
- * @param selector selector del grid
35
- * @param menuItemIndex índice del item del menuActions
36
- * @param baseOneTargetRowIndex índice de la fila a obtener
37
- * @param baseColbaseOneColumnIndexumnIndex índice de la columna a obtener
38
- * @returns el rowAction del menuActions asociado a la fila del grid
86
+ * Opens the row actions menu for the given row and selects the menu item by index.
87
+ * @example
88
+ * cy.m4lDataGridRowAction('[class*="M4LDataGrid-root"]', 0, 2, 1); // row 2, column 1, first menu item
39
89
  */
40
90
  m4lDataGridRowAction(
91
+ /**
92
+ * Grid selector
93
+ */
41
94
  selector: string,
95
+ /**
96
+ * menuActions item index
97
+ */
42
98
  menuItemIndex: number,
99
+ /**
100
+ * Row index to get
101
+ */
43
102
  baseOnetargetRowIndex?: number,
103
+ /**
104
+ * Column index to get
105
+ */
44
106
  baseOneColumnIndex?: number,
45
107
  ): Chainable<Element>
46
108
 
47
109
  /**
48
- * Busca y muestra todas las columnas del grid principal
110
+ * Finds and shows all columns of the main grid by opening the configurator (third button).
111
+ * @example
112
+ * cy.m4lDataGridFindAllColumns('[class*="M4LDataGrid-root"]');
113
+ */
114
+ m4lDataGridFindAllColumns(
115
+ /**
116
+ * Grid selector
117
+ */
118
+ selector: string,
119
+ ): Chainable<Element>
120
+ /**
121
+ * Switches the grid view mode (e.g. Card vs Grid). Clicks the view-mode button and selects option by index.
122
+ * @example
123
+ * cy.m4lDataGridViewMode('[class*="M4LDataGrid-root"]', 0);
124
+ * cy.m4lDataGridViewMode('[class*="M4LDataGrid-root"]', 1);
49
125
  */
50
- m4lDataGridFindAllColumns(selector: string): Chainable<Element>
126
+ m4lDataGridOrCardViewMode(
127
+ /**
128
+ * Selector for the section to validate
129
+ */
130
+ section: string,
131
+ /**
132
+ * Card or Grid view mode
133
+ */
134
+ viewMode: number,
135
+ ): Chainable<Element>;
51
136
  }
52
137
  }
53
138
  }
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Registra los comandos de DynamicFilter
2
+ * Registers DynamicFilter commands
3
3
  */
4
4
  export declare const registerDynamicFilterCommands: () => void;
@@ -2,15 +2,22 @@ declare global {
2
2
  namespace Cypress {
3
3
  interface Chainable {
4
4
  /**
5
- * Click en el input de filtro
5
+ * Clicks on the filter input to open the filter popover.
6
+ * @example
7
+ * cy.m4lDynamicFilterInputClick();
8
+ * cy.m4lPopover().find('li').first().click();
6
9
  */
7
10
  m4lDynamicFilterInputClick(): Chainable<Element>;
8
11
  /**
9
- * Aplicar el filtro de fecha
12
+ * Applies the date filter: opens filter input, selects the date field by label, then confirms.
13
+ * @example
14
+ * cy.m4lDynamicFilterApplyedDateField('Created at');
10
15
  */
11
16
  m4lDynamicFilterApplyedDateField(dateFieldLabel: string): Chainable<Element>;
12
17
  /**
13
- * Obtiene el botón de refrescar
18
+ * Gets the refresh button (second button in the filter actions area).
19
+ * @example
20
+ * cy.m4lDynamicFilterRefreshButton('[class*="M4LSplitLayout-splitDetail"]').click();
14
21
  */
15
22
  m4lDynamicFilterRefreshButton(selector: string): Chainable<Element>;
16
23
  }
@@ -1,4 +1,4 @@
1
1
  /**
2
- * Registra los comandos de DynamicSort
2
+ * Registers DynamicSort commands
3
3
  */
4
4
  export declare const registerDynamicSortCommands: () => void;
@@ -1,8 +1,24 @@
1
1
  declare global {
2
2
  namespace Cypress {
3
3
  interface Chainable {
4
+ /**
5
+ * Clicks on the sort input to open the sort popover.
6
+ * @example
7
+ * cy.m4lDynamicSortInputClick();
8
+ * cy.m4lPopover().find('li').contains('Name').click();
9
+ */
4
10
  m4lDynamicSortInputClick(): Chainable<Element>
5
- m4lDynamicSortApplyedField(dateFieldLabel: string): Chainable<Element>
11
+ /**
12
+ * Applies the sort for a field: opens sort input, selects the field by label, then confirms.
13
+ * @example
14
+ * cy.m4lDynamicSortApplyedField('Created at');
15
+ */
16
+ m4lDynamicSortApplyedField(
17
+ /**
18
+ * Date field label
19
+ */
20
+ dateFieldLabel: string,
21
+ ): Chainable<Element>
6
22
  }
7
23
  }
8
24
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registers Filters and Sorts commands
3
+ */
4
+ export declare const registerFiltersCommands: () => void;
@@ -0,0 +1,24 @@
1
+ const I = '[class*="M4LSplitLayout-splitDetail"]', y = () => {
2
+ Cypress.Commands.add(
3
+ "m4lFiltersAndSortsOptionsValidation",
4
+ (i, t, n, s, c, l) => {
5
+ const o = () => cy.get('[role="presentation"]', { timeout: 1e3 }).should("exist"), r = (e) => {
6
+ o(), cy.get('[role="presentation"]', { timeout: 1e3 }).find("li").contains(e.key).click(), cy.get('[role="presentation"]', { timeout: 1e3 }).find('[class*="MuiPaper-root-MuiPopover-paper"]').should("be.visible").find("input").eq(e.inputIndex).click({ force: !0 });
7
+ }, T = () => {
8
+ cy.get("[role=presentation]").find("button").contains("N_D:[common_actions.intro]").click({ force: !0 });
9
+ }, d = (e) => {
10
+ ["select", "selectAsync", "boolean"].includes(e.type) ? (o(), cy.get('[role="presentation"]', { timeout: 1e3 }).find("li").eq(0).click({ force: !0 }), cy.get("[role=presentation]").find('[class*="MuiPaper-root-MuiPopover-paper"]').find('[class*="M4LWindowBase-headerWindowComponent"]').dblclick({ force: !0 })) : ["string", "number"].includes(e.type) && (o(), cy.get('[role="presentation"]', { timeout: 1e3 }).find("input").eq(1).type(e.value));
11
+ }, a = (e, p, u, E) => {
12
+ cy.log(`Validating filter ${e.key}`), cy.get(p, { timeout: 1e3 }).find(u).eq(E).click(), r(e), d(e), T();
13
+ };
14
+ i(t).forEach((e) => {
15
+ l ? (a(e, n, s, c), cy.get(`${I} [class*="M4LDynamicFilter-actions"] button`).eq(1).click(), cy.wait(e.endpoint, { timeout: 1e3 })) : (a(e, n, s, c), cy.wait(e.endpoint, { timeout: 1e3 }).wait("@getList", { timeout: 1e3 }));
16
+ });
17
+ }
18
+ ), Cypress.Commands.add("m4lFiltersAndSortsPersistValidation", (i, t, n) => {
19
+ cy.get(i).find(`[class*="M4LDynamic${t}-applied${t}s"]`).find(`[class*="M4LDynamic${t}-applied${t}InnerContainer"]`).find("[role=button-chip]").should("have.length", n);
20
+ });
21
+ };
22
+ export {
23
+ y as r
24
+ };
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Filter and sort configuration for Filters
3
+ */
4
+ export type M4lFiltersAndSortsConfig = {
5
+ /**
6
+ * Filter type for string, number, select, selectAsync and boolean types
7
+ */
8
+ type: string;
9
+ /**
10
+ * Filter key for select, selectAsync and boolean types
11
+ */
12
+ key: string;
13
+ /**
14
+ * Filter value for string and number types
15
+ */
16
+ value: string;
17
+ /**
18
+ * Filter endpoint to wait for
19
+ */
20
+ endpoint: string;
21
+ /**
22
+ * Filter input index
23
+ */
24
+ inputIndex: number;
25
+ };
26
+
27
+ declare global {
28
+ namespace Cypress {
29
+ interface Chainable {
30
+ /**
31
+ * Validates filter and sort options for DynamicFilter. For each filter, selects it, applies value by type, sends input.
32
+ * @example
33
+ * const mockFilters: M4lDynamicFilterConfig[] = [
34
+ * { type: 'string', key: 'Name', value: 'test', endpoint: '@getList', inputIndex: 1 },
35
+ * ];
36
+ * cy.intercept('GET', '/api/items*').as('getList');
37
+ * cy.m4lDynamicFilterValidateFilterAndSortOptions(
38
+ * (f) => f,
39
+ * mockFilters,
40
+ * '[class*="M4LDynamicFilter-root"]',
41
+ * '[class*="M4LDynamicFilter-filterChip"]',
42
+ * 0
43
+ * );
44
+ */
45
+ m4lFiltersAndSortsOptionsValidation (
46
+ filters: (mockFilters: M4lFiltersAndSortsConfig[]) => M4lFiltersAndSortsConfig[],
47
+ /**
48
+ * Mock of the filters to validate
49
+ */
50
+ mockFilters: M4lFiltersAndSortsConfig[],
51
+ /**
52
+ * Selector for the filters or sort to validate
53
+ */
54
+ filtersOrSort: string,
55
+ /**
56
+ * Selector for the section to validate
57
+ */
58
+ section: string,
59
+ /**
60
+ * Index of the filters or sort to validate
61
+ */
62
+ index: number,
63
+ /**
64
+ * If true, validates the filter in the logs tab
65
+ */
66
+ logs?: boolean,
67
+ ): Chainable<Element>;
68
+ /**
69
+ * Asserts that the number of applied filter/sort chips matches the expected length.
70
+ * @example
71
+ * cy.m4lDynamicFilterAndSortsPersist('[class*="M4LSplitLayout-splitDetail"]', 'Filter', 2);
72
+ */
73
+ m4lFiltersAndSortsPersistValidation (
74
+ /**
75
+ * Selector for the section to validate
76
+ */
77
+ section: string,
78
+ /**
79
+ * Filter or sort type
80
+ */
81
+ type: 'Filter' | 'Sort',
82
+ /**
83
+ * Length of applied filters and sorts
84
+ */
85
+ length: number,
86
+ ): Chainable<Element>;
87
+ }
88
+ }
89
+ }
90
+
91
+ export { };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registers Form commands
3
+ */
4
+ export declare const registerFormCommands: () => void;
@@ -0,0 +1,11 @@
1
+ import { a as s } from "./cypress/assertInitialFormState/assertInitialFormState.js";
2
+ import { a as r } from "./cypress/assertMandatoryFields/assertMandatoryFields.js";
3
+ import { f as m } from "./cypress/fillAndAssertFormFields/fillAndAssertFormFields.js";
4
+ import { g as o } from "./cypress/getFormScope/getFormScope.js";
5
+ import { p as e } from "./cypress/proceedFormStep/proceedFormStep.js";
6
+ const l = () => {
7
+ Cypress.Commands.add("m4lAssertInitialFormState", s), Cypress.Commands.add("m4lAssertMandatoryFields", r), Cypress.Commands.add("m4lGetFormScope", o), Cypress.Commands.add("m4lFillAndAssertFormFields", m), Cypress.Commands.add("m4lProceedFormStep", e);
8
+ };
9
+ export {
10
+ l as r
11
+ };
@@ -0,0 +1,5 @@
1
+ import { AssertInitialFormState } from './type';
2
+ /**
3
+ * Assert initial state of a Form, with or without stepper.
4
+ */
5
+ export declare const assertInitialFormState: (params: AssertInitialFormState) => void;
@@ -0,0 +1,20 @@
1
+ import { W as n, D as c } from "../constants.js";
2
+ import { g as d } from "../../helpers/getFieldNameDomElement.js";
3
+ import { g as h } from "../getFormScope/getFormScope.js";
4
+ const a = (e, o, t) => h(t).find(d(e.typeElement)).eq(e.index ?? o), i = (e, o) => {
5
+ e.forEach((t, s) => {
6
+ a(t, s, o).should("be.visible"), a(t, s, o).should("have.value", t.expectedValue ?? ""), t.enabled === !1 ? a(t, s, o).should("have.attr", "readonly") : a(t, s, o).should("not.have.attr", "readonly");
7
+ });
8
+ }, f = (e) => "steps" in e, g = (e) => {
9
+ const { endpointToWait: o } = e;
10
+ if (o && cy.wait(o), cy.get(n).should("be.visible"), f(e)) {
11
+ const { steps: t, labelNextButton: s = c } = e;
12
+ t.sort((r, l) => r.stepperIndex - l.stepperIndex).forEach((r, l) => {
13
+ l > 0 && cy.contains('[data-testid="M4LTypography-root"]', s).should("be.visible").click(), i(r.inputs, r.stepperIndex);
14
+ });
15
+ } else
16
+ i(e.inputs);
17
+ };
18
+ export {
19
+ g as a
20
+ };