@tachybase/test 0.23.41 → 0.23.47
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/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { uid } from "@tachybase/schema";
|
|
1
2
|
import "@faker-js/faker";
|
|
2
|
-
import { uid } from "@formily/shared";
|
|
3
3
|
import { defineConfig as defineConfig$1, devices, test as test$2, request, expect } from "@playwright/test";
|
|
4
4
|
export * from "@playwright/test";
|
|
5
5
|
import _ from "lodash";
|
|
@@ -61,10 +61,6 @@ class NocoPage {
|
|
|
61
61
|
this.page = page;
|
|
62
62
|
this._waitForInit = this.init();
|
|
63
63
|
}
|
|
64
|
-
url;
|
|
65
|
-
uid;
|
|
66
|
-
collectionsName;
|
|
67
|
-
_waitForInit;
|
|
68
64
|
async init() {
|
|
69
65
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
70
66
|
if ((_b = (_a = this.options) == null ? void 0 : _a.collections) == null ? void 0 : _b.length) {
|
|
@@ -265,7 +261,7 @@ const _test = test$2.extend({
|
|
|
265
261
|
});
|
|
266
262
|
const test = Object.assign(_test, {
|
|
267
263
|
/** 只运行在 postgres 数据库中 */
|
|
268
|
-
pgOnly: process.env.DB_DIALECT
|
|
264
|
+
pgOnly: process.env.DB_DIALECT === "postgres" ? _test : _test.skip
|
|
269
265
|
});
|
|
270
266
|
const getStorageItem = (key, storageState) => {
|
|
271
267
|
var _a, _b;
|
package/lib/e2e/e2eUtils.js
CHANGED
|
@@ -38,8 +38,8 @@ __export(e2eUtils_exports, {
|
|
|
38
38
|
test: () => test
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(e2eUtils_exports);
|
|
41
|
+
var import_schema = require("@tachybase/schema");
|
|
41
42
|
var import_faker = require("@faker-js/faker");
|
|
42
|
-
var import_shared = require("@formily/shared");
|
|
43
43
|
var import_test = require("@playwright/test");
|
|
44
44
|
var import_lodash = __toESM(require("lodash"));
|
|
45
45
|
var import_defineConfig = require("./defineConfig");
|
|
@@ -52,10 +52,6 @@ const _NocoPage = class _NocoPage {
|
|
|
52
52
|
this.page = page;
|
|
53
53
|
this._waitForInit = this.init();
|
|
54
54
|
}
|
|
55
|
-
url;
|
|
56
|
-
uid;
|
|
57
|
-
collectionsName;
|
|
58
|
-
_waitForInit;
|
|
59
55
|
async init() {
|
|
60
56
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
61
57
|
if ((_b = (_a = this.options) == null ? void 0 : _a.collections) == null ? void 0 : _b.length) {
|
|
@@ -258,7 +254,7 @@ const _test = import_test.test.extend({
|
|
|
258
254
|
});
|
|
259
255
|
const test = Object.assign(_test, {
|
|
260
256
|
/** 只运行在 postgres 数据库中 */
|
|
261
|
-
pgOnly: process.env.DB_DIALECT
|
|
257
|
+
pgOnly: process.env.DB_DIALECT === "postgres" ? _test : _test.skip
|
|
262
258
|
});
|
|
263
259
|
const getStorageItem = /* @__PURE__ */ __name((key, storageState) => {
|
|
264
260
|
var _a, _b;
|
|
@@ -269,7 +265,7 @@ const updateUidOfPageSchema = /* @__PURE__ */ __name((uiSchema) => {
|
|
|
269
265
|
return;
|
|
270
266
|
}
|
|
271
267
|
if (uiSchema["x-uid"]) {
|
|
272
|
-
uiSchema["x-uid"] = (0,
|
|
268
|
+
uiSchema["x-uid"] = (0, import_schema.uid)();
|
|
273
269
|
}
|
|
274
270
|
if (uiSchema.properties) {
|
|
275
271
|
Object.keys(uiSchema.properties).forEach((key) => {
|
|
@@ -301,8 +297,8 @@ const createPage = /* @__PURE__ */ __name(async (options) => {
|
|
|
301
297
|
};
|
|
302
298
|
const state = await api.storageState();
|
|
303
299
|
const headers = getHeaders(state);
|
|
304
|
-
const pageUid = (0,
|
|
305
|
-
const gridName = (0,
|
|
300
|
+
const pageUid = (0, import_schema.uid)();
|
|
301
|
+
const gridName = (0, import_schema.uid)();
|
|
306
302
|
const result = await api.post(`/api/uiSchemas:insertAdjacent/default-admin-menu?position=beforeEnd`, {
|
|
307
303
|
headers,
|
|
308
304
|
data: {
|
|
@@ -331,15 +327,15 @@ const createPage = /* @__PURE__ */ __name(async (options) => {
|
|
|
331
327
|
type: "void",
|
|
332
328
|
"x-component": "Grid",
|
|
333
329
|
"x-initializer": "page:addBlock",
|
|
334
|
-
"x-uid": (0,
|
|
330
|
+
"x-uid": (0, import_schema.uid)(),
|
|
335
331
|
name: gridName
|
|
336
332
|
}
|
|
337
333
|
},
|
|
338
|
-
"x-uid": (0,
|
|
334
|
+
"x-uid": (0, import_schema.uid)(),
|
|
339
335
|
name: "page"
|
|
340
336
|
}
|
|
341
337
|
},
|
|
342
|
-
name: (0,
|
|
338
|
+
name: (0, import_schema.uid)(),
|
|
343
339
|
"x-uid": pageUid
|
|
344
340
|
},
|
|
345
341
|
wrap: null
|
|
@@ -424,7 +420,7 @@ const createRole = /* @__PURE__ */ __name(async (roleSetting) => {
|
|
|
424
420
|
});
|
|
425
421
|
const state = await api.storageState();
|
|
426
422
|
const headers = getHeaders(state);
|
|
427
|
-
const name = roleSetting.name || (0,
|
|
423
|
+
const name = roleSetting.name || (0, import_schema.uid)();
|
|
428
424
|
const result = await api.post(`/api/users/1/roles:create`, {
|
|
429
425
|
headers,
|
|
430
426
|
data: { ...roleSetting, name, title: name }
|
|
@@ -30,8 +30,10 @@ var import_promise = __toESM(require("mysql2/promise"));
|
|
|
30
30
|
var import_pg = __toESM(require("pg"));
|
|
31
31
|
import_dotenv.default.config({ path: import_path.default.resolve(process.cwd(), ".env.test") });
|
|
32
32
|
const _BaseClient = class _BaseClient {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
constructor() {
|
|
34
|
+
this._client = null;
|
|
35
|
+
this.createdDBs = /* @__PURE__ */ new Set();
|
|
36
|
+
}
|
|
35
37
|
async createDB(name) {
|
|
36
38
|
if (this.createdDBs.has(name)) {
|
|
37
39
|
return;
|
|
@@ -30,7 +30,9 @@ var import_pg = __toESM(require("pg"));
|
|
|
30
30
|
import_dotenv.default.config({ path: import_path.default.resolve(process.cwd(), ".env.test") });
|
|
31
31
|
const delay = /* @__PURE__ */ __name((ms) => new Promise((resolve) => setTimeout(resolve, ms)), "delay");
|
|
32
32
|
const _DBManager = class _DBManager {
|
|
33
|
-
|
|
33
|
+
constructor() {
|
|
34
|
+
this.acquiredDBs = /* @__PURE__ */ new Map();
|
|
35
|
+
}
|
|
34
36
|
acquire(name, via) {
|
|
35
37
|
console.log("acquire", name, "via", via);
|
|
36
38
|
if (this.acquiredDBs.has(name)) {
|
|
@@ -76,8 +78,8 @@ const getDBNames = /* @__PURE__ */ __name((size, name) => {
|
|
|
76
78
|
const _BasePool = class _BasePool {
|
|
77
79
|
constructor(size) {
|
|
78
80
|
this.size = size;
|
|
81
|
+
this.dbManager = new DBManager();
|
|
79
82
|
}
|
|
80
|
-
dbManager = new DBManager();
|
|
81
83
|
async init() {
|
|
82
84
|
const promises = [];
|
|
83
85
|
for (const name of getDBNames(this.size, this.getConfiguredDatabaseName())) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/test",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.47",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -41,11 +41,10 @@
|
|
|
41
41
|
"types": "./lib/index.d.ts",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@faker-js/faker": "8.4.1",
|
|
44
|
-
"@formily/shared": "2.3.2",
|
|
45
44
|
"@playwright/test": "^1.49.1",
|
|
46
|
-
"@testing-library/dom": "^
|
|
45
|
+
"@testing-library/dom": "^10.4.0",
|
|
47
46
|
"@testing-library/jest-dom": "^6.6.3",
|
|
48
|
-
"@testing-library/react": "^
|
|
47
|
+
"@testing-library/react": "^16.2.0",
|
|
49
48
|
"@testing-library/user-event": "^14.5.2",
|
|
50
49
|
"@types/supertest": "^2.0.16",
|
|
51
50
|
"@vitejs/plugin-react": "^4.3.4",
|
|
@@ -63,10 +62,11 @@
|
|
|
63
62
|
"sqlite3": "^5.1.7",
|
|
64
63
|
"supertest": "^6.3.4",
|
|
65
64
|
"vite": "^5.4.11",
|
|
66
|
-
"vitest": "^
|
|
65
|
+
"vitest": "^3.0.5",
|
|
67
66
|
"ws": "^8.18.0",
|
|
68
|
-
"@tachybase/database": "0.23.
|
|
69
|
-
"@tachybase/server": "0.23.
|
|
67
|
+
"@tachybase/database": "0.23.47",
|
|
68
|
+
"@tachybase/server": "0.23.47",
|
|
69
|
+
"@tachybase/schema": "0.23.47"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tachybase-build --no-dts @tachybase/test"
|
package/vitest.mjs
CHANGED
|
@@ -66,7 +66,7 @@ export const defineConfig = (config = {}) => {
|
|
|
66
66
|
'**/e2e/**',
|
|
67
67
|
'**/__e2e__/**',
|
|
68
68
|
'**/{vitest,commitlint}.config.*',
|
|
69
|
-
'packages/**/{sdk,client}/**/__tests__/**/*.{test,spec}.{ts,tsx}',
|
|
69
|
+
'packages/**/{sdk,client,schema}/**/__tests__/**/*.{test,spec}.{ts,tsx}',
|
|
70
70
|
],
|
|
71
71
|
testTimeout: 300000,
|
|
72
72
|
hookTimeout: 300000,
|
|
@@ -95,7 +95,7 @@ export const defineConfig = (config = {}) => {
|
|
|
95
95
|
environment: 'jsdom',
|
|
96
96
|
css: false,
|
|
97
97
|
alias: tsConfigPathsToAlias(),
|
|
98
|
-
include: ['packages/**/{sdk,client}/**/__tests__/**/*.{test,spec}.{ts,tsx}'],
|
|
98
|
+
include: ['packages/**/{sdk,client,schema}/**/__tests__/**/*.{test,spec}.{ts,tsx}'],
|
|
99
99
|
exclude: [
|
|
100
100
|
'**/node_modules/**',
|
|
101
101
|
'**/dist/**',
|