@m4l/testing 0.0.13 → 0.0.14-beta.0
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/DataGrid/commands.d.ts +4 -0
- package/e2e/commands/components/DataGrid/commands.js +42 -0
- package/e2e/commands/components/DynamicFilter/commands.d.ts +4 -0
- package/e2e/commands/components/DynamicFilter/commands.js +12 -0
- package/e2e/commands/components/DynamicSort/commands.d.ts +4 -0
- package/e2e/commands/components/DynamicSort/commands.js +10 -0
- package/e2e/commands/components/MenuActions/commands.d.ts +4 -0
- package/e2e/commands/components/MenuActions/commands.js +8 -0
- package/e2e/commands/components/Popover/commands.d.ts +4 -0
- package/e2e/commands/components/Popover/commands.js +8 -0
- package/e2e/commands/components/PropertyValue/commands.d.ts +4 -0
- package/e2e/commands/components/PropertyValue/commands.js +8 -0
- package/e2e/commands/components/Tab/commands.d.ts +4 -0
- package/e2e/commands/components/Tab/commands.js +8 -0
- package/e2e/commands/components/WindowBase/commands.d.ts +4 -0
- package/e2e/commands/components/WindowBase/commands.js +16 -0
- package/e2e/commands/components/index.d.ts +8 -0
- package/e2e/commands/components/index.js +1 -0
- package/e2e/commands/index.d.ts +1 -0
- package/e2e/commands/index.js +1 -0
- package/e2e/commands/intercepts/index.d.ts +1 -0
- package/e2e/commands/intercepts/index.js +1 -0
- package/e2e/commands/intercepts/noPrivileges/interceptCommands.d.ts +4 -0
- package/e2e/commands/intercepts/noPrivileges/interceptCommands.js +14 -0
- package/e2e/commands/intercepts/noPrivileges/types.d.ts +8 -0
- package/e2e/commands/register.d.ts +4 -0
- package/e2e/commands/register.js +15 -0
- package/e2e/index.d.ts +1 -0
- package/index.d.ts +1 -1
- package/index.js +17 -17
- package/package.json +51 -8
- package/e2e/findAllColumns/findAllColumns.d.ts +0 -4
- package/e2e/findAllColumns/findAllColumns.js +0 -6
- package/testTools/utils.d.ts +0 -11
- package/vite-env.d.ts +0 -5
|
@@ -0,0 +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 });
|
|
10
|
+
}));
|
|
11
|
+
});
|
|
12
|
+
}), Cypress.Commands.add("m4lDataGridRow", (e, d, l) => {
|
|
13
|
+
let r = 0, a = 0;
|
|
14
|
+
const i = 10, n = d + 1;
|
|
15
|
+
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);
|
|
21
|
+
}
|
|
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();
|
|
26
|
+
return c.top >= 0 && c.left >= 0 && c.bottom <= (window.innerHeight || document.documentElement.clientHeight) && c.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
27
|
+
}).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());
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
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();
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
u as r
|
|
42
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const n = () => {
|
|
2
|
+
Cypress.Commands.add("m4lDynamicFilterInputClick", () => {
|
|
3
|
+
cy.get('[class*="M4LDynamicFilter-root"]').find('[class*="M4LDynamicFilter-inputFilter"]').find("input").click();
|
|
4
|
+
}), Cypress.Commands.add("m4lDynamicFilterApplyedDateField", (i) => {
|
|
5
|
+
cy.m4lDynamicFilterInputClick(), cy.m4lPopover().find("li").contains(i).click(), cy.m4lPopover().find("button").contains("N_D:[common_actions.intro]").click();
|
|
6
|
+
}), Cypress.Commands.add("m4lDynamicFilterRefreshButton", (i) => {
|
|
7
|
+
cy.get(i).find('[class*="M4LDynamicFilter-root"]').find('[class*="M4LDynamicFilter-actions"]').find('[class*="MuiButtonBase-root"]').eq(1);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
n as r
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const c = () => {
|
|
2
|
+
Cypress.Commands.add("m4lDynamicSortInputClick", () => {
|
|
3
|
+
cy.get('[class*="M4LDynamicSort-root"]').find('[class*="M4LDynamicSort-inputSort"]').find("input").click();
|
|
4
|
+
}), Cypress.Commands.add("m4lDynamicSortApplyedField", (n) => {
|
|
5
|
+
cy.m4lDynamicSortInputClick(), cy.m4lPopover().find("li").contains(n).click(), cy.m4lPopover().find("button").contains("N_D:[common_actions.intro]").click();
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
c as r
|
|
10
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const a = () => {
|
|
2
|
+
Cypress.Commands.add("m4lWindowBaseHeader", () => {
|
|
3
|
+
cy.get('[class^="M4LDragResizeWindowRND-draggableHandle"]').find('[class^="M4LDragResizeWindowRND-draggableCancel"]');
|
|
4
|
+
}), Cypress.Commands.add("m4lWindowBaseLeftAction", (e) => {
|
|
5
|
+
cy.m4lWindowBaseHeader().find("button").eq(e);
|
|
6
|
+
}), Cypress.Commands.add("m4lWindowBaseLeftActionClick", (e) => {
|
|
7
|
+
cy.m4lWindowBaseLeftAction(e).click({ force: !0 });
|
|
8
|
+
}), Cypress.Commands.add("m4lWindowBaseMenuAction", (e) => {
|
|
9
|
+
cy.m4lWindowBaseHeader().find('[class*="M4LMenuActions-root-M4LWindowBase-menuActionsWindowBase"]').find("button").eq(0).click(), cy.get("[role=presentation]").find('[class^="MuiPaper-root"]').find("[role=menuitem]").eq(e);
|
|
10
|
+
}), Cypress.Commands.add("m4lWindowBaseMenuActionDisabled", (e) => {
|
|
11
|
+
cy.m4lWindowBaseMenuAction(e).should("have.attr", "aria-disabled", "true");
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
a as r
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './DataGrid/commands';
|
|
2
|
+
export * from './DynamicFilter/commands';
|
|
3
|
+
export * from './DynamicSort/commands';
|
|
4
|
+
export * from './MenuActions/commands';
|
|
5
|
+
export * from './Popover/commands';
|
|
6
|
+
export * from './PropertyValue/commands';
|
|
7
|
+
export * from './Tab/commands';
|
|
8
|
+
export * from './WindowBase/commands';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { registerCommands } from './register';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './noPrivileges/interceptCommands';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { r } from "./components/DataGrid/commands.js";
|
|
2
|
+
import { r as m } from "./components/DynamicFilter/commands.js";
|
|
3
|
+
import { r as o } from "./components/DynamicSort/commands.js";
|
|
4
|
+
import { r as s } from "./components/MenuActions/commands.js";
|
|
5
|
+
import { r as e } from "./components/Popover/commands.js";
|
|
6
|
+
import { r as t } from "./components/PropertyValue/commands.js";
|
|
7
|
+
import { r as a } from "./components/Tab/commands.js";
|
|
8
|
+
import { r as i } from "./components/WindowBase/commands.js";
|
|
9
|
+
import { r as n } from "./intercepts/noPrivileges/interceptCommands.js";
|
|
10
|
+
const P = () => {
|
|
11
|
+
r(), m(), o(), s(), e(), t(), a(), i(), n();
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
P as r
|
|
15
|
+
};
|
package/e2e/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './commands';
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as t } from "./e2e/commands/register.js";
|
|
2
2
|
import { t as s } from "./testComponents/DataGrid/helpers.js";
|
|
3
3
|
import { t as a } from "./testComponents/DynamicFilter/helpers.js";
|
|
4
|
-
import { t as
|
|
5
|
-
import { act as
|
|
6
|
-
import { cleanup as
|
|
7
|
-
import { beforeEach as b, describe as
|
|
8
|
-
import { c as
|
|
9
|
-
import { default as
|
|
4
|
+
import { t as p } from "./testComponents/DynamicSort/helpers.js";
|
|
5
|
+
import { act as n } from "react";
|
|
6
|
+
import { cleanup as c, fireEvent as d, renderHook as l, screen as u, waitFor as F, within as C } from "@testing-library/react";
|
|
7
|
+
import { beforeEach as b, describe as g, expect as h } from "vitest";
|
|
8
|
+
import { c as w } from "./testTools/utils.js";
|
|
9
|
+
import { default as H } from "@testing-library/user-event";
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
n as act,
|
|
12
12
|
b as beforeEach,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
c as cleanup,
|
|
14
|
+
g as describe,
|
|
15
|
+
h as expect,
|
|
16
|
+
d as fireEvent,
|
|
17
|
+
t as registerCommands,
|
|
18
|
+
w as render,
|
|
19
|
+
l as renderHook,
|
|
20
20
|
u as screen,
|
|
21
21
|
s as testColumnConfigs,
|
|
22
22
|
a as testFilterFields,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
p as testSortFields,
|
|
24
|
+
H as userEvent,
|
|
25
25
|
F as waitFor,
|
|
26
26
|
C as within
|
|
27
27
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/testing",
|
|
3
3
|
"description": "Shared testing utilities for MFs",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.14-beta.0",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "M4L Team",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "npx -y rimraf node_modules **/node_modules/ **/dist/ dist yarn.lock .yarn .config/yarn package-lock.json",
|
|
9
|
+
"typescript": "tsc --noEmit",
|
|
10
|
+
"build": "yarn lint:fix && tsc && vite build && buildM4lPackage",
|
|
11
|
+
"build:only": "vite build && buildM4lPackage",
|
|
12
|
+
"buildM4Lpackage:monorepo": "node ../m4l_vite_plugins/dist/bin/buildM4lPackage.js",
|
|
13
|
+
"build:monorepo": "yarn lint:fix && tsc && vite build",
|
|
14
|
+
"build:only:monorepo": "tsc && vite build && yarn buildM4Lpackage:monorepo",
|
|
15
|
+
"release": "yarn build && npm publish ./dist",
|
|
16
|
+
"release:monorepo": "yarn build:monorepo && cd dist && npm publish",
|
|
17
|
+
"release:monorepo:beta": "yarn build:monorepo && cd dist && npm publish --tag beta",
|
|
18
|
+
"release:monorepo:beta:only": "cd dist && npm publish --tag beta",
|
|
19
|
+
"lint": "npx eslint . --max-warnings 0",
|
|
20
|
+
"lint:fix": "yarn lint --fix --max-warnings 0",
|
|
21
|
+
"lefthook:install": "lefthook install",
|
|
22
|
+
"test": "vitest --config vitest.config.ts",
|
|
23
|
+
"test:only": "vitest --config vitest.config.ts --allowOnly",
|
|
24
|
+
"coverage": "vitest run --coverage",
|
|
25
|
+
"coverage:ui": "vitest --ui run --coverage ",
|
|
26
|
+
"docs": "typedoc --entryPointStrategy expand --tsconfig ./tsconfig.json"
|
|
27
|
+
},
|
|
7
28
|
"lint-staged": {
|
|
8
29
|
"*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
|
|
9
30
|
},
|
|
@@ -28,7 +49,7 @@
|
|
|
28
49
|
"@vitest/coverage-istanbul": "^3.1.1",
|
|
29
50
|
"@vitest/coverage-v8": "^3.1.1",
|
|
30
51
|
"@vitest/ui": "^3.1.1",
|
|
31
|
-
"cypress": "^
|
|
52
|
+
"cypress": "^14.1.0",
|
|
32
53
|
"cypress-vite": "^1.5.0",
|
|
33
54
|
"happy-dom": "^17.1.9",
|
|
34
55
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -40,6 +61,23 @@
|
|
|
40
61
|
"react": "^18.0.0",
|
|
41
62
|
"vitest": "^3.1.1"
|
|
42
63
|
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@m4l/components": "^9.0.0",
|
|
66
|
+
"@m4l/config": "^1.1.2",
|
|
67
|
+
"@m4l/vite-plugins": "^1.1.5",
|
|
68
|
+
"@types/node": "^22.7.3",
|
|
69
|
+
"@types/react": "^18.0.0",
|
|
70
|
+
"@types/react-dom": "^18.0.0",
|
|
71
|
+
"eslint": "^9.0.0",
|
|
72
|
+
"lefthook": "^1.7.18",
|
|
73
|
+
"lint-staged": "^15.2.10",
|
|
74
|
+
"react": "^18.0.0",
|
|
75
|
+
"react-dom": "^18.0.0",
|
|
76
|
+
"typescript": "^5.4.5",
|
|
77
|
+
"vite": "^6.3.5",
|
|
78
|
+
"vite-plugin-dts": "^4.2.1",
|
|
79
|
+
"vitest": "^3.1.1"
|
|
80
|
+
},
|
|
43
81
|
"resolutions": {
|
|
44
82
|
"glob": "^10.4.5",
|
|
45
83
|
"react": "^18.0.0",
|
|
@@ -64,6 +102,16 @@
|
|
|
64
102
|
"module": "./index.js",
|
|
65
103
|
"type": "module",
|
|
66
104
|
"types": "./index.d.ts",
|
|
105
|
+
"exports": {
|
|
106
|
+
".": {
|
|
107
|
+
"types": "./index.d.ts",
|
|
108
|
+
"import": "./index.js",
|
|
109
|
+
"require": null
|
|
110
|
+
},
|
|
111
|
+
"./cypress": {
|
|
112
|
+
"types": "./e2e/cypress.d.ts"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
67
115
|
"sideEffects": false,
|
|
68
116
|
"publishConfig": {
|
|
69
117
|
"access": "public"
|
|
@@ -72,10 +120,5 @@
|
|
|
72
120
|
"node": ">=12.0.0"
|
|
73
121
|
},
|
|
74
122
|
"packageManager": "yarn@4.5.0",
|
|
75
|
-
"
|
|
76
|
-
"exports": {
|
|
77
|
-
".": {
|
|
78
|
-
"import": "./index.js"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
123
|
+
"juan": 1
|
|
81
124
|
}
|
package/testTools/utils.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { renderHook, cleanup, fireEvent, RenderResult, screen, waitFor, within } from '@testing-library/react';
|
|
2
|
-
import { default as userEvent } from '@testing-library/user-event';
|
|
3
|
-
import { act, ReactElement } from 'react';
|
|
4
|
-
import { beforeEach, describe, expect } from 'vitest';
|
|
5
|
-
/**
|
|
6
|
-
* Render a component
|
|
7
|
-
*/
|
|
8
|
-
declare const customRender: (ui: ReactElement, options?: {}) => RenderResult & {
|
|
9
|
-
user: ReturnType<typeof userEvent.setup>;
|
|
10
|
-
};
|
|
11
|
-
export { act, cleanup, describe, expect, fireEvent, customRender as render, renderHook, screen, userEvent, waitFor, within, beforeEach, };
|