import * as __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__ from "@tachybase/test/e2e";
__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('table block schema settings', ()=>{
    (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneTableBlockWithAddNewAndViewAndEditAndBasicFields).goto();
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
            page,
            showMenu: ()=>showSettingsMenu(page),
            supportedOptions: [
                'Edit block title',
                'Enable drag and drop sorting',
                'Fix block',
                'Set the data scope',
                'Records per page',
                'Connect data blocks',
                'Save as template',
                'Delete'
            ]
        });
    });
    (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('fix block', async (param)=>{
        let { page, mockPage } = param;
        await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneTableBlockWithAddNewAndViewAndEditAndBasicFields).goto();
        const tableSize = await page.getByLabel('block-item-CardItem-general-table').boundingBox();
        await showSettingsMenu(page);
        await page.getByRole('menuitem', {
            name: 'Fix block'
        }).click();
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('menuitem', {
            name: 'Fix block'
        }).getByRole('switch')).toBeChecked();
        await page.waitForTimeout(1000);
        const fixedTableSize = await page.getByLabel('block-item-CardItem-general-table').boundingBox();
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(fixedTableSize.height).toBeGreaterThan(570);
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(fixedTableSize.height).toBeLessThan(575);
        await page.getByRole('menuitem', {
            name: 'Fix block'
        }).click();
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('menuitem', {
            name: 'Fix block'
        }).getByRole('switch')).not.toBeChecked();
        await page.waitForTimeout(100);
        const unfixedTableSize = await page.getByLabel('block-item-CardItem-general-table').boundingBox();
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(unfixedTableSize.height).toBe(tableSize.height);
    });
    (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('records per page', async (param)=>{
        let { page, mockPage, mockRecords } = param;
        const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneTableBlockWithAddNewAndViewAndEditAndBasicFields).waitForInit();
        await mockRecords('general', 40);
        await nocoPage.goto();
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('row')).toHaveCount(21);
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.locator('.ant-pagination')).toHaveText('Total 40 items1220 / page');
        await showSettingsMenu(page);
        await page.getByRole('menuitem', {
            name: 'Records per page'
        }).click();
        await page.getByRole('option', {
            name: '10',
            exact: true
        }).click();
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('row')).toHaveCount(11);
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.locator('.ant-pagination')).toHaveText('Total 40 items123410 / page');
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('enable drag and drop sorting', ()=>{
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe.configure({
            retries: process.env.CI ? 4 : 0
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('enable drag and drop sorting', async (param)=>{
            let { page, mockPage, mockRecords } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneTableBlockWithAddNewAndViewAndEditAndBasicFields).waitForInit();
            const records = await mockRecords('general', 3);
            await nocoPage.goto();
            await page.getByLabel('block-item-CardItem-general-table').hover();
            await page.getByLabel('designer-schema-settings-CardItem-TableBlockDesigner-general').hover();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('menuitem', {
                name: 'Enable drag and drop sorting'
            }).getByRole('switch')).not.toBeChecked();
            await page.getByRole('menuitem', {
                name: 'Enable drag and drop sorting'
            }).click();
            await page.getByText('Drag and drop sorting field').click();
            await page.getByText('sort', {
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('menuitem', {
                name: 'Enable drag and drop sorting'
            }).getByRole('switch')).toBeChecked();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('menuitem', {
                name: 'Set default sorting rules'
            })).toBeHidden();
            await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover();
            await page.getByRole('menuitem', {
                name: 'email'
            }).click();
            await page.getByRole('menuitem', {
                name: 'ID',
                exact: true
            }).click();
            await page.getByLabel('schema-initializer-TableV2-').click();
            await page.mouse.move(300, 0);
            let email1 = await page.getByText(records[0].email).boundingBox();
            let email2 = await page.getByText(records[1].email).boundingBox();
            let email3 = await page.getByText(records[2].email).boundingBox();
            (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(email1.y).toBeLessThan(email2.y);
            (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(email2.y).toBeLessThan(email3.y);
            await page.getByLabel('table-index-2').getByRole('img', {
                name: 'menu'
            }).dragTo(page.getByLabel('table-index-1').getByRole('img', {
                name: 'menu'
            }));
            await page.reload();
            email1 = await page.getByText(records[0].email).boundingBox();
            email2 = await page.getByText(records[1].email).boundingBox();
            email3 = await page.getByText(records[2].email).boundingBox();
            (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(email2.y).toBeLessThan(email1.y);
            (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(email1.y).toBeLessThan(email3.y);
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('set the data scope', ()=>{
        async function showDialog(page) {
            await page.getByLabel('block-item-CardItem-general-table').hover();
            await page.getByLabel('designer-schema-settings-CardItem-TableBlockDesigner-general').hover();
            await page.getByRole('menuitem', {
                name: 'Set the data scope'
            }).click();
        }
        async function createColumnItem(page, fieldName) {
            await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover();
            await page.getByRole('menuitem', {
                name: fieldName,
                exact: true
            }).click();
            await page.mouse.move(300, 0);
        }
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('use constants', async (param)=>{
            let { page, mockRecords, mockPage } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneTableBlockWithActionsAndFormBlocks).waitForInit();
            await mockRecords('general', 3);
            await nocoPage.goto();
            await createColumnItem(page, 'ID');
            await showDialog(page);
            await page.getByText('Add condition', {
                exact: true
            }).click();
            await page.getByTestId('select-filter-field').click();
            await page.getByRole('menuitemcheckbox', {
                name: 'ID',
                exact: true
            }).click();
            await page.getByRole('spinbutton').click();
            await page.getByRole('spinbutton').fill('1');
            await page.getByRole('button', {
                name: 'OK',
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('row')).toHaveCount(2);
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('cell', {
                name: '1',
                exact: true
            })).toBeVisible();
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('use variable called current user', async (param)=>{
            let { page, mockPage, mockRecords } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneTableBlockWithActionsAndFormBlocks).waitForInit();
            await mockRecords('general', [
                {
                    singleLineText: 'Super Admin'
                },
                {},
                {}
            ]);
            await nocoPage.goto();
            await createColumnItem(page, 'singleLineText');
            await showDialog(page);
            await page.getByText('Add condition', {
                exact: true
            }).click();
            await page.getByTestId('select-filter-field').click();
            await page.getByRole('menuitemcheckbox', {
                name: 'singleLineText'
            }).click();
            await page.getByLabel('variable-button').click();
            await page.getByRole('menuitemcheckbox', {
                name: 'Current user'
            }).click();
            await page.getByRole('menuitemcheckbox', {
                name: 'Nickname'
            }).click();
            await page.getByRole('button', {
                name: 'OK',
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('row')).toHaveCount(2);
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('cell', {
                name: 'Super Admin',
                exact: true
            })).toBeVisible();
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('set default sorting rules', ()=>{
        __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe.configure({
            retries: process.env.CI ? 4 : 0
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('set default sorting rules', async (param)=>{
            let { page, mockPage, mockRecords } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneTableBlockWithAddNewAndViewAndEditAndBasicFields).waitForInit();
            const records = await mockRecords('general', 3);
            await nocoPage.goto();
            await page.getByLabel('block-item-CardItem-general-table').hover();
            await page.getByLabel('designer-schema-settings-CardItem-TableBlockDesigner-general').hover();
            await page.getByRole('menuitem', {
                name: 'Set default sorting rules'
            }).click();
            await page.getByRole('button', {
                name: 'plus Add sort field'
            }).click();
            await page.getByTestId('select-single').click();
            await page.getByRole('option', {
                name: 'ID',
                exact: true
            }).click();
            await page.getByText('DESC', {
                exact: true
            }).click();
            await page.getByRole('button', {
                name: 'OK',
                exact: true
            }).click();
            await page.getByLabel('schema-initializer-TableV2-table:configureColumns-general').hover();
            await page.getByRole('menuitem', {
                name: 'email'
            }).click();
            await page.getByRole('menuitem', {
                name: 'ID',
                exact: true
            }).click();
            await page.mouse.move(300, 0);
            const email1 = await page.getByText(records[0].email).boundingBox();
            const email2 = await page.getByText(records[1].email).boundingBox();
            const email3 = await page.getByText(records[2].email).boundingBox();
            (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(email3.y).toBeLessThan(email2.y);
            (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(email2.y).toBeLessThan(email1.y);
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('connect data blocks', ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('connecting two blocks of the same collection', async (param)=>{
            let { page, mockPage, mockRecords } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.twoTableWithSameCollection).waitForInit();
            const records = await mockRecords('users', 3);
            await nocoPage.goto();
            await page.getByLabel('block-item-CardItem-users-table').first().hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-CardItem-TableBlockDesigner-users'
            }).hover();
            await page.getByRole('menuitem', {
                name: 'Connect data blocks'
            }).hover();
            await page.getByRole('menuitem', {
                name: 'Users'
            }).click();
            await page.getByLabel('block-item-CardItem-users-table').nth(0).getByText('Super Admin').click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-users-table').nth(1).getByText(records[0].nickname)).toBeHidden();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-users-table').nth(1).getByText(records[1].nickname)).toBeHidden();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-users-table').nth(1).getByText(records[2].nickname)).toBeHidden();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-users-table').nth(1).getByText('Super Admin')).toBeVisible();
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('connecting two blocks connected by a relationship field', async (param)=>{
            let { page, mockPage, mockRecords } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.twoTableWithAssociationFields).waitForInit();
            await mockRecords('users', 3);
            await nocoPage.goto();
            await page.getByLabel('block-item-CardItem-roles-table').hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-CardItem-TableBlockDesigner-roles'
            }).hover();
            await page.getByRole('menuitem', {
                name: 'Connect data blocks'
            }).hover();
            await page.getByRole('menuitem', {
                name: 'Users'
            }).click();
            await page.getByRole('option', {
                name: 'Roles'
            }).click();
            await page.getByLabel('block-item-CardItem-roles-table').getByRole('cell', {
                name: 'Root',
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-users-table').getByRole('row').filter({
                hasNotText: 'Root'
            })).toHaveCount(1, {
                timeout: 10000
            });
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-users-table').getByRole('row', {
                name: 'Root'
            })).toBeVisible();
            await page.getByLabel('block-item-CardItem-roles-table').getByRole('cell', {
                name: 'Root',
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-users-table').getByRole('row').filter({
                hasNotText: 'Root'
            })).toHaveCount(4, {
                timeout: 10000
            });
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-users-table').getByRole('row', {
                name: 'Root'
            })).toBeVisible();
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('connecting two blocks connected by a foreign key', async (param)=>{
            let { page, mockPage, mockRecords } = param;
        });
    });
});
__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('actions schema settings', ()=>{
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('add new', ()=>{
        const showMenu = async (page)=>{
            await page.getByRole('button', {
                name: 'Add new'
            }).hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-Action-Action.Designer-general'
            }).hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).goto();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Open mode',
                    'Popup size',
                    'Delete'
                ]
            });
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('edit button', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).goto();
            await showMenu(page);
            await page.getByRole('menuitem', {
                name: 'Edit button'
            }).click();
            await page.getByLabel('block-item-Input-general-Button title').getByRole('textbox').click();
            await page.getByLabel('block-item-Input-general-Button title').getByRole('textbox').fill('1234');
            await page.getByRole('button', {
                name: 'OK',
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('button', {
                name: '1234'
            })).toBeVisible();
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('open mode', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).goto();
            await showMenu(page);
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('menuitem', {
                name: 'Open mode'
            }).getByText('Drawer')).toBeVisible();
            await page.getByRole('menuitem', {
                name: 'Open mode'
            }).click();
            await page.getByRole('option', {
                name: 'Dialog'
            }).click();
            await page.getByRole('button', {
                name: 'Add new'
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByTestId('modal-Action.Container-general-Add record')).toBeVisible();
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('popup size', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            var _this, _this1;
            await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).goto();
            await showMenu(page);
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('menuitem', {
                name: 'Popup size'
            }).getByText('Middle')).toBeVisible();
            await page.getByRole('menuitem', {
                name: 'Popup size'
            }).click();
            await page.getByRole('option', {
                name: 'Small'
            }).click();
            await page.getByRole('button', {
                name: 'Add new'
            }).click();
            const drawerWidth = (null === (_this = await page.getByTestId('drawer-Action.Container-general-Add record').boundingBox()) || void 0 === _this ? void 0 : _this.width) || 0;
            (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(drawerWidth).toBeLessThanOrEqual(400);
            await page.getByLabel('drawer-Action.Container-general-Add record-mask').click();
            await showMenu(page);
            await page.getByRole('menuitem', {
                name: 'Popup size'
            }).click();
            await page.getByRole('option', {
                name: 'Large'
            }).click();
            await page.getByRole('button', {
                name: 'Add new'
            }).click();
            const drawerWidth2 = (null === (_this1 = await page.getByTestId('drawer-Action.Container-general-Add record').boundingBox()) || void 0 === _this1 ? void 0 : _this1.width) || 0;
            (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(drawerWidth2).toBeGreaterThanOrEqual(800);
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('delete', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).goto();
            await showMenu(page);
            await page.getByRole('menuitem', {
                name: 'Delete'
            }).click();
            await page.mouse.move(300, 0);
            await page.getByRole('button', {
                name: 'OK',
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByRole('button', {
                name: 'Add new'
            })).toBeHidden();
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('bulk delete', ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage } = param;
            await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).goto();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: async ()=>{
                    await page.getByRole('button', {
                        name: 'Delete'
                    }).hover();
                    await page.getByRole('button', {
                        name: 'designer-schema-settings-Action-Action.Designer-general'
                    }).hover();
                },
                supportedOptions: [
                    'Edit button',
                    'Delete'
                ]
            });
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('filter', ()=>{
        const showMenu = async (page)=>{
            await page.getByRole('button', {
                name: 'Filter'
            }).hover();
            await page.getByLabel('designer-schema-settings-Filter.Action-Filter.Action.Designer-general').hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).goto();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Delete',
                    'Many to one',
                    'One to many',
                    'Single select',
                    'ID',
                    'Created at',
                    'Last updated at',
                    'Created by',
                    'Last updated by'
                ]
            });
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('delete', ()=>{
        const showMenu = async (page)=>{
            await page.getByLabel('action-Action.Link-Delete-destroy-general-table-0').hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-Action.Link-Action.Designer-general'
            }).hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).waitForInit();
            await mockRecord('general');
            await nocoPage.goto();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Linkage rules',
                    'Delete'
                ]
            });
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('edit button', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).waitForInit();
            await mockRecord('general');
            await nocoPage.goto();
            await showMenu(page);
            await page.getByRole('menuitem', {
                name: 'Edit button'
            }).click();
            await page.getByLabel('block-item-Input-general-Button title').getByRole('textbox').click();
            await page.getByLabel('block-item-Input-general-Button title').getByRole('textbox').fill('Delete record');
            await page.getByRole('button', {
                name: 'OK',
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('action-Action.Link-Delete record-destroy-general-table-0')).toBeVisible();
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('edit', ()=>{
        const showMenu = async (page)=>{
            await page.getByLabel('action-Action.Link-Edit-update-general-table-0').hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-Action.Link-Action.Designer-general'
            }).hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).waitForInit();
            await mockRecord('general');
            await nocoPage.goto();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Linkage rules',
                    'Open mode',
                    'Popup size',
                    'Delete'
                ]
            });
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('refresh', ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage } = param;
            await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).goto();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: async ()=>{
                    await page.getByRole('button', {
                        name: 'Refresh'
                    }).hover();
                    await page.getByRole('button', {
                        name: 'designer-schema-settings-Action-Action.Designer-general'
                    }).hover();
                },
                supportedOptions: [
                    'Edit button',
                    'Delete'
                ]
            });
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('view', ()=>{
        const showMenu = async (page)=>{
            await page.getByLabel('action-Action.Link-View-view-general-table-0').hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-Action.Link-Action.Designer-general'
            }).hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).waitForInit();
            await mockRecord('general');
            await nocoPage.goto();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Linkage rules',
                    'Open mode',
                    'Popup size',
                    'Delete'
                ]
            });
        });
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('linkage rules', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneTableBlockWithAddNewAndViewAndEditAndBasicFields).waitForInit();
            await mockRecord('general');
            await nocoPage.goto();
            const openLinkageRules = async ()=>{
                await page.getByLabel('action-Action.Link-View record-view-general-table-0').hover();
                await page.getByRole('button', {
                    name: 'designer-schema-settings-Action.Link-Action.Designer-general'
                }).hover();
                await page.getByRole('menuitem', {
                    name: 'Linkage rules'
                }).click();
            };
            await openLinkageRules();
            await page.getByRole('button', {
                name: 'plus Add linkage rule'
            }).click();
            await page.getByText('Add condition', {
                exact: true
            }).click();
            await page.getByTestId('select-filter-field').click();
            await page.getByRole('menuitemcheckbox', {
                name: 'ID',
                exact: true
            }).click();
            await page.getByRole('spinbutton').click();
            await page.getByRole('spinbutton').fill('1');
            await page.getByText('Add property').click();
            await page.getByLabel('block-item-ArrayCollapse-general').click();
            await page.getByTestId('select-linkage-properties').click();
            await page.getByRole('option', {
                name: 'Disabled'
            }).click();
            await page.getByRole('button', {
                name: 'OK',
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('action-Action.Link-View record-view-general-table-0')).toHaveAttribute('disabled', '');
            await openLinkageRules();
            await page.getByRole('button', {
                name: 'plus Add linkage rule'
            }).click();
            await page.locator('.ant-collapse-header').nth(1).getByRole('img', {
                name: 'right'
            }).click();
            await page.getByRole('tabpanel').getByText('Add condition', {
                exact: true
            }).click();
            await page.getByRole('button', {
                name: 'Select field'
            }).click();
            await page.getByRole('menuitemcheckbox', {
                name: 'ID',
                exact: true
            }).click();
            await page.getByRole('spinbutton').click();
            await page.getByRole('spinbutton').fill('1');
            await page.getByRole('tabpanel').getByText('Add property').click();
            await page.locator('.ant-select', {
                hasText: 'action'
            }).click();
            await page.getByRole('option', {
                name: 'Enabled'
            }).click();
            await page.getByRole('button', {
                name: 'OK',
                exact: true
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('action-Action.Link-View record-view-general-table-0')).not.toHaveAttribute('disabled', '');
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('popup', ()=>{
        const addSomeCustomActions = async (page)=>{
            await page.getByRole('button', {
                name: 'Actions',
                exact: true
            }).hover();
            await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover();
            await page.getByRole('menuitem', {
                name: 'View'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Edit'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Delete'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Duplicate'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Customize'
            }).hover();
            await page.getByRole('menuitem', {
                name: 'Popup'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Update record'
            }).click();
        };
        const showMenu = async (page)=>{
            await page.getByLabel('action-Action.Link-Popup-customize:popup-general-table-0').hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-Action.Link-actionSettings:popup-general'
            }).hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).waitForInit();
            await mockRecord('general');
            await nocoPage.goto();
            await addSomeCustomActions(page);
            await showMenu(page);
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Linkage rules',
                    'Open mode',
                    'Popup size',
                    'Delete'
                ]
            });
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('duplicate', ()=>{
        const showMenu = async (page)=>{
            await page.getByLabel('action-Action.Link-Duplicate-duplicate-general-table-0').hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-Action.Link-Action.Designer-general'
            }).hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).waitForInit();
            await mockRecord('general');
            await nocoPage.goto();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Linkage rules',
                    'Duplicate mode',
                    'Open mode',
                    'Popup size',
                    'Delete'
                ]
            });
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('update record', ()=>{
        const addSomeCustomActions = async (page)=>{
            await page.getByRole('button', {
                name: 'Actions',
                exact: true
            }).hover();
            await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover();
            await page.getByRole('menuitem', {
                name: 'View'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Edit'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Delete'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Duplicate'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Customize'
            }).hover();
            await page.getByRole('menuitem', {
                name: 'Popup'
            }).click();
            await page.getByRole('menuitem', {
                name: 'Update record'
            }).click();
        };
        const showMenu = async (page)=>{
            await page.getByLabel('action-Action.Link-Update record-customize:update-general-table-0').hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-Action.Link-actionSettings:updateRecord-general'
            }).hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).waitForInit();
            await mockRecord('general');
            await nocoPage.goto();
            await addSomeCustomActions(page);
            await showMenu(page);
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Linkage rules',
                    'Assign field values',
                    'After successful submission',
                    'Delete'
                ]
            });
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('add child', ()=>{
        const showMenu = async (page)=>{
            await page.getByLabel('action-Action.Link-Add child-create-treeCollection-table-0').hover();
            await page.getByLabel('designer-schema-settings-Action.Link-actionSettings:addChild-tree').hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            const nocoPage = await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableWithTreeCollection).waitForInit();
            await nocoPage.goto();
            await page.getByLabel('schema-initializer-ActionBar-table:configureActions-treeCollection').hover();
            await page.getByRole('menuitem', {
                name: 'Add new'
            }).click();
            await page.getByRole('button', {
                name: 'Add new'
            }).click();
            await page.getByLabel('schema-initializer-Grid-popup:addNew:addBlock-treeCollection').hover();
            await page.getByRole('menuitem', {
                name: 'form Form'
            }).click();
            await page.mouse.move(300, 0);
            await page.getByLabel('schema-initializer-ActionBar-createForm:configureActions-treeCollection').hover();
            await page.getByRole('menuitem', {
                name: 'Submit'
            }).click();
            await page.mouse.move(300, 0);
            await page.getByRole('button', {
                name: 'Submit'
            }).click();
            await page.getByRole('button', {
                name: 'Actions',
                exact: true
            }).hover();
            await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-tree').hover();
            await page.getByRole('menuitem', {
                name: 'Add child'
            }).click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Linkage rules',
                    'Open mode',
                    'Popup size',
                    'Delete'
                ]
            });
        });
    });
    __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('add record', ()=>{
        const showMenu = async (page)=>{
            await page.getByRole('button', {
                name: 'Add record'
            }).hover();
            await page.getByRole('button', {
                name: 'designer-schema-settings-Action-Action.Designer-general'
            }).hover();
        };
        (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test)('supported options', async (param)=>{
            let { page, mockPage, mockRecord } = param;
            await mockPage(__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.oneEmptyTableBlockWithActions).goto();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
                page,
                showMenu: ()=>showMenu(page),
                supportedOptions: [
                    'Edit button',
                    'Open mode',
                    'Popup size',
                    'Delete'
                ]
            });
        });
    });
});
async function showSettingsMenu(page) {
    await page.getByLabel('block-item-CardItem-general-table').hover();
    await page.getByLabel('designer-schema-settings-CardItem-TableBlockDesigner-general').hover();
}
