diff --git a/packages/core/test/src/client/e2eUtils.ts b/packages/core/test/src/client/e2eUtils.ts index 33b3bf798..54f7e8df8 100644 --- a/packages/core/test/src/client/e2eUtils.ts +++ b/packages/core/test/src/client/e2eUtils.ts @@ -173,7 +173,18 @@ const _test = base.extend<{ mockCollections: (collectionSettings: CollectionSetting[]) => Promise; mockCollection: (collectionSetting: CollectionSetting) => Promise; mockRecord: (collectionName: string, data?: any) => Promise; - mockRecords: (collectionName: string, count?: number, data?: any) => Promise; + mockRecords: { + /** + * @param collectionName - 数据表名称 + * @param count - 生成的数据条数 + */ + (collectionName: string, count?: number): Promise; + /** + * @param collectionName - 数据表名称 + * @param data - 指定生成的数据 + */ + (collectionName: string, data?: any[]): Promise; + }; createCollections: (collectionSettings: CollectionSetting | CollectionSetting[]) => Promise; }>({ mockPage: async ({ page }, use) => { @@ -242,7 +253,11 @@ const _test = base.extend<{ } }, mockRecords: async ({ page }, use) => { - const mockRecords = async (collectionName: string, count = 3, data?: any) => { + const mockRecords = async (collectionName: string, count: any = 3, data?: any) => { + if (_.isArray(count)) { + data = count; + count = data.length; + } return createRandomData(collectionName, count, data); };