@nocobase/test 2.1.0-beta.22 → 2.1.0-beta.23
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/lib/client/index.js +4 -2
- package/lib/client/renderAppOptions.js +1 -1
- package/lib/client/renderSettings.js +29 -4
- package/package.json +4 -4
- package/vitest.mjs +5 -2
package/lib/client/index.js
CHANGED
|
@@ -46,7 +46,9 @@ __export(client_exports, {
|
|
|
46
46
|
waitForApp: () => waitForApp
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(client_exports);
|
|
49
|
+
var import_react = __toESM(require("react"));
|
|
49
50
|
var import_react2 = require("@testing-library/react");
|
|
51
|
+
var import_flow_engine = require("@nocobase/flow-engine");
|
|
50
52
|
var import_web = require("../web");
|
|
51
53
|
__reExport(client_exports, require("./utils"), module.exports);
|
|
52
54
|
var import_react_hooks = require("@testing-library/react-hooks");
|
|
@@ -59,9 +61,9 @@ __reExport(client_exports, require("./renderSingleSettings"), module.exports);
|
|
|
59
61
|
__reExport(client_exports, require("./settingsChecker"), module.exports);
|
|
60
62
|
__reExport(client_exports, require("./commonSettingsChecker"), module.exports);
|
|
61
63
|
function customRender(ui, options = {}) {
|
|
64
|
+
const flowEngine = new import_flow_engine.FlowEngine();
|
|
62
65
|
return (0, import_react2.render)(ui, {
|
|
63
|
-
|
|
64
|
-
wrapper: /* @__PURE__ */ __name(({ children }) => children, "wrapper"),
|
|
66
|
+
wrapper: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ import_react.default.createElement(import_flow_engine.FlowEngineProvider, { engine: flowEngine }, children), "wrapper"),
|
|
65
67
|
...options
|
|
66
68
|
});
|
|
67
69
|
}
|
|
@@ -42,8 +42,8 @@ __export(renderAppOptions_exports, {
|
|
|
42
42
|
});
|
|
43
43
|
module.exports = __toCommonJS(renderAppOptions_exports);
|
|
44
44
|
var import_react = __toESM(require("react"));
|
|
45
|
-
var import__ = require(".");
|
|
46
45
|
var import_web = require("../web");
|
|
46
|
+
var import__ = require(".");
|
|
47
47
|
var import_utils = require("./utils");
|
|
48
48
|
const renderAppOptions = /* @__PURE__ */ __name(async (options) => {
|
|
49
49
|
const App = (0, import_web.getAppComponent)(options);
|
|
@@ -35,15 +35,40 @@ module.exports = __toCommonJS(renderSettings_exports);
|
|
|
35
35
|
var import_react = require("@testing-library/react");
|
|
36
36
|
var import_renderAppOptions = require("./renderAppOptions");
|
|
37
37
|
var import_utils = require("./utils");
|
|
38
|
+
const querySettingsButton = /* @__PURE__ */ __name((container) => {
|
|
39
|
+
return container.querySelector('[aria-label^="designer-schema-settings-"]');
|
|
40
|
+
}, "querySettingsButton");
|
|
41
|
+
const querySettingsTrigger = /* @__PURE__ */ __name((container) => {
|
|
42
|
+
const button = querySettingsButton(container);
|
|
43
|
+
if (!button) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return button.closest(".ant-dropdown-trigger") || button;
|
|
47
|
+
}, "querySettingsTrigger");
|
|
48
|
+
const revealSchemaToolbar = /* @__PURE__ */ __name((container) => {
|
|
49
|
+
const blockItem = container.querySelector('[aria-label^="block-item-"]');
|
|
50
|
+
if (!blockItem) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
import_react.fireEvent.mouseEnter(blockItem);
|
|
54
|
+
import_react.fireEvent.mouseOver(blockItem);
|
|
55
|
+
}, "revealSchemaToolbar");
|
|
38
56
|
async function showSettingsMenu(container = document) {
|
|
39
57
|
await (0, import_react.waitFor)(() => {
|
|
40
|
-
|
|
58
|
+
if (!querySettingsButton(container)) {
|
|
59
|
+
revealSchemaToolbar(container);
|
|
60
|
+
}
|
|
61
|
+
return (0, import_utils.expectNoTsError)(querySettingsButton(container)).toBeInTheDocument();
|
|
41
62
|
});
|
|
42
63
|
const button = await (0, import_react.waitFor)(() => {
|
|
43
|
-
|
|
64
|
+
if (!querySettingsButton(container)) {
|
|
65
|
+
revealSchemaToolbar(container);
|
|
66
|
+
}
|
|
67
|
+
return querySettingsButton(container);
|
|
44
68
|
});
|
|
45
|
-
|
|
46
|
-
import_react.fireEvent.
|
|
69
|
+
const trigger = querySettingsTrigger(container) || button;
|
|
70
|
+
import_react.fireEvent.mouseEnter(trigger);
|
|
71
|
+
import_react.fireEvent.mouseOver(trigger);
|
|
47
72
|
await (0, import_react.waitFor)(() => {
|
|
48
73
|
return (0, import_utils.expectNoTsError)(import_react.screen.queryByTestId("schema-settings-menu")).toBeInTheDocument();
|
|
49
74
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/test",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.23",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "./src/index.ts",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@faker-js/faker": "8.1.0",
|
|
54
|
-
"@nocobase/server": "2.1.0-beta.
|
|
55
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
54
|
+
"@nocobase/server": "2.1.0-beta.23",
|
|
55
|
+
"@nocobase/utils": "2.1.0-beta.23",
|
|
56
56
|
"@playwright/test": "^1.45.3",
|
|
57
57
|
"@testing-library/jest-dom": "^6.4.2",
|
|
58
58
|
"@testing-library/react": "^14.0.0",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"vitest-dom": "^0.1.1",
|
|
78
78
|
"ws": "^8.13.0"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "bb4c0d3551bf9eff505b63756dd24a0813231f16"
|
|
81
81
|
}
|
package/vitest.mjs
CHANGED
|
@@ -10,6 +10,7 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
10
10
|
const __dirname = dirname(__filename);
|
|
11
11
|
|
|
12
12
|
const CORE_CLIENT_PACKAGES = ['sdk', 'client', 'client-v2', 'flow-engine'];
|
|
13
|
+
const PLUGIN_CLIENT_PACKAGES = ['client', 'client-v2'];
|
|
13
14
|
// 按路径填写要跳过服务端测试的插件目录(相对仓库根目录)
|
|
14
15
|
const skipPluginPaths = [
|
|
15
16
|
'packages/plugins/@nocobase/plugin-audit-logs',
|
|
@@ -114,7 +115,7 @@ const defineCommonConfig = () => {
|
|
|
114
115
|
function getExclude(isServer) {
|
|
115
116
|
return [
|
|
116
117
|
`packages/core/${isServer ? '' : '!'}(${CORE_CLIENT_PACKAGES.join('|')})/**/*`,
|
|
117
|
-
|
|
118
|
+
...(isServer ? PLUGIN_CLIENT_PACKAGES : ['server']).map((dir) => `packages/**/src/${dir}/**/*`),
|
|
118
119
|
];
|
|
119
120
|
}
|
|
120
121
|
|
|
@@ -220,7 +221,9 @@ export const getFilterInclude = (isServer, isCoverage) => {
|
|
|
220
221
|
|
|
221
222
|
// 插件目录,区分 client 和 server
|
|
222
223
|
return {
|
|
223
|
-
include:
|
|
224
|
+
include: isServer
|
|
225
|
+
? [`${filterFileOrDir}/src/server/${suffix}`]
|
|
226
|
+
: PLUGIN_CLIENT_PACKAGES.map((dir) => `${filterFileOrDir}/src/${dir}/${suffix}`),
|
|
224
227
|
};
|
|
225
228
|
};
|
|
226
229
|
|