@nocobase/test 1.6.21 → 1.6.22
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/es/e2e/e2eUtils.d.ts
CHANGED
|
@@ -161,10 +161,17 @@ export interface PageConfig {
|
|
|
161
161
|
*/
|
|
162
162
|
collections?: CollectionSetting[];
|
|
163
163
|
/**
|
|
164
|
+
* @deprecate 在菜单被重构之后,没有办法直接复制完整的页面 Schema 了。所以这个选项不推荐使用了。
|
|
165
|
+
* 推荐使用 tabSchema,复制一个页面 tab 的 Schema 传给 tabSchema。
|
|
166
|
+
*
|
|
164
167
|
* 页面整体的 Schema
|
|
165
168
|
* @default undefined
|
|
166
169
|
*/
|
|
167
170
|
pageSchema?: any;
|
|
171
|
+
/**
|
|
172
|
+
* 页面 Tab 的 Schema。当 pageSchema 和 tabSchema 都存在时,最终显示的会是 tabSchema 的内容
|
|
173
|
+
*/
|
|
174
|
+
tabSchema?: any;
|
|
168
175
|
/** 如果为 true 则表示不会更改 PageSchema 的 uid */
|
|
169
176
|
keepUid?: boolean;
|
|
170
177
|
/** 在 URL 中的 uid,例如:/admin/0ig6xhe03u2 */
|
package/lib/e2e/e2eUtils.d.ts
CHANGED
|
@@ -161,10 +161,17 @@ export interface PageConfig {
|
|
|
161
161
|
*/
|
|
162
162
|
collections?: CollectionSetting[];
|
|
163
163
|
/**
|
|
164
|
+
* @deprecate 在菜单被重构之后,没有办法直接复制完整的页面 Schema 了。所以这个选项不推荐使用了。
|
|
165
|
+
* 推荐使用 tabSchema,复制一个页面 tab 的 Schema 传给 tabSchema。
|
|
166
|
+
*
|
|
164
167
|
* 页面整体的 Schema
|
|
165
168
|
* @default undefined
|
|
166
169
|
*/
|
|
167
170
|
pageSchema?: any;
|
|
171
|
+
/**
|
|
172
|
+
* 页面 Tab 的 Schema。当 pageSchema 和 tabSchema 都存在时,最终显示的会是 tabSchema 的内容
|
|
173
|
+
*/
|
|
174
|
+
tabSchema?: any;
|
|
168
175
|
/** 如果为 true 则表示不会更改 PageSchema 的 uid */
|
|
169
176
|
keepUid?: boolean;
|
|
170
177
|
/** 在 URL 中的 uid,例如:/admin/0ig6xhe03u2 */
|
package/lib/e2e/e2eUtils.js
CHANGED
|
@@ -76,6 +76,20 @@ function getPageMenuSchema({ pageSchemaUid, tabSchemaUid, tabSchemaName }) {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
__name(getPageMenuSchema, "getPageMenuSchema");
|
|
79
|
+
function getPageMenuSchemaWithTabSchema({ tabSchema }) {
|
|
80
|
+
if (!tabSchema) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
type: "void",
|
|
85
|
+
"x-component": "Page",
|
|
86
|
+
properties: {
|
|
87
|
+
[tabSchema.name]: tabSchema
|
|
88
|
+
},
|
|
89
|
+
"x-uid": (0, import_shared.uid)()
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
__name(getPageMenuSchemaWithTabSchema, "getPageMenuSchemaWithTabSchema");
|
|
79
93
|
const PORT = process.env.APP_PORT || 2e4;
|
|
80
94
|
const APP_BASE_URL = process.env.APP_BASE_URL || `http://localhost:${PORT}`;
|
|
81
95
|
const _NocoPage = class _NocoPage {
|
|
@@ -90,7 +104,7 @@ const _NocoPage = class _NocoPage {
|
|
|
90
104
|
collectionsName;
|
|
91
105
|
_waitForInit;
|
|
92
106
|
async init() {
|
|
93
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
107
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
94
108
|
const waitList = [];
|
|
95
109
|
if ((_b = (_a = this.options) == null ? void 0 : _a.collections) == null ? void 0 : _b.length) {
|
|
96
110
|
const collections = omitSomeFields(this.options.collections);
|
|
@@ -102,16 +116,17 @@ const _NocoPage = class _NocoPage {
|
|
|
102
116
|
type: (_c = this.options) == null ? void 0 : _c.type,
|
|
103
117
|
name: (_d = this.options) == null ? void 0 : _d.name,
|
|
104
118
|
pageSchema: (_e = this.options) == null ? void 0 : _e.pageSchema,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
119
|
+
tabSchema: (_f = this.options) == null ? void 0 : _f.tabSchema,
|
|
120
|
+
url: (_g = this.options) == null ? void 0 : _g.url,
|
|
121
|
+
keepUid: (_h = this.options) == null ? void 0 : _h.keepUid,
|
|
122
|
+
pageUid: (_i = this.options) == null ? void 0 : _i.pageUid
|
|
108
123
|
})
|
|
109
124
|
);
|
|
110
125
|
const result = await Promise.all(waitList);
|
|
111
126
|
const { schemaUid, routeId } = result[result.length - 1] || {};
|
|
112
127
|
this.uid = schemaUid;
|
|
113
128
|
this.desktopRouteId = routeId;
|
|
114
|
-
this.url = `${((
|
|
129
|
+
this.url = `${((_j = this.options) == null ? void 0 : _j.basePath) || "/admin/"}${this.uid || this.desktopRouteId}`;
|
|
115
130
|
}
|
|
116
131
|
async goto() {
|
|
117
132
|
var _a;
|
|
@@ -406,13 +421,14 @@ const updateUidOfPageSchema = /* @__PURE__ */ __name((uiSchema) => {
|
|
|
406
421
|
}, "updateUidOfPageSchema");
|
|
407
422
|
const createPage = /* @__PURE__ */ __name(async (options) => {
|
|
408
423
|
var _a, _b, _c, _d;
|
|
409
|
-
const { type = "page", url, name, pageSchema, keepUid, pageUid: pageUidFromOptions } = options || {};
|
|
424
|
+
const { type = "page", url, name, pageSchema, tabSchema, keepUid, pageUid: pageUidFromOptions } = options || {};
|
|
410
425
|
const api = await import_test.request.newContext({
|
|
411
426
|
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
412
427
|
});
|
|
428
|
+
const schema = getPageMenuSchemaWithTabSchema({ tabSchema }) || pageSchema;
|
|
413
429
|
const state = await api.storageState();
|
|
414
430
|
const headers = getHeaders(state);
|
|
415
|
-
const newPageSchema = keepUid ?
|
|
431
|
+
const newPageSchema = keepUid ? schema : updateUidOfPageSchema(schema);
|
|
416
432
|
const pageSchemaUid = (newPageSchema == null ? void 0 : newPageSchema["x-uid"]) || (0, import_shared.uid)();
|
|
417
433
|
const newTabSchemaUid = (0, import_shared.uid)();
|
|
418
434
|
const newTabSchemaName = (0, import_shared.uid)();
|
|
@@ -30,13 +30,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
31
|
mod
|
|
32
32
|
));
|
|
33
|
-
var import_http = __toESM(require("http"));
|
|
34
|
-
var import_url = __toESM(require("url"));
|
|
35
|
-
var import_pg = __toESM(require("pg"));
|
|
36
33
|
var import_dotenv = __toESM(require("dotenv"));
|
|
37
|
-
var
|
|
38
|
-
var import_promise = __toESM(require("mysql2/promise"));
|
|
34
|
+
var import_http = __toESM(require("http"));
|
|
39
35
|
var import_mariadb = __toESM(require("mariadb"));
|
|
36
|
+
var import_promise = __toESM(require("mysql2/promise"));
|
|
37
|
+
var import_path = __toESM(require("path"));
|
|
38
|
+
var import_pg = __toESM(require("pg"));
|
|
39
|
+
var import_url = __toESM(require("url"));
|
|
40
40
|
import_dotenv.default.config({ path: import_path.default.resolve(process.cwd(), ".env.test") });
|
|
41
41
|
const _BaseClient = class _BaseClient {
|
|
42
42
|
_client = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/test",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.22",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "./src/index.ts",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@faker-js/faker": "8.1.0",
|
|
54
|
-
"@nocobase/server": "1.6.
|
|
54
|
+
"@nocobase/server": "1.6.22",
|
|
55
55
|
"@playwright/test": "^1.45.3",
|
|
56
56
|
"@testing-library/jest-dom": "^6.4.2",
|
|
57
57
|
"@testing-library/react": "^14.0.0",
|
|
@@ -69,12 +69,11 @@
|
|
|
69
69
|
"mysql2": "^3.11.0",
|
|
70
70
|
"pg": "^8.7.3",
|
|
71
71
|
"pg-hstore": "^2.3.4",
|
|
72
|
-
"sqlite3": "^5.0.8",
|
|
73
72
|
"supertest": "^6.1.6",
|
|
74
73
|
"vite": "^5.0.0",
|
|
75
74
|
"vitest": "^1.5.0",
|
|
76
75
|
"vitest-dom": "^0.1.1",
|
|
77
76
|
"ws": "^8.13.0"
|
|
78
77
|
},
|
|
79
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "321c0effa18670c0c3edfa09c79d535351ef2b0d"
|
|
80
79
|
}
|