@m4l/testing 0.0.20 → 0.0.21-BC20260224-2
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.
- package/e2e/commands/components/Accordions/commands.d.ts +4 -0
- package/e2e/commands/components/Accordions/commands.js +19 -0
- package/e2e/commands/components/Accordions/types.d.ts +30 -0
- package/e2e/commands/components/DataGrid/commands.js +32 -32
- package/e2e/commands/components/DataGrid/types.d.ts +24 -11
- package/e2e/commands/components/DynamicFilter/commands.js +23 -7
- package/e2e/commands/components/DynamicFilter/types.d.ts +22 -0
- package/e2e/commands/components/index.d.ts +1 -0
- package/e2e/commands/index.d.ts +3 -0
- package/e2e/commands/register.js +11 -10
- package/e2e/cypress.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const a = () => {
|
|
2
|
+
Cypress.Commands.add(
|
|
3
|
+
"m4lAccordionsValidateAccordions",
|
|
4
|
+
(o, c, r, t, l, i, n) => {
|
|
5
|
+
cy.get('[class^="M4LDataGrid-root"]').find("[role=row]").find("[role=gridcell]").eq(1).click(), cy.get(i).find("[role=tablist]").find("button").eq(n).should("have.text", r), cy.get('[class*="M4LTabContent-root"]').find("[role=listitem]").find("[role=list]").find('[class*="M4LAccordion-accordionRoot"]').eq(t).as("currentAccordion"), cy.get("@currentAccordion").find('[class*="M4LAccordion-accordionSummary"]').should("have.text", l).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
|
+
}), o(c).forEach((e) => {
|
|
10
|
+
cy.get("@currentAccordion").find('[class*="M4LAccordion-accordionDetails"]').find('[role="property-value-form-role"]').eq(e.index).within(() => {
|
|
11
|
+
cy.log(`Validando nombre ${e.key}`), cy.get('[class*="M4LPropertyValue-name"]').should("have.text", e.key), cy.log(`Validando valor ${e.value}`), cy.get('[role="property-value-value-role"][class*="M4LPropertyValue-value"]').should("have.text", e.value);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
a as r
|
|
19
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuración del accordion
|
|
3
|
+
*/
|
|
4
|
+
export type M4lAccordionsConfig = {
|
|
5
|
+
title: string;
|
|
6
|
+
key: string;
|
|
7
|
+
value: any;
|
|
8
|
+
index: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
declare global {
|
|
12
|
+
namespace Cypress {
|
|
13
|
+
interface Chainable {
|
|
14
|
+
/**
|
|
15
|
+
* Valida los accordions
|
|
16
|
+
*/
|
|
17
|
+
m4lAccordionsValidateAccordions(
|
|
18
|
+
accordions: (mockAccordions: M4lAccordionsConfig[]) => M4lAccordionsConfig[],
|
|
19
|
+
mockAccordions: M4lAccordionsConfig[],
|
|
20
|
+
tabTitle: string,
|
|
21
|
+
index: number,
|
|
22
|
+
title: string,
|
|
23
|
+
sectionGrid: string,
|
|
24
|
+
tabIndex: number,
|
|
25
|
+
): Chainable<Element>;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
const
|
|
2
|
-
Cypress.Commands.add("m4lDataGrid", (e) => {
|
|
3
|
-
cy.get(e).find(
|
|
4
|
-
}), Cypress.Commands.add("m4lDataGridValidateVisibleColumns", (e,
|
|
5
|
-
let
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
1
|
+
const f = () => {
|
|
2
|
+
Cypress.Commands.add("m4lDataGrid", (e, n) => {
|
|
3
|
+
cy.get(e).find(`[class^="M4LDataGrid-root"][data-testid^="M4LDataGrid-root-${n}"]`);
|
|
4
|
+
}), Cypress.Commands.add("m4lDataGridValidateVisibleColumns", (e, n, l, a, r = 1) => {
|
|
5
|
+
let c = 0, t = r;
|
|
6
|
+
l(a).forEach((o) => {
|
|
7
|
+
o.visible && (cy.log(`Validando columna visible: ${o.headerText} , index: ${t}`), t++, cy.m4lDataGrid(e, n).find("[role=row]").find(`[role=columnheader][aria-colindex=${t}]`).should("have.text", o.headerText), cy.m4lDataGrid(e, n).find("[role=row]").find(`[role=gridcell][aria-colindex=${t}]`).should("contain", o.value), cy.m4lDataGrid(e, n).find("[role=row]").find(`[role=columnheader][aria-colindex=${t}]`).then((m) => {
|
|
8
|
+
const d = m.width();
|
|
9
|
+
d !== void 0 && (c += d), cy.m4lDataGrid(e, n).find("[role=grid]").scrollTo(c, 0, { duration: 100, ensureScrollable: !1 });
|
|
10
10
|
}));
|
|
11
11
|
});
|
|
12
|
-
}), Cypress.Commands.add("m4lDataGridRow", (e,
|
|
13
|
-
let r = 0,
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
-
return cy.m4lDataGrid(e).find("[role=row]").not('[aria-rowindex="1"]').filter(`[aria-rowindex="${
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
return cy.wrap(
|
|
12
|
+
}), Cypress.Commands.add("m4lDataGridRow", (e, n, l, a) => {
|
|
13
|
+
let r = 0, c = 0;
|
|
14
|
+
const t = 10, o = l + 1;
|
|
15
|
+
function m() {
|
|
16
|
+
return cy.m4lDataGrid(e, n).find("[role=row]").not('[aria-rowindex="1"]').filter(`[aria-rowindex="${o}"]`).then((d) => {
|
|
17
|
+
if (d.length > 0) {
|
|
18
|
+
const i = d[0].getBoundingClientRect();
|
|
19
|
+
if (i.top >= 0 && i.left >= 0 && i.bottom <= (window.innerHeight || document.documentElement.clientHeight) && i.right <= (window.innerWidth || document.documentElement.clientWidth))
|
|
20
|
+
return cy.wrap(d);
|
|
21
21
|
}
|
|
22
|
-
if (
|
|
23
|
-
throw new Error(`No se encontró la fila ${
|
|
24
|
-
return
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
}).first().then((
|
|
28
|
-
const
|
|
29
|
-
return r +=
|
|
22
|
+
if (c >= t)
|
|
23
|
+
throw new Error(`No se encontró la fila ${o} después de ${t} intentos`);
|
|
24
|
+
return c++, cy.m4lDataGrid(e, n).find("[role=row]").not('[aria-rowindex="1"]').filter((u, i) => {
|
|
25
|
+
const s = i.getBoundingClientRect();
|
|
26
|
+
return s.top >= 0 && s.left >= 0 && s.bottom <= (window.innerHeight || document.documentElement.clientHeight) && s.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
27
|
+
}).first().then((u) => {
|
|
28
|
+
const i = u.height() || 0;
|
|
29
|
+
return r += i, cy.m4lDataGrid(e, n).find("[role=grid]").scrollTo(0, r, { duration: 100, ensureScrollable: !1 }).then(() => m());
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
return
|
|
34
|
-
}), Cypress.Commands.add("m4lDataGridRowAction", (e,
|
|
35
|
-
cy.m4lDataGridRow(e,
|
|
36
|
-
}), Cypress.Commands.add("m4lDataGridFindAllColumns", (e) => {
|
|
37
|
-
cy.m4lDataGrid(e).find('[class^="M4LDataGrid-actionsConfigContainer"]').find("button").eq(2).click();
|
|
33
|
+
return m().find(`[role=gridcell][aria-colindex="${a}"]`);
|
|
34
|
+
}), Cypress.Commands.add("m4lDataGridRowAction", (e, n, l, a = 1, r = 1) => {
|
|
35
|
+
cy.m4lDataGridRow(e, n, a, r).find("button").eq(0).should("be.visible", { timeout: 1e4 }).click(), cy.m4lMenuActionsItem(l);
|
|
36
|
+
}), Cypress.Commands.add("m4lDataGridFindAllColumns", (e, n) => {
|
|
37
|
+
cy.m4lDataGrid(e, n).find('[class^="M4LDataGrid-actionsConfigContainer"]').find("button").eq(2).click();
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
f as r
|
|
42
42
|
};
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Configuración de columna para DataGrid en Cypress
|
|
3
|
+
*/
|
|
4
|
+
export type M4LDataGridCypressColumn = {
|
|
5
|
+
key: string;
|
|
6
|
+
value: any;
|
|
7
|
+
headerText: string;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
};
|
|
3
10
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export type M4LGetCypressDataGridColumnsConfig<T> = (data: T) => M4LDataGridCypressColumn[];
|
|
11
|
+
/**
|
|
12
|
+
* Función que obtiene la configuración de columnas del DataGrid
|
|
13
|
+
*/
|
|
14
|
+
export type M4LGetCypressDataGridColumnsConfig<T> = (data: T) => M4LDataGridCypressColumn[];
|
|
10
15
|
|
|
16
|
+
declare global {
|
|
11
17
|
namespace Cypress {
|
|
12
18
|
interface Chainable {
|
|
13
19
|
/**
|
|
@@ -15,16 +21,18 @@ declare global {
|
|
|
15
21
|
* @param selector selector del grid
|
|
16
22
|
* @returns el grid
|
|
17
23
|
*/
|
|
18
|
-
m4lDataGrid(selector: string): Chainable<Element>
|
|
24
|
+
m4lDataGrid(selector: string, gridDataTestid: string): Chainable<Element>
|
|
19
25
|
/**
|
|
20
26
|
* Valida las columnas visibles del grid
|
|
21
27
|
* @param selector selector del grid
|
|
28
|
+
* @param gridDataTestid testid del grid
|
|
22
29
|
* @param getColumnsConfig función que obtiene las columnas visibles del grid
|
|
23
30
|
* @param mockData datos del grid
|
|
24
31
|
* @param baseColumnIndex índice de la columna a obtener
|
|
25
32
|
*/
|
|
26
33
|
m4lDataGridValidateVisibleColumns<T>(
|
|
27
34
|
selector: string,
|
|
35
|
+
gridDataTestid: string,
|
|
28
36
|
getColumnsConfig: M4LGetCypressDataGridColumnsConfig<T>,
|
|
29
37
|
mockData: T,
|
|
30
38
|
baseColumnIndex?: number
|
|
@@ -32,14 +40,16 @@ declare global {
|
|
|
32
40
|
/**
|
|
33
41
|
* Obtiene la fila del grid especificada por el índice de base 1, garantizando que esté visible en el viewport
|
|
34
42
|
* @param selector selector del grid
|
|
43
|
+
* @param gridDataTestid testid del grid
|
|
35
44
|
* @param targetRowBaseOneIndex índice de la fila a obtener
|
|
36
45
|
* @param baseOneColumnIndex índice de la columna a obtener
|
|
37
46
|
* @returns la fila del grid
|
|
38
47
|
*/
|
|
39
|
-
m4lDataGridRow(selector: string, targetRowBaseOneIndex: number, baseOneColumnIndex: number): Chainable<JQuery<HTMLElement>>;
|
|
48
|
+
m4lDataGridRow(selector: string, gridDataTestid: string, targetRowBaseOneIndex: number, baseOneColumnIndex: number): Chainable<JQuery<HTMLElement>>;
|
|
40
49
|
/**
|
|
41
50
|
* Obtiene el rowAction del menuActions asociado a la fila del grid especificada por el índice de base 1
|
|
42
51
|
* @param selector selector del grid
|
|
52
|
+
* @param gridDataTestid testid del grid
|
|
43
53
|
* @param menuItemIndex índice del item del menuActions
|
|
44
54
|
* @param baseOneTargetRowIndex índice de la fila a obtener
|
|
45
55
|
* @param baseColbaseOneColumnIndexumnIndex índice de la columna a obtener
|
|
@@ -47,6 +57,7 @@ declare global {
|
|
|
47
57
|
*/
|
|
48
58
|
m4lDataGridRowAction(
|
|
49
59
|
selector: string,
|
|
60
|
+
gridDataTestid: string,
|
|
50
61
|
menuItemIndex: number,
|
|
51
62
|
baseOnetargetRowIndex?: number,
|
|
52
63
|
baseOneColumnIndex?: number,
|
|
@@ -54,8 +65,10 @@ declare global {
|
|
|
54
65
|
|
|
55
66
|
/**
|
|
56
67
|
* Busca y muestra todas las columnas del grid principal
|
|
68
|
+
* @param selector selector del grid
|
|
69
|
+
* @param gridDataTestid testid del grid
|
|
57
70
|
*/
|
|
58
|
-
m4lDataGridFindAllColumns(selector: string): Chainable<Element>
|
|
71
|
+
m4lDataGridFindAllColumns(selector: string, gridDataTestid: string): Chainable<Element>
|
|
59
72
|
}
|
|
60
73
|
}
|
|
61
74
|
}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
const
|
|
1
|
+
const u = '[class*="M4LSplitLayout-splitDetail"]', E = () => {
|
|
2
2
|
Cypress.Commands.add("m4lDynamicFilterInputClick", () => {
|
|
3
3
|
cy.get('[class*="M4LDynamicFilter-root"]').find('[class*="M4LDynamicFilter-inputFilter"]').find("input").click();
|
|
4
|
-
}), Cypress.Commands.add("m4lDynamicFilterApplyedDateField", (
|
|
5
|
-
cy.m4lDynamicFilterInputClick(), cy.m4lPopover().find("li").contains(
|
|
6
|
-
}), Cypress.Commands.add("m4lDynamicFilterRefreshButton", (
|
|
7
|
-
cy.get(
|
|
8
|
-
})
|
|
4
|
+
}), Cypress.Commands.add("m4lDynamicFilterApplyedDateField", (e) => {
|
|
5
|
+
cy.m4lDynamicFilterInputClick(), cy.m4lPopover().find("li").contains(e).click(), cy.m4lPopover().find("button").contains("N_D:[common_actions.intro]").click();
|
|
6
|
+
}), Cypress.Commands.add("m4lDynamicFilterRefreshButton", (e) => {
|
|
7
|
+
cy.get(e).find('[class*="M4LDynamicFilter-root"]').find('[class*="M4LDynamicFilter-actions"]').find('[class*="MuiButtonBase-root"]').eq(1);
|
|
8
|
+
}), Cypress.Commands.add(
|
|
9
|
+
"m4lDynamicFilterValidateFilterAndSortOptions",
|
|
10
|
+
(e, a, n, o, c, l) => {
|
|
11
|
+
const i = () => cy.get('[role="presentation"]', { timeout: 1e3 }).should("exist"), r = (t) => {
|
|
12
|
+
i(), cy.get('[role="presentation"]', { timeout: 1e3 }).find("li").contains(t.key).click(), cy.get('[role="presentation"]', { timeout: 1e3 }).find('[class*="MuiPaper-root-MuiPopover-paper"]').should("be.visible").find("input").eq(t.inputIndex).click({ force: !0 });
|
|
13
|
+
}, d = () => {
|
|
14
|
+
cy.get("[role=presentation]").find("button").contains("N_D:[common_actions.intro]").click({ force: !0 });
|
|
15
|
+
}, p = (t) => {
|
|
16
|
+
["select", "selectAsync", "boolean"].includes(t.type) ? (i(), 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(t.type) && (i(), cy.get('[role="presentation"]', { timeout: 1e3 }).find("input").eq(1).type(t.value));
|
|
17
|
+
}, s = (t, m, y, T) => {
|
|
18
|
+
cy.log(`Validando filtro ${t.key}`), cy.get(m, { timeout: 1e3 }).find(y).eq(T).click(), r(t), p(t), d();
|
|
19
|
+
};
|
|
20
|
+
e(a).forEach((t) => {
|
|
21
|
+
l ? (s(t, n, o, c), cy.get(`${u} [class*="M4LDynamicFilter-actions"] button`).eq(1).click(), cy.wait(t.endpoint, { timeout: 1e3 })) : (s(t, n, o, c), cy.wait(t.endpoint, { timeout: 1e3 }).wait("@getList", { timeout: 1e3 }));
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
);
|
|
9
25
|
};
|
|
10
26
|
export {
|
|
11
|
-
|
|
27
|
+
E as r
|
|
12
28
|
};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuración del filtro para DynamicFilter
|
|
3
|
+
*/
|
|
4
|
+
export type M4lDynamicFilterConfig = {
|
|
5
|
+
type: string;
|
|
6
|
+
key: string;
|
|
7
|
+
value: string;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
inputIndex: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
1
12
|
declare global {
|
|
2
13
|
namespace Cypress {
|
|
3
14
|
interface Chainable {
|
|
@@ -13,6 +24,17 @@ declare global {
|
|
|
13
24
|
* Obtiene el botón de refrescar
|
|
14
25
|
*/
|
|
15
26
|
m4lDynamicFilterRefreshButton(selector: string): Chainable<Element>;
|
|
27
|
+
/**
|
|
28
|
+
* Valida opciones de filtro y orden para DynamicFilter
|
|
29
|
+
*/
|
|
30
|
+
m4lDynamicFilterValidateFilterAndSortOptions(
|
|
31
|
+
filters: (mockFilters: M4lDynamicFilterConfig[]) => M4lDynamicFilterConfig[],
|
|
32
|
+
mockFilters: M4lDynamicFilterConfig[],
|
|
33
|
+
filtersOrSort: string,
|
|
34
|
+
section: string,
|
|
35
|
+
index: number,
|
|
36
|
+
logs?: boolean,
|
|
37
|
+
): Chainable<Element>;
|
|
16
38
|
}
|
|
17
39
|
}
|
|
18
40
|
}
|
package/e2e/commands/index.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
1
|
export { registerCommands } from './register';
|
|
2
|
+
export type { M4lDynamicFilterConfig } from './components/DynamicFilter/types';
|
|
3
|
+
export type { M4lAccordionsConfig } from './components/Accordions/types';
|
|
4
|
+
export type { M4LDataGridCypressColumn, M4LGetCypressDataGridColumnsConfig } from './components/DataGrid/types';
|
package/e2e/commands/register.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { r } from "./components/
|
|
2
|
-
import { r as m } from "./components/
|
|
3
|
-
import { r as o } from "./components/
|
|
4
|
-
import { r as s } from "./components/
|
|
5
|
-
import { r as e } from "./components/
|
|
1
|
+
import { r } from "./components/Accordions/commands.js";
|
|
2
|
+
import { r as m } from "./components/DataGrid/commands.js";
|
|
3
|
+
import { r as o } from "./components/DynamicFilter/commands.js";
|
|
4
|
+
import { r as s } from "./components/DynamicSort/commands.js";
|
|
5
|
+
import { r as e } from "./components/MenuActions/commands.js";
|
|
6
|
+
import { r as i } from "./components/Popover/commands.js";
|
|
6
7
|
import { r as t } from "./components/PropertyValue/commands.js";
|
|
7
8
|
import { r as a } from "./components/Tab/commands.js";
|
|
8
|
-
import { r as
|
|
9
|
-
import { r as
|
|
10
|
-
const
|
|
11
|
-
r(), m(), o(), s(), e(), t(), a(),
|
|
9
|
+
import { r as n } from "./components/WindowBase/commands.js";
|
|
10
|
+
import { r as d } from "./intercepts/noPrivileges/interceptCommands.js";
|
|
11
|
+
const v = () => {
|
|
12
|
+
r(), m(), o(), s(), e(), i(), t(), a(), n(), d();
|
|
12
13
|
};
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
+
v as r
|
|
15
16
|
};
|
package/e2e/cypress.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="./commands/components/Accordions/types.d.ts" />
|
|
1
2
|
/// <reference path="./commands/components/DataGrid/types.d.ts" />
|
|
2
3
|
/// <reference path="./commands/components/DynamicFilter/types.d.ts" />
|
|
3
4
|
/// <reference path="./commands/components/DynamicSort/types.d.ts" />
|