@nocobase/test 0.21.0-alpha.3 → 0.21.0-alpha.4

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.
@@ -235,6 +235,10 @@ interface ExtendUtils {
235
235
  * @param key 外部数据源key
236
236
  */
237
237
  destoryExternalDataSource: <T = any>(key: string) => Promise<T>;
238
+ /**
239
+ * 清空区块模板
240
+ */
241
+ clearBlockTemplates: () => Promise<void>;
238
242
  }
239
243
  export declare class NocoPage {
240
244
  private options?;
package/es/e2e/index.mjs CHANGED
@@ -235,6 +235,29 @@ const _test = test$2.extend({
235
235
  return destoryExternalDataSource(key);
236
236
  };
237
237
  await use(destoryDataSource);
238
+ },
239
+ clearBlockTemplates: async ({ page }, use) => {
240
+ const clearBlockTemplates = async () => {
241
+ const api = await request.newContext({
242
+ storageState: process.env.PLAYWRIGHT_AUTH_FILE
243
+ });
244
+ const state = await api.storageState();
245
+ const headers = getHeaders(state);
246
+ const filter = {
247
+ key: { $exists: true }
248
+ };
249
+ const result = await api.post(`/api/uiSchemaTemplates:destroy?filter=${JSON.stringify(filter)}`, {
250
+ headers
251
+ });
252
+ if (!result.ok()) {
253
+ throw new Error(await result.text());
254
+ }
255
+ };
256
+ try {
257
+ await use(clearBlockTemplates);
258
+ } catch (error) {
259
+ await clearBlockTemplates();
260
+ }
238
261
  }
239
262
  });
240
263
  const test = Object.assign(_test, {
@@ -235,6 +235,10 @@ interface ExtendUtils {
235
235
  * @param key 外部数据源key
236
236
  */
237
237
  destoryExternalDataSource: <T = any>(key: string) => Promise<T>;
238
+ /**
239
+ * 清空区块模板
240
+ */
241
+ clearBlockTemplates: () => Promise<void>;
238
242
  }
239
243
  export declare class NocoPage {
240
244
  private options?;
@@ -231,6 +231,29 @@ const _test = import_test.test.extend({
231
231
  return destoryExternalDataSource(key);
232
232
  }, "destoryDataSource");
233
233
  await use(destoryDataSource);
234
+ },
235
+ clearBlockTemplates: async ({ page }, use) => {
236
+ const clearBlockTemplates = /* @__PURE__ */ __name(async () => {
237
+ const api = await import_test.request.newContext({
238
+ storageState: process.env.PLAYWRIGHT_AUTH_FILE
239
+ });
240
+ const state = await api.storageState();
241
+ const headers = getHeaders(state);
242
+ const filter = {
243
+ key: { $exists: true }
244
+ };
245
+ const result = await api.post(`/api/uiSchemaTemplates:destroy?filter=${JSON.stringify(filter)}`, {
246
+ headers
247
+ });
248
+ if (!result.ok()) {
249
+ throw new Error(await result.text());
250
+ }
251
+ }, "clearBlockTemplates");
252
+ try {
253
+ await use(clearBlockTemplates);
254
+ } catch (error) {
255
+ await clearBlockTemplates();
256
+ }
234
257
  }
235
258
  });
236
259
  const test = Object.assign(_test, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/test",
3
- "version": "0.21.0-alpha.3",
3
+ "version": "0.21.0-alpha.4",
4
4
  "main": "lib/index.js",
5
5
  "module": "./src/index.ts",
6
6
  "types": "./lib/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@faker-js/faker": "8.1.0",
44
- "@nocobase/server": "0.21.0-alpha.3",
44
+ "@nocobase/server": "0.21.0-alpha.4",
45
45
  "@playwright/test": "^1.42.1",
46
46
  "@testing-library/jest-dom": "^6.4.2",
47
47
  "@testing-library/react": "^14.0.0",
@@ -65,5 +65,5 @@
65
65
  "vitest-dom": "^0.1.1",
66
66
  "ws": "^8.13.0"
67
67
  },
68
- "gitHead": "f7276aff14063a2cf825191a0c83aeacde05a912"
68
+ "gitHead": "1ea598dce7d388e5e891753c8341dbfdbe220f34"
69
69
  }