test: fix e2e

This commit is contained in:
Zeke Zhang 2024-04-10 12:29:35 +08:00
parent f12952de1f
commit 3dcbdf3592
2 changed files with 26 additions and 10 deletions

View File

@ -3,8 +3,10 @@ import { T3924 } from './templatesOfBug';
test.describe('bulk edit form', () => {
// https://nocobase.height.app/T-3924/description
test('should be required when switching to "Changed to"', async ({ page, mockPage }) => {
await mockPage(T3924).goto();
test('should be required when switching to "Changed to"', async ({ page, mockPage, mockRecord }) => {
const nocoPage = await mockPage(T3924).waitForInit();
await mockRecord('users2');
await nocoPage.goto();
// 1. 先选中一条记录
await page.getByLabel('table-index-').hover();
@ -23,11 +25,13 @@ test.describe('bulk edit form', () => {
await page.getByRole('button', { name: 'Submit' }).click();
// 4. Table 中的值应该被改变
await expect(page.getByRole('button', { name: '123' })).toBeVisible();
await expect(page.getByRole('button', { name: '123', exact: true })).toBeVisible();
});
test('should be success to submit', async ({ page, mockPage }) => {
await mockPage(T3924).goto();
test('should be success to submit', async ({ page, mockPage, mockRecord }) => {
const nocoPage = await mockPage(T3924).waitForInit();
await mockRecord('users2');
await nocoPage.goto();
// 1. 打开弹窗,显示出批量编辑表单
await page.getByLabel('action-Action-Bulk edit-').click();

View File

@ -699,6 +699,18 @@ export const T3825: PageConfig = {
};
export const T3924: PageConfig = {
collections: [
{
name: 'users2',
fields: [
{
name: 'nickname',
title: 'Nickname',
interface: 'input',
},
],
},
],
pageSchema: {
_isJSONSchemaObject: true,
version: '2.0',
@ -733,10 +745,10 @@ export const T3924: PageConfig = {
version: '2.0',
type: 'void',
'x-decorator': 'TableBlockProvider',
'x-acl-action': 'users:list',
'x-acl-action': 'users2:list',
'x-use-decorator-props': 'useTableBlockDecoratorProps',
'x-decorator-props': {
collection: 'users',
collection: 'users2',
dataSource: 'main',
action: 'list',
params: {
@ -851,11 +863,11 @@ export const T3924: PageConfig = {
'x-acl-action-props': {
skipScopeCheck: true,
},
'x-acl-action': 'users:create',
'x-acl-action': 'users2:create',
'x-decorator': 'FormBlockProvider',
'x-decorator-props': {
dataSource: 'main',
collection: 'users',
collection: 'users2',
},
'x-toolbar': 'BlockSchemaToolbar',
'x-settings': 'blockSettings:createForm',
@ -902,7 +914,7 @@ export const T3924: PageConfig = {
'fieldSettings:BulkEditFormItem',
'x-component': 'BulkEditField',
'x-decorator': 'FormItem',
'x-collection-field': 'users.nickname',
'x-collection-field': 'users2.nickname',
'x-app-version': '0.21.0-alpha.6',
'x-uid': 't8dfuwjgiqb',
'x-async': false,