@m4l/testing 0.0.13-beta.2 → 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.
Files changed (35) hide show
  1. package/e2e/commands/components/DataGrid/commands.d.ts +4 -0
  2. package/e2e/commands/components/DataGrid/commands.js +42 -0
  3. package/e2e/commands/components/DynamicFilter/commands.d.ts +4 -0
  4. package/e2e/commands/components/DynamicFilter/commands.js +12 -0
  5. package/e2e/commands/components/DynamicSort/commands.d.ts +4 -0
  6. package/e2e/commands/components/DynamicSort/commands.js +10 -0
  7. package/e2e/commands/components/MenuActions/commands.d.ts +4 -0
  8. package/e2e/commands/components/MenuActions/commands.js +8 -0
  9. package/e2e/commands/components/Popover/commands.d.ts +4 -0
  10. package/e2e/commands/components/Popover/commands.js +8 -0
  11. package/e2e/commands/components/PropertyValue/commands.d.ts +4 -0
  12. package/e2e/commands/components/PropertyValue/commands.js +8 -0
  13. package/e2e/commands/components/Tab/commands.d.ts +4 -0
  14. package/e2e/commands/components/Tab/commands.js +8 -0
  15. package/e2e/commands/components/WindowBase/commands.d.ts +4 -0
  16. package/e2e/commands/components/WindowBase/commands.js +16 -0
  17. package/e2e/commands/components/index.d.ts +8 -0
  18. package/e2e/commands/components/index.js +1 -0
  19. package/e2e/commands/index.d.ts +1 -0
  20. package/e2e/commands/index.js +1 -0
  21. package/e2e/commands/intercepts/index.d.ts +1 -0
  22. package/e2e/commands/intercepts/index.js +1 -0
  23. package/e2e/commands/intercepts/noPrivileges/interceptCommands.d.ts +4 -0
  24. package/e2e/commands/intercepts/noPrivileges/interceptCommands.js +14 -0
  25. package/e2e/commands/intercepts/noPrivileges/types.d.ts +8 -0
  26. package/e2e/commands/register.d.ts +4 -0
  27. package/e2e/commands/register.js +15 -0
  28. package/e2e/index.d.ts +1 -0
  29. package/index.d.ts +1 -1
  30. package/index.js +17 -17
  31. package/package.json +53 -11
  32. package/e2e/findAllColumns/findAllColumns.d.ts +0 -4
  33. package/e2e/findAllColumns/findAllColumns.js +0 -6
  34. package/testTools/utils.d.ts +0 -11
  35. package/vite-env.d.ts +0 -5
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registra los comandos de DataGrid
3
+ */
4
+ export declare const registerDataGridCommands: () => void;
@@ -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,4 @@
1
+ /**
2
+ * Registra los comandos de DynamicFilter
3
+ */
4
+ export declare const registerDynamicFilterCommands: () => void;
@@ -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,4 @@
1
+ /**
2
+ * Registra los comandos de DynamicSort
3
+ */
4
+ export declare const registerDynamicSortCommands: () => void;
@@ -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,4 @@
1
+ /**
2
+ * Registra los comandos de MenuActions
3
+ */
4
+ export declare const registerMenuActionsCommands: () => void;
@@ -0,0 +1,8 @@
1
+ const o = () => {
2
+ Cypress.Commands.add("m4lMenuActionsItem", (e) => {
3
+ cy.m4lPopover().find("[role=menuitem]").eq(e).should("be.visible", { timeout: 1e4 });
4
+ });
5
+ };
6
+ export {
7
+ o as r
8
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registra los comandos de Popover
3
+ */
4
+ export declare const registerPopoverCommands: () => void;
@@ -0,0 +1,8 @@
1
+ const o = () => {
2
+ Cypress.Commands.add("m4lPopover", () => {
3
+ cy.get("[role=presentation").find('[class^="MuiPaper-root"]');
4
+ });
5
+ };
6
+ export {
7
+ o as r
8
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registra los comandos de PropertyValue
3
+ */
4
+ export declare const registerPropertyValueCommands: () => void;
@@ -0,0 +1,8 @@
1
+ const r = () => {
2
+ Cypress.Commands.add("m4lPropertyValue", (e) => {
3
+ cy.get(e).find('[class*="M4LPropertyValue-value"]');
4
+ });
5
+ };
6
+ export {
7
+ r
8
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registra los comandos de Tab
3
+ */
4
+ export declare const registerTabCommands: () => void;
@@ -0,0 +1,8 @@
1
+ const a = () => {
2
+ Cypress.Commands.add("m4lTabButton", (t, s) => {
3
+ cy.get(t).find("[role=tablist]").find("button").eq(s);
4
+ });
5
+ };
6
+ export {
7
+ a as r
8
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registra los comandos de WindowBase
3
+ */
4
+ export declare const registerWindowBaseCommands: () => void;
@@ -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,4 @@
1
+ /**
2
+ * Registra los comandos de intercepts
3
+ */
4
+ export declare const registerInterceptNoPrivilegesCommands: () => void;
@@ -0,0 +1,14 @@
1
+ const e = () => {
2
+ Cypress.Commands.add("m4lInterceptNoPrivileges", () => {
3
+ cy.intercept("GET", "**/main/auth/login*", {
4
+ statusCode: 200,
5
+ body: {
6
+ data: {},
7
+ user: {}
8
+ }
9
+ }).as("noPrivileges");
10
+ });
11
+ };
12
+ export {
13
+ e as r
14
+ };
@@ -0,0 +1,8 @@
1
+ declare global {
2
+ namespace Cypress {
3
+ interface Chainable {
4
+ m4lInterceptNoPrivileges(): Chainable<void>;
5
+ }
6
+ }
7
+ }
8
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Registra los comandos de la aplicación
3
+ */
4
+ export declare const registerCommands: () => void;
@@ -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
@@ -1,3 +1,3 @@
1
- export { findAllColumns } from './e2e/findAllColumns/findAllColumns';
1
+ export * from './e2e/commands';
2
2
  export * from './testComponents';
3
3
  export * from './testTools';
package/index.js CHANGED
@@ -1,27 +1,27 @@
1
- import { f as t } from "./e2e/findAllColumns/findAllColumns.js";
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 n } from "./testComponents/DynamicSort/helpers.js";
5
- import { act as i } from "react";
6
- import { cleanup as l, fireEvent as c, renderHook as d, screen as u, waitFor as F, within as C } from "@testing-library/react";
7
- import { beforeEach as b, describe as h, expect as v } from "vitest";
8
- import { c as g } from "./testTools/utils.js";
9
- import { default as A } from "@testing-library/user-event";
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
- i as act,
11
+ n as act,
12
12
  b as beforeEach,
13
- l as cleanup,
14
- h as describe,
15
- v as expect,
16
- t as findAllColumns,
17
- c as fireEvent,
18
- g as render,
19
- d as renderHook,
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
- n as testSortFields,
24
- A as userEvent,
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.13-beta.2",
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": "^13.14.2",
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",
@@ -38,7 +59,24 @@
38
59
  "peerDependencies": {
39
60
  "@types/react": "^18.0.0",
40
61
  "react": "^18.0.0",
41
- "vitest": "3.1.1"
62
+ "vitest": "^3.1.1"
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"
42
80
  },
43
81
  "resolutions": {
44
82
  "glob": "^10.4.5",
@@ -46,8 +84,7 @@
46
84
  "@types/react": "^18.0.0",
47
85
  "@types/react-dom": "^18.0.0",
48
86
  "react-dom": "^18.0.0",
49
- "@vitejs/plugin-react": "^4.0.0",
50
- "vitest": "3.1.1"
87
+ "@vitejs/plugin-react": "^4.0.0"
51
88
  },
52
89
  "overrides": {
53
90
  "glob": "^10.4.5",
@@ -65,6 +102,16 @@
65
102
  "module": "./index.js",
66
103
  "type": "module",
67
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
+ },
68
115
  "sideEffects": false,
69
116
  "publishConfig": {
70
117
  "access": "public"
@@ -73,10 +120,5 @@
73
120
  "node": ">=12.0.0"
74
121
  },
75
122
  "packageManager": "yarn@4.5.0",
76
- "private": false,
77
- "exports": {
78
- ".": {
79
- "import": "./index.js"
80
- }
81
- }
123
+ "juan": 1
82
124
  }
@@ -1,4 +0,0 @@
1
- /**
2
- * Busca y muestra todas las columnas del grid principal
3
- */
4
- export declare const findAllColumns: () => void;
@@ -1,6 +0,0 @@
1
- const n = () => {
2
- cy.get('[class^="M4LDataGrid-root"]').find('[class^="M4LDataGrid-actionsConfigContainer"]').find("button").eq(2).click();
3
- };
4
- export {
5
- n as f
6
- };
@@ -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, };
package/vite-env.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /// <reference types="vite/client" />
2
- /// <reference types="vitest" />
3
- /// <reference types="vitest/globals" />
4
- /// <reference types="vitest/importMeta" />
5
- /// <reference types="cypress" />