test: make testing more stable

This commit is contained in:
Zeke Zhang 2023-12-07 07:50:59 +08:00
parent 0e29407aec
commit 78b7badeb6
3 changed files with 20 additions and 4 deletions

View File

@ -4,7 +4,11 @@ import { twoTableWithRelationalFields, twoTableWithSameCollection } from './temp
test.describe('connect data blocks: table block', () => {
test('connections between same collections', async ({ page, mockPage, mockRecords }) => {
const nocoPage = await mockPage(twoTableWithSameCollection).waitForInit();
const records = await mockRecords('users', 3);
const records = await mockRecords('users', [
{ email: 'aaaaa@gmail.com' },
{ email: 'bbbbb@gmail.com' },
{ email: 'ccccc@gmail.com' },
]);
await nocoPage.goto();
// 将左边的 Table 连接到右边的 Table
@ -23,7 +27,11 @@ test.describe('connect data blocks: table block', () => {
test('connecting via Relational Fields', async ({ page, mockPage, mockRecords }) => {
const nocoPage = await mockPage(twoTableWithRelationalFields).waitForInit();
const records = await mockRecords('users', 3);
await mockRecords('users', [
{ email: 'aaaaa@gmail.com' },
{ email: 'bbbbb@gmail.com' },
{ email: 'ccccc@gmail.com' },
]);
await nocoPage.goto();
// 将左边的 Table 连接到右边的 Table

View File

@ -3,7 +3,11 @@ import { commonTesting, testDefaultValue, testPattern } from '../commonTesting';
const gotoPage = async (mockPage, mockRecords) => {
const nocoPage = await mockPage(oneTableBlockWithAddNewAndViewAndEditAndRelationFields).waitForInit();
await mockRecords('users', 3);
await mockRecords('users', [
{ email: 'aaaaa@gmail.com' },
{ email: 'bbbbb@gmail.com' },
{ email: 'ccccc@gmail.com' },
]);
await nocoPage.goto();
};

View File

@ -3,7 +3,11 @@ import { commonTesting, testPattern } from '../commonTesting';
const gotoPage = async (mockPage, mockRecords) => {
const nocoPage = await mockPage(oneTableBlockWithAddNewAndViewAndEditAndRelationFields).waitForInit();
await mockRecords('users', 3);
await mockRecords('users', [
{ email: 'aaaaa@gmail.com' },
{ email: 'bbbbb@gmail.com' },
{ email: 'ccccc@gmail.com' },
]);
const record = (await mockRecords('general', 1))[0];
await nocoPage.goto();