@nocobase/test 0.20.0-alpha.15 → 0.20.0-alpha.17
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.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
export { renderHook } from '@testing-library/react-hooks';
|
|
2
3
|
declare function customRender(ui: React.ReactElement, options?: {}): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
|
3
4
|
export * from '@testing-library/react';
|
|
4
5
|
export { default as userEvent } from '@testing-library/user-event';
|
package/lib/client/index.js
CHANGED
|
@@ -30,11 +30,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var client_exports = {};
|
|
31
31
|
__export(client_exports, {
|
|
32
32
|
render: () => customRender,
|
|
33
|
+
renderHook: () => import_react_hooks.renderHook,
|
|
33
34
|
sleep: () => sleep,
|
|
34
35
|
userEvent: () => import_user_event.default
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(client_exports);
|
|
37
38
|
var import_react = require("@testing-library/react");
|
|
39
|
+
var import_react_hooks = require("@testing-library/react-hooks");
|
|
38
40
|
__reExport(client_exports, require("@testing-library/react"), module.exports);
|
|
39
41
|
var import_user_event = __toESM(require("@testing-library/user-event"));
|
|
40
42
|
function customRender(ui, options = {}) {
|
|
@@ -53,6 +55,7 @@ const sleep = /* @__PURE__ */ __name(async (timeout = 0) => {
|
|
|
53
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
54
56
|
0 && (module.exports = {
|
|
55
57
|
render,
|
|
58
|
+
renderHook,
|
|
56
59
|
sleep,
|
|
57
60
|
userEvent,
|
|
58
61
|
...require("@testing-library/react")
|
package/lib/e2e/defineConfig.js
CHANGED
|
@@ -37,7 +37,7 @@ const defineConfig = /* @__PURE__ */ __name((config) => {
|
|
|
37
37
|
// Fail the build on CI if you accidentally left test.only in the source code.
|
|
38
38
|
forbidOnly: !!process.env.CI,
|
|
39
39
|
// Retry on CI only.
|
|
40
|
-
retries:
|
|
40
|
+
retries: 2,
|
|
41
41
|
// Opt out of parallel tests on CI.
|
|
42
42
|
// workers: process.env.CI ? 1 : undefined,
|
|
43
43
|
workers: 1,
|
|
@@ -60,7 +60,14 @@ const defineConfig = /* @__PURE__ */ __name((config) => {
|
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
name: "chromium",
|
|
63
|
-
use: {
|
|
63
|
+
use: {
|
|
64
|
+
...import_test.devices["Desktop Chrome"],
|
|
65
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE,
|
|
66
|
+
contextOptions: {
|
|
67
|
+
// chromium-specific permissions
|
|
68
|
+
permissions: ["clipboard-read", "clipboard-write"]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
64
71
|
dependencies: ["authSetup"]
|
|
65
72
|
}
|
|
66
73
|
]
|
package/lib/e2e/e2eUtils.d.ts
CHANGED
package/lib/e2e/e2eUtils.js
CHANGED
|
@@ -336,7 +336,11 @@ const deleteCollections = /* @__PURE__ */ __name(async (collectionNames) => {
|
|
|
336
336
|
const headers = getHeaders(state);
|
|
337
337
|
const params = collectionNames.map((name) => `filterByTk[]=${name}`).join("&");
|
|
338
338
|
const result = await api.post(`/api/collections:destroy?${params}`, {
|
|
339
|
-
headers
|
|
339
|
+
headers,
|
|
340
|
+
params: {
|
|
341
|
+
// 自动删除依赖于集合的对象(如视图),进而删除依赖于这些对象的所有对象
|
|
342
|
+
cascade: true
|
|
343
|
+
}
|
|
340
344
|
});
|
|
341
345
|
if (!result.ok()) {
|
|
342
346
|
throw new Error(await result.text());
|
|
@@ -48,6 +48,11 @@ interface Resource {
|
|
|
48
48
|
sort: (params?: SortActionParams) => Promise<supertest.Response>;
|
|
49
49
|
[name: string]: (params?: ActionParams) => Promise<supertest.Response>;
|
|
50
50
|
}
|
|
51
|
+
interface ExtendedAgent extends SuperAgentTest {
|
|
52
|
+
login: (user: any) => ExtendedAgent;
|
|
53
|
+
loginUsingId: (userId: number) => ExtendedAgent;
|
|
54
|
+
resource: (name: string, resourceOf?: any) => Resource;
|
|
55
|
+
}
|
|
51
56
|
export declare class MockServer extends Application {
|
|
52
57
|
loadAndInstall(options?: any): Promise<void>;
|
|
53
58
|
cleanDb(): Promise<void>;
|
|
@@ -55,11 +60,7 @@ export declare class MockServer extends Application {
|
|
|
55
60
|
clean?: boolean;
|
|
56
61
|
}): Promise<void>;
|
|
57
62
|
destroy(options?: any): Promise<void>;
|
|
58
|
-
agent():
|
|
59
|
-
login: (user: any) => SuperAgentTest;
|
|
60
|
-
loginUsingId: (userId: number) => SuperAgentTest;
|
|
61
|
-
resource: (name: string, resourceOf?: any) => Resource;
|
|
62
|
-
};
|
|
63
|
+
agent(): ExtendedAgent;
|
|
63
64
|
protected createDatabase(options: ApplicationOptions): import("@nocobase/database").MockDatabase;
|
|
64
65
|
}
|
|
65
66
|
export declare function mockServer(options?: ApplicationOptions): MockServer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/test",
|
|
3
|
-
"version": "0.20.0-alpha.
|
|
3
|
+
"version": "0.20.0-alpha.17",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "./src/index.ts",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -40,9 +40,10 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@faker-js/faker": "8.1.0",
|
|
43
|
-
"@nocobase/server": "0.20.0-alpha.
|
|
43
|
+
"@nocobase/server": "0.20.0-alpha.17",
|
|
44
44
|
"@playwright/test": "^1.42.1",
|
|
45
45
|
"@testing-library/react": "^14.0.0",
|
|
46
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
46
47
|
"@testing-library/user-event": "^14.4.3",
|
|
47
48
|
"@types/supertest": "^2.0.11",
|
|
48
49
|
"@vitejs/plugin-react": "^4.0.0",
|
|
@@ -56,9 +57,9 @@
|
|
|
56
57
|
"sqlite3": "^5.0.8",
|
|
57
58
|
"supertest": "^6.1.6",
|
|
58
59
|
"vite": "^5.0.0",
|
|
59
|
-
"vitest": "^1.
|
|
60
|
+
"vitest": "^1.4.0",
|
|
60
61
|
"vitest-dom": "^0.1.1",
|
|
61
62
|
"ws": "^8.13.0"
|
|
62
63
|
},
|
|
63
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "a2460c222bc0b8a3bcb783b5c856499d756efa82"
|
|
64
65
|
}
|