import * as __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__ from "@tachybase/test/e2e";
__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('filter 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__.oneEmptyFilterFormBlock).goto();
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
            page,
            showMenu: async ()=>{
                await page.getByLabel('block-item-CardItem-general-filter-form').hover();
                await page.getByLabel('designer-schema-settings-CardItem-FormV2.FilterDesigner-general').hover();
            },
            supportedOptions: [
                'Edit block title',
                'Save as block template',
                'Linkage rules',
                'Connect data blocks',
                'Delete'
            ]
        });
    });
    __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__.oneFormAndOneTableWithSameCollection).waitForInit();
            const records = await mockRecords('general', 3);
            await nocoPage.goto();
            await page.getByLabel('block-item-CardItem-general-filter-form').hover();
            await page.getByLabel('designer-schema-settings-CardItem-FormV2.FilterDesigner-general').hover();
            await page.getByRole('menuitem', {
                name: 'Connect data blocks'
            }).hover();
            await page.getByRole('menuitem', {
                name: 'General'
            }).click();
            await page.getByLabel('block-item-CollectionField-general-filter-form-general.singleLineText-singleLineText').getByRole('textbox').click();
            await page.getByLabel('block-item-CollectionField-general-filter-form-general.singleLineText-singleLineText').getByRole('textbox').fill(records[0].singleLineText);
            await page.getByLabel('action-Action-Filter records-submit-general-filter-form').click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-general-table').getByRole('row', {
                name: records[1].singleLineText
            })).toBeHidden();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-general-table').getByRole('row', {
                name: records[2].singleLineText
            })).toBeHidden();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-general-table').getByRole('row', {
                name: records[0].singleLineText
            })).toBeVisible();
            await page.getByLabel('action-Action-Reset records-general-filter-form').click();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-general-table').getByRole('row', {
                name: records[1].singleLineText
            })).toBeVisible();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-general-table').getByRole('row', {
                name: records[2].singleLineText
            })).toBeVisible();
            await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expect)(page.getByLabel('block-item-CardItem-general-table').getByRole('row', {
                name: records[0].singleLineText
            })).toBeVisible();
        });
    });
});
__WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.test.describe('actions 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__.oneEmptyFilterFormBlock).goto();
        await page.getByLabel('schema-initializer-ActionBar-filterForm:configureActions-general').hover();
        await page.getByRole('menuitem', {
            name: 'Filter'
        }).click();
        await page.getByRole('menuitem', {
            name: 'Reset'
        }).click();
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
            page,
            showMenu: async ()=>{
                await page.getByLabel('action-Action-Filter-submit-general-filter-form').hover();
                await page.getByRole('button', {
                    name: 'designer-schema-settings-Action'
                }).hover();
            },
            supportedOptions: [
                'Edit button',
                'Delete'
            ]
        });
        await (0, __WEBPACK_EXTERNAL_MODULE__tachybase_test_e2e__.expectSettingsMenu)({
            page,
            showMenu: async ()=>{
                await page.getByLabel('action-Action-Reset-general-filter-form').hover();
                await page.getByRole('button', {
                    name: 'designer-schema-settings-Action'
                }).hover();
            },
            supportedOptions: [
                'Edit button',
                'Delete'
            ]
        });
    });
});
